33 lines
986 B
Zig
33 lines
986 B
Zig
const std = @import("std");
|
|
|
|
const nr_of_days = 12;
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const run_all = b.step("run", "Run all days");
|
|
|
|
const day_option = b.option(usize, "day", "Build day");
|
|
|
|
for (1..nr_of_days + 1) |day| {
|
|
const exe = b.addExecutable(.{
|
|
.name = b.fmt("run-day{d:0>2}", .{day}),
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("src/main.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
}),
|
|
});
|
|
exe.root_module.addAnonymousImport("day", .{
|
|
.root_source_file = b.path(b.fmt("src/days/day{d:0>2}.zig", .{day})),
|
|
});
|
|
b.installArtifact(exe);
|
|
|
|
if (day_option == null or day_option == day) {
|
|
const run_cmd = b.addRunArtifact(exe);
|
|
run_all.dependOn(&run_cmd.step);
|
|
}
|
|
}
|
|
}
|
|
|