NOCLIP/build.zig
torque 074db7f4f6
build: update for zig-0.12.0-dev.2208+4debd4338
I may move this commit to a separate branch, since there are a variety
of improvements that I think I want to get applied to the
0.11.x-compatible codebase still. However, I have also not been
motivated to work on those fixes, since this codebase is kind of
crusty due to being the first thing I ever wrote in zig. Doing a
bigger rewrite might supply the motivation to make those improvements.
I will have to think about it. For now, I am going to focus elsewhere.
2024-01-15 22:45:59 -08:00

43 lines
1.2 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target: std.Build.ResolvedTarget = b.standardTargetOptions(.{});
const optimize: std.builtin.Mode = b.standardOptimizeOption(.{});
const noclip = b.addModule("noclip", .{
.root_source_file = .{ .path = "source/noclip.zig" },
});
demo(b, noclip, target, optimize);
const test_step = b.step("test", "Run unit tests");
const tests = b.addTest(.{
.name = "tests",
.root_source_file = .{ .path = "source/noclip.zig" },
.target = target,
.optimize = optimize,
});
test_step.dependOn(&tests.step);
}
fn demo(
b: *std.Build,
noclip: *std.Build.Module,
target: std.Build.ResolvedTarget,
optimize: std.builtin.Mode,
) void {
const demo_step = b.step("demo", "Build and install CLI demo program");
const exe = b.addExecutable(.{
.name = "noclip-demo",
.root_source_file = .{ .path = "demo/demo.zig" },
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("noclip", noclip);
const install_demo = b.addInstallArtifact(exe, .{});
demo_step.dependOn(&install_demo.step);
}