NOCLIP/build.zig

41 lines
1.1 KiB
Zig
Raw Normal View History

2022-11-20 12:54:26 -08:00
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(.{});
2022-11-20 12:54:26 -08:00
const test_step = b.step("test", "Run unit tests");
const tests = b.addTest(.{
.name = "tests",
2025-03-14 00:17:58 -06:00
.root_source_file = b.path("source/parser.zig"),
.target = target,
.optimize = optimize,
});
2022-11-20 12:54:26 -08:00
2025-03-14 00:17:58 -06:00
const run_main_tests = b.addRunArtifact(tests);
test_step.dependOn(&b.addInstallArtifact(tests, .{}).step);
test_step.dependOn(&run_main_tests.step);
}
2022-11-20 12:54:26 -08:00
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",
2024-06-18 18:02:32 -07:00
.root_source_file = b.path("demo/demo.zig"),
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("noclip", noclip);
const install_demo = b.addInstallArtifact(exe, .{});
2022-11-20 12:54:26 -08:00
demo_step.dependOn(&install_demo.step);
2022-11-20 12:54:26 -08:00
}