advent-of-code/2024/build.zig

34 lines
1.2 KiB
Zig
Raw Normal View History

2024-12-02 19:47:32 -05:00
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const install_all = b.step("install-all", "Install all days");
const run_all = b.step("run-all", "Run all days");
const num_days = b.option(u32, "num-days", "The number of days to process") orelse 25;
var day: u8 = 1;
while (day <= num_days) : (day += 1) {
2024-12-04 00:02:37 -05:00
const name = b.fmt("day{d}", .{day});
const file = b.fmt("src/{s}.zig", .{name});
2024-12-02 19:47:32 -05:00
const exe = b.addExecutable(.{
2024-12-04 00:02:37 -05:00
.name = name,
2024-12-02 19:47:32 -05:00
.root_source_file = b.path(file),
.target = target,
.optimize = optimize,
});
const install_exe = b.addInstallArtifact(exe, .{});
2024-12-04 00:02:37 -05:00
const install_step = b.step(b.fmt("install_{s}", .{name}), b.fmt("Install {s}", .{name}));
2024-12-02 19:47:32 -05:00
install_step.dependOn(&install_exe.step);
install_all.dependOn(&install_exe.step);
const run_exe = b.addRunArtifact(exe);
2024-12-04 00:02:37 -05:00
const run_step = b.step(b.fmt("run_{s}", .{name}), b.fmt("Run {s}", .{name}));
2024-12-02 19:47:32 -05:00
run_step.dependOn(&run_exe.step);
run_all.dependOn(&run_exe.step);
}
}