-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.zig
60 lines (56 loc) · 1.61 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
const std = @import("std");
const Solutions = [_]struct { []const u8, []const u8 }{
.{ "2021", "01" },
.{ "2024", "01" },
.{ "2024", "02" },
.{ "2024", "03" },
.{ "2024", "04" },
.{ "2024", "05" },
.{ "2024", "06" },
.{ "2024", "07" },
.{ "2024", "08" },
.{ "2024", "09" },
.{ "2024", "10" },
.{ "2024", "11" },
.{ "2024", "12" },
.{ "2024", "13" },
.{ "2024", "14" },
.{ "2024", "15" },
.{ "2024", "16" },
.{ "2024", "17" },
.{ "2024", "18" },
.{ "2024", "19" },
.{ "2024", "20" },
.{ "2024", "21" },
.{ "2024", "22" },
.{ "2024", "23" },
.{ "2024", "24" },
.{ "2024", "25" },
};
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = b.addModule("aoc", .{
.root_source_file = b.path("commons/zig/mod.zig"),
.target = target,
.optimize = optimize,
});
inline for (Solutions) |solution| {
const year = solution[0];
const day = solution[1];
const exe = b.addExecutable(.{
.name = year ++ "_" ++ day,
.root_source_file = b.path(year ++ "/" ++ day ++ "/solver.zig"),
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("aoc", lib);
b.installArtifact(exe);
const run_exe = b.addRunArtifact(exe);
if (b.args) |args| {
run_exe.addArgs(args);
}
const run_step = b.step(exe.name, "Run " ++ year ++ " " ++ day);
run_step.dependOn(&run_exe.step);
}
}