-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
62 lines (50 loc) · 1.83 KB
/
build.zig
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
51
52
53
54
55
56
57
58
59
60
61
62
const std = @import("std");
pub fn build(b: *std.Build) !void {
// Xsummer build
const xsummer_build = b.addSystemCommand(&.{
"cd", "xsummer", "&&", "zig", "build",
});
xsummer_build.setName("xsummer-build");
// Yclient build
const yclient_build = b.addSystemCommand(&.{
"cargo", "build",
"--manifest-path", "yclient/Cargo.toml",
});
yclient_build.setName("yclient-build");
// Clean commands
const xsummer_clean = b.addSystemCommand(&.{
"rm", "-rf",
"xsummer/.zig-cache", "xsummer/zig-out",
});
const yclient_clean = b.addSystemCommand(&.{
"cargo", "clean",
"--manifest-path", "yclient/Cargo.toml",
});
// Run commands
const xsummer_run = b.addSystemCommand(&.{
"cd", "xsummer", "&&", "zig", "build", "run",
});
const yclient_run = b.addSystemCommand(&.{
"cargo", "run",
"--manifest-path", "yclient/Cargo.toml",
});
// Individual project steps
const xsummer_step = b.step("xsummer", "Build only xsummer");
xsummer_step.dependOn(&xsummer_build.step);
const yclient_step = b.step("yclient", "Build only yclient");
yclient_step.dependOn(&yclient_build.step);
// Clean steps
const clean_step = b.step("clean", "Clean all build artifacts");
clean_step.dependOn(&xsummer_clean.step);
clean_step.dependOn(&yclient_clean.step);
// Run steps
const run_step = b.step("run", "Run all projects");
run_step.dependOn(&xsummer_run.step);
run_step.dependOn(&yclient_run.step);
// Main build step
const build_step = b.step("build", "Build all projects");
build_step.dependOn(&xsummer_build.step);
build_step.dependOn(&yclient_build.step);
// Make build the default step
b.default_step = build_step;
}