2022-11-20 12:54:26 -08:00
|
|
|
const std = @import("std");
|
|
|
|
|
2023-06-01 22:35:12 -07:00
|
|
|
pub fn build(b: *std.Build) void {
|
|
|
|
const target: std.Build.CrossTarget = b.standardTargetOptions(.{});
|
|
|
|
const optimize: std.builtin.Mode = b.standardOptimizeOption(.{});
|
2022-11-20 12:54:26 -08:00
|
|
|
|
2023-06-01 22:35:12 -07:00
|
|
|
const noclip = b.addModule("noclip", .{
|
|
|
|
.source_file = .{ .path = "source/noclip.zig" }
|
|
|
|
});
|
|
|
|
|
|
|
|
demo(b, noclip, target, optimize);
|
2023-03-30 17:00:49 -07:00
|
|
|
|
2023-04-10 23:56:00 -07:00
|
|
|
const test_step = b.step("test", "Run unit tests");
|
|
|
|
const tests = b.addTest(.{
|
2023-03-30 17:00:49 -07:00
|
|
|
.name = "tests",
|
2023-03-20 19:54:13 -07:00
|
|
|
.root_source_file = .{ .path = "source/noclip.zig" },
|
|
|
|
.target = target,
|
|
|
|
.optimize = optimize,
|
|
|
|
});
|
2022-11-20 12:54:26 -08:00
|
|
|
|
2023-04-10 23:56:00 -07:00
|
|
|
test_step.dependOn(&tests.step);
|
2023-03-30 17:00:49 -07:00
|
|
|
}
|
2022-11-20 12:54:26 -08:00
|
|
|
|
2023-06-01 22:35:12 -07:00
|
|
|
fn demo(b: *std.Build, noclip: *std.Build.Module, target: std.Build.CrossTarget, optimize: std.builtin.Mode) void {
|
2023-03-30 17:00:49 -07:00
|
|
|
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" },
|
2023-03-20 19:54:13 -07:00
|
|
|
.target = target,
|
|
|
|
.optimize = optimize,
|
|
|
|
});
|
2023-03-30 17:00:49 -07:00
|
|
|
exe.addModule("noclip", noclip);
|
|
|
|
const install_demo = b.addInstallArtifact(exe);
|
2022-11-20 12:54:26 -08:00
|
|
|
|
2023-03-30 17:00:49 -07:00
|
|
|
demo_step.dependOn(&install_demo.step);
|
2022-11-20 12:54:26 -08:00
|
|
|
}
|