build.zig: rework for build system changes

At some point I will also figure out the proper way to make this a
module, I guess.
This commit is contained in:
torque 2023-03-20 19:54:13 -07:00
parent 04722f938e
commit 0afad6b585
Signed by: torque
SSH Key Fingerprint: SHA256:nCrXefBNo6EbjNSQhv0nXmEg/VuNq3sMF5b8zETw3Tk

View File

@ -4,24 +4,33 @@ pub fn build(b: *std.build.Builder) void {
const demo = b.step("demo", "noclip demo"); const demo = b.step("demo", "noclip demo");
const tests = b.step("test", "Run unit tests"); const tests = b.step("test", "Run unit tests");
// b.use_stage1 = false;
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions(); const optimize = b.standardOptimizeOption(.{});
const exe = b.addSharedLibrary("noclip", "source/noclip.zig", .unversioned); const exe = b.addSharedLibrary(.{
.name = "noclip",
exe.setTarget(target); .root_source_file = .{ .path = "source/noclip.zig" },
exe.setBuildMode(mode); .target = target,
.optimize = optimize,
});
exe.install(); exe.install();
const demo_exe = b.addExecutable("noclip-demo", "demo/demo.zig"); const demo_exe = b.addExecutable(.{
demo_exe.addPackagePath("noclip", "source/noclip.zig"); .name = "noclip-demo",
.root_source_file = .{ .path = "demo/demo.zig" },
});
demo_exe.addModule("noclip", b.createModule(.{
.source_file = .{ .path = "source/noclip.zig" },
}));
const install_demo = b.addInstallArtifact(demo_exe); const install_demo = b.addInstallArtifact(demo_exe);
demo.dependOn(&install_demo.step); demo.dependOn(&install_demo.step);
const lib_tests = b.addTest("source/noclip.zig"); const lib_tests = b.addTest(.{
lib_tests.setTarget(target); .name = "tests",
lib_tests.setBuildMode(mode); .root_source_file = .{ .path = "source/noclip.zig" },
.target = target,
.optimize = optimize,
});
tests.dependOn(&lib_tests.step); tests.dependOn(&lib_tests.step);
} }