diff options
| author | 2024-02-11 19:08:34 -0400 | |
|---|---|---|
| committer | 2024-02-11 19:08:34 -0400 | |
| commit | ed5ce42ba8fc67db8a8bb385490ccec7a218a7e3 (patch) | |
| tree | 807136431dd297ccc273895f09bc7152e5347bb2 /build.zig | |
| download | zg-ed5ce42ba8fc67db8a8bb385490ccec7a218a7e3.tar.gz zg-ed5ce42ba8fc67db8a8bb385490ccec7a218a7e3.tar.xz zg-ed5ce42ba8fc67db8a8bb385490ccec7a218a7e3.zip | |
init
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..bb0a33b --- /dev/null +++ b/build.zig | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn build(b: *std.Build) void { | ||
| 4 | const target = b.standardTargetOptions(.{}); | ||
| 5 | const optimize = b.standardOptimizeOption(.{}); | ||
| 6 | |||
| 7 | const ziglyph = b.dependency("ziglyph", .{}); | ||
| 8 | |||
| 9 | const gen_exe = b.addExecutable(.{ | ||
| 10 | .name = "gen", | ||
| 11 | .root_source_file = .{ .path = "src/gbp_gen.zig" }, | ||
| 12 | .target = target, | ||
| 13 | .optimize = optimize, | ||
| 14 | }); | ||
| 15 | gen_exe.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); | ||
| 16 | const run_gen_exe = b.addRunArtifact(gen_exe); | ||
| 17 | const gen_out = run_gen_exe.addOutputFileArg("gbp.zig"); | ||
| 18 | |||
| 19 | const exe = b.addExecutable(.{ | ||
| 20 | .name = "zgbench", | ||
| 21 | .root_source_file = .{ .path = "src/main.zig" }, | ||
| 22 | .target = target, | ||
| 23 | .optimize = optimize, | ||
| 24 | }); | ||
| 25 | exe.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); | ||
| 26 | exe.root_module.addAnonymousImport("gbp", .{ .root_source_file = gen_out }); | ||
| 27 | b.installArtifact(exe); | ||
| 28 | |||
| 29 | const run_cmd = b.addRunArtifact(exe); | ||
| 30 | run_cmd.step.dependOn(b.getInstallStep()); | ||
| 31 | if (b.args) |args| run_cmd.addArgs(args); | ||
| 32 | |||
| 33 | const run_step = b.step("run", "Run the app"); | ||
| 34 | run_step.dependOn(&run_cmd.step); | ||
| 35 | |||
| 36 | const exe_unit_tests = b.addTest(.{ | ||
| 37 | .root_source_file = .{ .path = "src/main.zig" }, | ||
| 38 | .target = target, | ||
| 39 | .optimize = optimize, | ||
| 40 | }); | ||
| 41 | |||
| 42 | const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); | ||
| 43 | |||
| 44 | const test_step = b.step("test", "Run unit tests"); | ||
| 45 | test_step.dependOn(&run_exe_unit_tests.step); | ||
| 46 | } | ||