model3d: set cross-target when compiling statically (#616)
This is required for building with a non-native target, otherwise library is build for the native platform and attempts to link fail
This commit is contained in:
parent
917b0eb8be
commit
d21cce37a4
1 changed files with 3 additions and 2 deletions
|
|
@ -16,13 +16,14 @@ pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.C
|
||||||
const main_tests = b.addTestExe("model3d-tests", "src/main.zig");
|
const main_tests = b.addTestExe("model3d-tests", "src/main.zig");
|
||||||
main_tests.setBuildMode(mode);
|
main_tests.setBuildMode(mode);
|
||||||
main_tests.setTarget(target);
|
main_tests.setTarget(target);
|
||||||
link(b, main_tests);
|
link(b, main_tests, target);
|
||||||
main_tests.install();
|
main_tests.install();
|
||||||
return main_tests.run();
|
return main_tests.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn link(b: *std.build.Builder, step: *std.build.LibExeObjStep) void {
|
pub fn link(b: *std.build.Builder, step: *std.build.LibExeObjStep, target: std.zig.CrossTarget) void {
|
||||||
const lib = b.addStaticLibrarySource("model3d", null);
|
const lib = b.addStaticLibrarySource("model3d", null);
|
||||||
|
lib.setTarget(target);
|
||||||
lib.addCSourceFile(sdkPath("/src/c/m3d.c"), &.{ "-std=c89" });
|
lib.addCSourceFile(sdkPath("/src/c/m3d.c"), &.{ "-std=c89" });
|
||||||
lib.linkLibC();
|
lib.linkLibC();
|
||||||
step.addIncludePath(sdkPath("/src/c/"));
|
step.addIncludePath(sdkPath("/src/c/"));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue