diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 25 |
1 files changed, 23 insertions, 2 deletions
| @@ -17,6 +17,15 @@ pub fn build(b: *std.Build) void { | |||
| 17 | const run_gbp_gen_exe = b.addRunArtifact(gbp_gen_exe); | 17 | const run_gbp_gen_exe = b.addRunArtifact(gbp_gen_exe); |
| 18 | const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.zig"); | 18 | const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.zig"); |
| 19 | 19 | ||
| 20 | const dwp_gen_exe = b.addExecutable(.{ | ||
| 21 | .name = "dwp", | ||
| 22 | .root_source_file = .{ .path = "codegen/dwp.zig" }, | ||
| 23 | .target = b.host, | ||
| 24 | .optimize = .Debug, | ||
| 25 | }); | ||
| 26 | const run_dwp_gen_exe = b.addRunArtifact(dwp_gen_exe); | ||
| 27 | const dwp_gen_out = run_dwp_gen_exe.addOutputFileArg("dwp.zig"); | ||
| 28 | |||
| 20 | // Modules we provide | 29 | // Modules we provide |
| 21 | const code_point = b.addModule("CodePoint", .{ | 30 | const code_point = b.addModule("CodePoint", .{ |
| 22 | .root_source_file = .{ .path = "src/CodePoint.zig" }, | 31 | .root_source_file = .{ .path = "src/CodePoint.zig" }, |
| @@ -32,6 +41,15 @@ pub fn build(b: *std.Build) void { | |||
| 32 | grapheme.addImport("CodePoint", code_point); | 41 | grapheme.addImport("CodePoint", code_point); |
| 33 | grapheme.addAnonymousImport("gbp", .{ .root_source_file = gbp_gen_out }); | 42 | grapheme.addAnonymousImport("gbp", .{ .root_source_file = gbp_gen_out }); |
| 34 | 43 | ||
| 44 | const display_width = b.addModule("display_width", .{ | ||
| 45 | .root_source_file = .{ .path = "src/display_width.zig" }, | ||
| 46 | .target = target, | ||
| 47 | .optimize = optimize, | ||
| 48 | }); | ||
| 49 | display_width.addImport("CodePoint", code_point); | ||
| 50 | display_width.addImport("Grapheme", grapheme); | ||
| 51 | display_width.addAnonymousImport("dwp", .{ .root_source_file = dwp_gen_out }); | ||
| 52 | |||
| 35 | // Benchmark rig | 53 | // Benchmark rig |
| 36 | const exe = b.addExecutable(.{ | 54 | const exe = b.addExecutable(.{ |
| 37 | .name = "zgbench", | 55 | .name = "zgbench", |
| @@ -40,7 +58,9 @@ pub fn build(b: *std.Build) void { | |||
| 40 | .optimize = optimize, | 58 | .optimize = optimize, |
| 41 | }); | 59 | }); |
| 42 | exe.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); | 60 | exe.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); |
| 61 | exe.root_module.addImport("CodePoint", code_point); | ||
| 43 | exe.root_module.addImport("Grapheme", grapheme); | 62 | exe.root_module.addImport("Grapheme", grapheme); |
| 63 | exe.root_module.addImport("display_width", display_width); | ||
| 44 | b.installArtifact(exe); | 64 | b.installArtifact(exe); |
| 45 | 65 | ||
| 46 | const run_cmd = b.addRunArtifact(exe); | 66 | const run_cmd = b.addRunArtifact(exe); |
| @@ -52,12 +72,13 @@ pub fn build(b: *std.Build) void { | |||
| 52 | 72 | ||
| 53 | // Tests | 73 | // Tests |
| 54 | const exe_unit_tests = b.addTest(.{ | 74 | const exe_unit_tests = b.addTest(.{ |
| 55 | .root_source_file = .{ .path = "src/main.zig" }, | 75 | .root_source_file = .{ .path = "src/display_width.zig" }, |
| 56 | .target = target, | 76 | .target = target, |
| 57 | .optimize = optimize, | 77 | .optimize = optimize, |
| 58 | }); | 78 | }); |
| 59 | exe_unit_tests.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); | 79 | exe_unit_tests.root_module.addImport("CodePoint", code_point); |
| 60 | exe_unit_tests.root_module.addImport("Grapheme", grapheme); | 80 | exe_unit_tests.root_module.addImport("Grapheme", grapheme); |
| 81 | exe_unit_tests.root_module.addAnonymousImport("dwp", .{ .root_source_file = dwp_gen_out }); | ||
| 61 | 82 | ||
| 62 | const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); | 83 | const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); |
| 63 | 84 | ||