-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.zig
38 lines (34 loc) · 1.12 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
const std = @import("std");
const Solutions = [_]struct { []const u8, []const u8 }{
.{ "2021", "01" },
.{ "2024", "01" },
.{ "2024", "02" },
.{ "2024", "03" },
};
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);
}
}