AoC2025/build.zig
2025-11-30 23:09:12 +00:00

35 lines
1,022 B
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// TODO: This should be a non-exhaustive enum with one option: all
const day = b.option(u8, "day", "Build day") orelse 1;
// TODO: Depending on the day chosen, only that day should compile, or all days
const exe = addDay(b, target, optimize, day);
b.installArtifact(exe);
// run step
const run_exe = b.addRunArtifact(exe);
const run_step = b.step("run", "Run the binary");
run_step.dependOn(&run_exe.step);
}
fn addDay(
b: *std.Build,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
day: u8,
) *std.Build.Step.Compile {
return b.addExecutable(.{
.name = "aoc2025",
.root_module = b.createModule(.{
.root_source_file = b.path(b.fmt("src/day_{d}.zig", .{day})),
.target = target,
.optimize = optimize,
}),
});
}