-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
64 lines (51 loc) · 2.25 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
63
64
const Builder = @import("std").build.Builder;
pub fn build(b: *Builder) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{});
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("riptide", "src/main.zig");
exe.addPackagePath("mecha", "libs/mecha/mecha.zig");
exe.setTarget(target);
exe.setBuildMode(mode);
exe.use_stage1 = true;
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
const test_files: [8][]const u8 = [_][]const u8{
"src/transposition_test.zig",
"src/make_move_test.zig",
"src/moveorder_test.zig",
"src/move_test.zig",
"src/movegen_test.zig",
"src/position_test.zig",
"src/evaluate_test.zig",
"src/zobrist_test.zig",
};
const test_step = b.step("test", "Run all tests");
for (test_files) |test_file| {
const test_target = b.addTest(test_file);
test_target.use_stage1 = true;
test_target.addPackagePath("mecha", "libs/mecha/mecha.zig");
test_step.dependOn(&test_target.step);
}
const perft_test_target = b.addTest("src/perft_test.zig");
perft_test_target.use_stage1 = true;
perft_test_target.addPackagePath("mecha", "libs/mecha/mecha.zig");
const perft_test_step = b.step("perft", "Run perft move generation tests (slow)");
perft_test_step.dependOn(&perft_test_target.step);
const nps_test_target = b.addTest("src/nps_test.zig");
nps_test_target.use_stage1 = true;
nps_test_target.addPackagePath("mecha", "libs/mecha/mecha.zig");
const nps_test_step = b.step("nps", "Run nodes per second benchmark");
nps_test_step.dependOn(&nps_test_target.step);
}