2022-11-20 12:54:26 -08:00
|
|
|
const std = @import("std");
|
|
|
|
|
|
|
|
pub fn build(b: *std.build.Builder) void {
|
|
|
|
const target = b.standardTargetOptions(.{});
|
2023-03-20 19:54:13 -07:00
|
|
|
const optimize = b.standardOptimizeOption(.{});
|
2022-11-20 12:54:26 -08:00
|
|
|
|
2023-03-30 17:00:49 -07:00
|
|
|
demo(b, target, optimize);
|
2023-04-05 03:23:01 -07:00
|
|
|
tokenator(b, target, optimize);
|
2023-03-30 17:00:49 -07:00
|
|
|
|
|
|
|
const tests = b.step("test", "Run unit tests");
|
|
|
|
const lib_tests = b.addTest(.{
|
|
|
|
.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-03-30 17:00:49 -07:00
|
|
|
tests.dependOn(&lib_tests.step);
|
|
|
|
}
|
2022-11-20 12:54:26 -08:00
|
|
|
|
2023-03-30 17:00:49 -07:00
|
|
|
fn demo(b: *std.build.Builder, target: anytype, optimize: anytype) void {
|
|
|
|
const demo_step = b.step("demo", "Build and install CLI demo program");
|
|
|
|
const noclip = b.createModule(.{ .source_file = .{ .path = "source/noclip.zig" } });
|
|
|
|
|
|
|
|
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
|
|
|
}
|
2023-04-05 03:23:01 -07:00
|
|
|
|
|
|
|
fn tokenator(b: *std.build.Builder, target: anytype, optimize: anytype) void {
|
|
|
|
const tok_step = b.step("tokenator", "Build documentation tokenizer");
|
|
|
|
const noclip = b.createModule(.{ .source_file = .{ .path = "source/noclip.zig" } });
|
|
|
|
|
|
|
|
const exe = b.addExecutable(.{
|
|
|
|
.name = "tokenator",
|
|
|
|
.root_source_file = .{ .path = "documentation/tokenator.zig" },
|
|
|
|
.target = target,
|
|
|
|
.optimize = optimize,
|
|
|
|
});
|
|
|
|
exe.addModule("noclip", noclip);
|
|
|
|
const install_tok = b.addInstallArtifact(exe);
|
|
|
|
|
|
|
|
tok_step.dependOn(&install_tok.step);
|
|
|
|
}
|