mirror of
https://codeberg.org/andyscott/advent-of-code.git
synced 2024-12-22 01:23:11 -05:00
33 lines
1.2 KiB
Zig
33 lines
1.2 KiB
Zig
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) {
|
|
const name = b.fmt("day{d}", .{day});
|
|
const file = b.fmt("src/{s}.zig", .{name});
|
|
|
|
const exe = b.addExecutable(.{
|
|
.name = name,
|
|
.root_source_file = b.path(file),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
const install_exe = b.addInstallArtifact(exe, .{});
|
|
const install_step = b.step(b.fmt("install_{s}", .{name}), b.fmt("Install {s}", .{name}));
|
|
install_step.dependOn(&install_exe.step);
|
|
install_all.dependOn(&install_exe.step);
|
|
|
|
const run_exe = b.addRunArtifact(exe);
|
|
const run_step = b.step(b.fmt("run_{s}", .{name}), b.fmt("Run {s}", .{name}));
|
|
run_step.dependOn(&run_exe.step);
|
|
run_all.dependOn(&run_exe.step);
|
|
}
|
|
}
|