Repository navigation
Expand file tree
/
Copy pathbuild.zig
More file actions
48 lines (42 loc) · 1.52 KB
/
Copy pathbuild.zig
File metadata and controls
48 lines (42 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const std = @import("std");
const deps = @import("./deps.zig");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const disable_llvm = b.option(bool, "disable_llvm", "use the non-llvm zig codegen") orelse false;
const exe2 = b.addExecutable(.{
.name = "generate",
.root_module = b.createModule(.{
.root_source_file = b.path("generate.zig"),
.target = target,
.optimize = optimize,
}),
});
deps.addAllTo(exe2);
exe2.root_module.link_libc = true;
exe2.use_llvm = !disable_llvm;
exe2.use_lld = !disable_llvm;
b.installArtifact(exe2);
const run_cmd2 = b.addRunArtifact(exe2);
run_cmd2.step.dependOn(b.getInstallStep());
run_cmd2.addPassthruArgs();
const run_step2 = b.step("gen", "generate the list");
run_step2.dependOn(&run_cmd2.step);
const tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("test.zig"),
.target = target,
.optimize = optimize,
}),
});
deps.addAllTo(tests);
tests.use_llvm = !disable_llvm;
tests.use_lld = !disable_llvm;
b.getInstallStep().dependOn(&tests.step);
const test_step = b.step("test", "Run all library tests");
const tests_run = b.addRunArtifact(tests);
tests_run.setCwd(b.path("."));
tests_run.has_side_effects = true;
test_step.dependOn(&tests_run.step);
test_step.dependOn(&exe2.step);
}