Repository navigation
Expand file tree
/
Copy pathbuild.zig
More file actions
50 lines (42 loc) · 1.4 KB
/
Copy pathbuild.zig
File metadata and controls
50 lines (42 loc) · 1.4 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
49
50
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 t = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("test.zig"),
.target = target,
.optimize = optimize,
}),
});
deps.addAllTo(t);
t.use_llvm = !disable_llvm;
t.use_lld = !disable_llvm;
b.getInstallStep().dependOn(&t.step);
const run_t = b.addRunArtifact(t);
run_t.setCwd(b.path("."));
run_t.has_side_effects = true;
const t_step = b.step("test", "Run all library tests");
t_step.dependOn(&run_t.step);
//
const g = b.addExecutable(.{
.name = "generate",
.root_module = b.addModule("root", .{
.root_source_file = b.path("./generate.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
}),
});
deps.addAllTo(g);
g.use_llvm = !disable_llvm;
g.use_lld = !disable_llvm;
b.getInstallStep().dependOn(&g.step);
const run_g = b.addRunArtifact(g);
run_g.setCwd(b.path("."));
run_g.has_side_effects = true;
const g_step = b.step("generate", "");
g_step.dependOn(&run_g.step);
}