-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
74 lines (67 loc) · 3.98 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
65
66
67
68
69
70
71
72
73
74
const std = @import("std");
const string = []const u8;
const ResolvedTarget = std.Build.ResolvedTarget;
const OptimizeMode = std.builtin.OptimizeMode;
const Step = std.Build.Step;
var previous_test_step: ?*Step = null;
var previous_benchmark_step: ?*Step = null;
/// Add a dependency for each day
fn add_subproject(
b: *std.Build,
target: ResolvedTarget,
optimize: OptimizeMode,
test_step: *Step,
benchmark_step: *Step,
comptime day: string,
comptime name: string,
) void {
const subproject = b.dependency("day_" ++ day ++ "_" ++ name, .{
.target = target,
.optimize = optimize,
});
const subproject_test_step = &b.addRunArtifact(subproject.artifact(name ++ "_tests")).step;
if (previous_test_step) |prev_subproject_test_step| {
subproject_test_step.dependOn(prev_subproject_test_step);
}
test_step.dependOn(subproject_test_step);
previous_test_step = subproject_test_step;
const subproject_benchmark_step = &b.addRunArtifact(subproject.artifact(name ++ "_benchmarks")).step;
if (previous_benchmark_step) |prev_subproject_benchmark_step| {
subproject_benchmark_step.dependOn(prev_subproject_benchmark_step);
}
benchmark_step.dependOn(subproject_benchmark_step);
previous_benchmark_step = subproject_benchmark_step;
}
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const test_step = b.step("test", "Run example tests");
const benchmark_step = b.step("benchmark", "Run puzzle benchmarks");
// ---------------------------- Subprojects ----------------------------- \\
add_subproject(b, target, optimize, test_step, benchmark_step, "00", "zig_template");
add_subproject(b, target, optimize, test_step, benchmark_step, "01", "historian_hysteria");
add_subproject(b, target, optimize, test_step, benchmark_step, "02", "red_nosed_reports");
add_subproject(b, target, optimize, test_step, benchmark_step, "03", "mull_it_over");
add_subproject(b, target, optimize, test_step, benchmark_step, "04", "ceres_search");
add_subproject(b, target, optimize, test_step, benchmark_step, "05", "print_queue");
add_subproject(b, target, optimize, test_step, benchmark_step, "06", "guard_gallivant");
add_subproject(b, target, optimize, test_step, benchmark_step, "07", "bridge_repair");
add_subproject(b, target, optimize, test_step, benchmark_step, "08", "resonant_collinearity");
add_subproject(b, target, optimize, test_step, benchmark_step, "09", "disk_fragmenter");
add_subproject(b, target, optimize, test_step, benchmark_step, "10", "hoof_it");
add_subproject(b, target, optimize, test_step, benchmark_step, "11", "plutonian_pebbles");
add_subproject(b, target, optimize, test_step, benchmark_step, "12", "garden_groups");
add_subproject(b, target, optimize, test_step, benchmark_step, "13", "claw_contraption");
add_subproject(b, target, optimize, test_step, benchmark_step, "14", "restroom_redoubt");
add_subproject(b, target, optimize, test_step, benchmark_step, "15", "warehouse_woes");
add_subproject(b, target, optimize, test_step, benchmark_step, "16", "reindeer_maze");
add_subproject(b, target, optimize, test_step, benchmark_step, "17", "chronospatial_computer");
add_subproject(b, target, optimize, test_step, benchmark_step, "18", "ram_run");
add_subproject(b, target, optimize, test_step, benchmark_step, "19", "linen_layout");
add_subproject(b, target, optimize, test_step, benchmark_step, "20", "race_condition");
add_subproject(b, target, optimize, test_step, benchmark_step, "21", "keypad_conundrum");
add_subproject(b, target, optimize, test_step, benchmark_step, "22", "monkey_market");
add_subproject(b, target, optimize, test_step, benchmark_step, "23", "lan_party");
add_subproject(b, target, optimize, test_step, benchmark_step, "24", "crossed_wires");
add_subproject(b, target, optimize, test_step, benchmark_step, "25", "code_chronicle");
}