| ... | @@ -6,11 +6,18 @@ pub fn build(b: *std.Build) void { | ... | @@ -6,11 +6,18 @@ pub fn build(b: *std.Build) void { |
| 6 | | 6 | |
| 7 | const mod = b.addModule("tracer", .{ .source_file = .{ .path = "src/mod.zig" } }); | 7 | const mod = b.addModule("tracer", .{ .source_file = .{ .path = "src/mod.zig" } }); |
| 8 | | 8 | |
| | 9 | addTest(b, target, mode, mod, 0); |
| | 10 | addTest(b, target, mode, mod, 1); |
| | 11 | addTest(b, target, mode, mod, 2); |
| | 12 | } |
| | 13 | |
| | 14 | fn addTest(b: *std.Build, target: std.zig.CrossTarget, mode: std.builtin.Mode, mod: *std.build.Module, comptime backend: u8) void { |
| 9 | const options = b.addOptions(); | 15 | const options = b.addOptions(); |
| 10 | options.addOption(usize, "src_file_trimlen", std.fs.path.dirname(std.fs.path.dirname(@src().file).?).?.len); | 16 | options.addOption(usize, "src_file_trimlen", std.fs.path.dirname(std.fs.path.dirname(@src().file).?).?.len); |
| | 17 | options.addOption(u8, "backend", backend); |
| 11 | | 18 | |
| 12 | const exe = b.addExecutable(.{ | 19 | const exe = b.addExecutable(.{ |
| 13 | .name = "test", | 20 | .name = "test" ++ std.fmt.comptimePrint("{d}", .{backend}), |
| 14 | .root_source_file = .{ .path = "src/main.zig" }, | 21 | .root_source_file = .{ .path = "src/main.zig" }, |
| 15 | .target = target, | 22 | .target = target, |
| 16 | .optimize = mode, | 23 | .optimize = mode, |