Initial commit
This commit is contained in:
commit
f4670e510f
6 changed files with 151 additions and 0 deletions
35
build.zig
Normal file
35
build.zig
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
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,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue