summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig24
1 files changed, 15 insertions, 9 deletions
diff --git a/build.zig b/build.zig
index 0d253e2..03834b4 100644
--- a/build.zig
+++ b/build.zig
@@ -7,17 +7,23 @@ pub fn build(b: *Builder) void {
7 const target = b.standardTargetOptions(.{}); 7 const target = b.standardTargetOptions(.{});
8 8
9 const test_all_step = b.step("test", "Run all tests in all modes."); 9 const test_all_step = b.step("test", "Run all tests in all modes.");
10 inline for (@typeInfo(std.builtin.Mode).Enum.fields) |field| { 10 for ([_]bool{ true, false }) |stage1| {
11 const test_mode = @field(std.builtin.Mode, field.name); 11 for (std.meta.tags(std.builtin.Mode)) |test_mode| {
12 const mode_str = @tagName(test_mode); 12 const mode_str = @tagName(test_mode);
13 const stage1_str = if (stage1) "stage1" else "stage2";
13 14
14 const tests = b.addTest("clap.zig"); 15 const tests = b.addTest("clap.zig");
15 tests.setBuildMode(test_mode); 16 tests.setBuildMode(test_mode);
16 tests.setTarget(target); 17 tests.setTarget(target);
18 tests.use_stage1 = stage1;
17 19
18 const test_step = b.step("test-" ++ mode_str, "Run all tests in " ++ mode_str ++ "."); 20 const test_step = b.step(
19 test_step.dependOn(&tests.step); 21 b.fmt("test-{s}-{s}", .{ stage1_str, mode_str }),
20 test_all_step.dependOn(test_step); 22 b.fmt("Run all tests with {s} compiler in {s}.", .{ stage1_str, mode_str }),
23 );
24 test_step.dependOn(&tests.step);
25 test_all_step.dependOn(test_step);
26 }
21 } 27 }
22 28
23 const example_step = b.step("examples", "Build examples"); 29 const example_step = b.step("examples", "Build examples");