| ... | @@ -7,16 +7,42 @@ pub fn build(b: *std.Build) void { | ... | @@ -7,16 +7,42 @@ pub fn build(b: *std.Build) void { |
| 7 | const optimize: std.builtin.OptimizeMode = .Debug; | 7 | const optimize: std.builtin.OptimizeMode = .Debug; |
| 8 | const target = b.standardTargetOptions(.{}); | 8 | const target = b.standardTargetOptions(.{}); |
| 9 | | 9 | |
| 10 | const exe_names: []const []const u8 = &.{ "test", "test-dync", "test-no-llvm", "test-no-llvm-dync" }; | 10 | const exe_names: []const []const u8 = &.{ |
| 11 | const lib_names: []const []const u8 = &.{ "mathtest", "mathtest-dync", "mathtest-no-llvm", "mathtest-no-llvm-dync" }; | 11 | "test", |
| 12 | const lib_link_libc: []const bool = &.{ false, true, false, true }; | 12 | "test-dync", |
| 13 | const lib_use_llvm: []const bool = &.{ true, true, false, false }; | 13 | "test-no-llvm", |
| 14 | | 14 | "test-no-llvm-dync", |
| 15 | for (exe_names, lib_names, lib_link_libc, lib_use_llvm) |exe_name, lib_name, dyn_libc, use_llvm| { | 15 | "test-exe-no-llvm", |
| 16 | if (!use_llvm and target.result.os.tag == .macos) continue; // TODO: Library not loaded: @rpath/libmathtest-no-llvm.dylib (segment '__CONST_ZIG' vm address out of order) | 16 | "test-dync-exe-no-llvm", |
| 17 | if (!use_llvm and target.result.os.tag == .freebsd) continue; // TODO: Shared object "libmathtest-no-llvm.so.1" not found | 17 | "test-no-llvm-exe-no-llvm", |
| 18 | if (!use_llvm and target.result.os.tag == .netbsd) continue; // TODO: Shared object "libmathtest-no-llvm.so.1" not found | 18 | "test-no-llvm-dync-exe-no-llvm", |
| 19 | if (!use_llvm and target.result.os.tag == .openbsd) continue; // TODO: duplicate symbol definition: atexit | 19 | }; |
| | 20 | const lib_names: []const []const u8 = &.{ |
| | 21 | "mathtest", |
| | 22 | "mathtest-dync", |
| | 23 | "mathtest-no-llvm", |
| | 24 | "mathtest-no-llvm-dync", |
| | 25 | "mathtest-exe-no-llvm", |
| | 26 | "mathtest-dync-exe-no-llvm", |
| | 27 | "mathtest-no-llvm-exe-no-llvm", |
| | 28 | "mathtest-no-llvm-dync-exe-no-llvm", |
| | 29 | }; |
| | 30 | const lib_link_libc: []const bool = &.{ false, true, false, true, false, true, false, true }; |
| | 31 | const lib_use_llvm: []const bool = &.{ true, true, false, false, true, true, false, false }; |
| | 32 | const exe_use_llvm: []const bool = &.{ true, true, true, true, false, false, false, false }; |
| | 33 | |
| | 34 | for ( |
| | 35 | exe_names, |
| | 36 | lib_names, |
| | 37 | lib_link_libc, |
| | 38 | lib_use_llvm, |
| | 39 | exe_use_llvm, |
| | 40 | ) |exe_name, lib_name, dyn_libc, lib_llvm, exe_llvm| { |
| | 41 | const use_llvm = lib_llvm or exe_llvm; |
| | 42 | if (!use_llvm and target.result.os.tag == .macos) continue; // TODO |
| | 43 | if (!use_llvm and target.result.os.tag == .freebsd) continue; // TODO |
| | 44 | if (!use_llvm and target.result.os.tag == .netbsd) continue; // TODO |
| | 45 | if (!use_llvm and target.result.os.tag == .openbsd) continue; // TODO |
| 20 | if (!use_llvm and target.result.cpu.arch == .loongarch64) continue; // TODO | 46 | if (!use_llvm and target.result.cpu.arch == .loongarch64) continue; // TODO |
| 21 | if (!use_llvm and target.result.cpu.arch == .powerpc64le) continue; // TODO | 47 | if (!use_llvm and target.result.cpu.arch == .powerpc64le) continue; // TODO |
| 22 | if (!use_llvm and target.result.cpu.arch == .s390x) continue; // TODO | 48 | if (!use_llvm and target.result.cpu.arch == .s390x) continue; // TODO |
| ... | @@ -31,7 +57,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -31,7 +57,7 @@ pub fn build(b: *std.Build) void { |
| 31 | .optimize = optimize, | 57 | .optimize = optimize, |
| 32 | .link_libc = dyn_libc, | 58 | .link_libc = dyn_libc, |
| 33 | }), | 59 | }), |
| 34 | .use_llvm = use_llvm, | 60 | .use_llvm = lib_llvm, |
| 35 | }); | 61 | }); |
| 36 | | 62 | |
| 37 | const exe = b.addExecutable(.{ | 63 | const exe = b.addExecutable(.{ |
| ... | @@ -42,6 +68,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -42,6 +68,7 @@ pub fn build(b: *std.Build) void { |
| 42 | .optimize = optimize, | 68 | .optimize = optimize, |
| 43 | .link_libc = true, | 69 | .link_libc = true, |
| 44 | }), | 70 | }), |
| | 71 | .use_llvm = exe_llvm, |
| 45 | }); | 72 | }); |
| 46 | exe.root_module.addCSourceFile(.{ | 73 | exe.root_module.addCSourceFile(.{ |
| 47 | .file = b.path("test.c"), | 74 | .file = b.path("test.c"), |