diff options
| author | 2024-02-20 09:13:36 -0400 | |
|---|---|---|
| committer | 2024-02-20 09:13:36 -0400 | |
| commit | 134a7df8206aa66ca7b0abbc7f31f08410b502d2 (patch) | |
| tree | e3c520dce4f529de5290bc145847e78fb5583bee /build.zig | |
| parent | Cleaned up directory structure (diff) | |
| download | zg-134a7df8206aa66ca7b0abbc7f31f08410b502d2.tar.gz zg-134a7df8206aa66ca7b0abbc7f31f08410b502d2.tar.xz zg-134a7df8206aa66ca7b0abbc7f31f08410b502d2.zip | |
Replaced ccc_map with table. 20ms faster
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 33 |
1 files changed, 28 insertions, 5 deletions
| @@ -33,6 +33,16 @@ pub fn build(b: *std.Build) void { | |||
| 33 | const run_dwp_gen_exe = b.addRunArtifact(dwp_gen_exe); | 33 | const run_dwp_gen_exe = b.addRunArtifact(dwp_gen_exe); |
| 34 | const dwp_gen_out = run_dwp_gen_exe.addOutputFileArg("dwp.zig"); | 34 | const dwp_gen_out = run_dwp_gen_exe.addOutputFileArg("dwp.zig"); |
| 35 | 35 | ||
| 36 | // Normalization properties | ||
| 37 | const normp_gen_exe = b.addExecutable(.{ | ||
| 38 | .name = "normp", | ||
| 39 | .root_source_file = .{ .path = "codegen/normp.zig" }, | ||
| 40 | .target = b.host, | ||
| 41 | .optimize = .Debug, | ||
| 42 | }); | ||
| 43 | const run_normp_gen_exe = b.addRunArtifact(normp_gen_exe); | ||
| 44 | const normp_gen_out = run_normp_gen_exe.addOutputFileArg("normp.zig"); | ||
| 45 | |||
| 36 | // Modules we provide | 46 | // Modules we provide |
| 37 | // Code points | 47 | // Code points |
| 38 | const code_point = b.addModule("code_point", .{ | 48 | const code_point = b.addModule("code_point", .{ |
| @@ -68,6 +78,16 @@ pub fn build(b: *std.Build) void { | |||
| 68 | display_width.addImport("grapheme", grapheme); | 78 | display_width.addImport("grapheme", grapheme); |
| 69 | display_width.addAnonymousImport("dwp", .{ .root_source_file = dwp_gen_out }); | 79 | display_width.addAnonymousImport("dwp", .{ .root_source_file = dwp_gen_out }); |
| 70 | 80 | ||
| 81 | // Normalization | ||
| 82 | const norm = b.addModule("Normalizer", .{ | ||
| 83 | .root_source_file = .{ .path = "src/Normalizer.zig" }, | ||
| 84 | .target = target, | ||
| 85 | .optimize = optimize, | ||
| 86 | }); | ||
| 87 | norm.addImport("code_point", code_point); | ||
| 88 | norm.addImport("ziglyph", ziglyph.module("ziglyph")); | ||
| 89 | norm.addAnonymousImport("normp", .{ .root_source_file = normp_gen_out }); | ||
| 90 | |||
| 71 | // Benchmark rig | 91 | // Benchmark rig |
| 72 | const exe = b.addExecutable(.{ | 92 | const exe = b.addExecutable(.{ |
| 73 | .name = "zg", | 93 | .name = "zg", |
| @@ -80,6 +100,7 @@ pub fn build(b: *std.Build) void { | |||
| 80 | exe.root_module.addImport("code_point", code_point); | 100 | exe.root_module.addImport("code_point", code_point); |
| 81 | exe.root_module.addImport("grapheme", grapheme); | 101 | exe.root_module.addImport("grapheme", grapheme); |
| 82 | exe.root_module.addImport("display_width", display_width); | 102 | exe.root_module.addImport("display_width", display_width); |
| 103 | exe.root_module.addImport("Normalizer", norm); | ||
| 83 | b.installArtifact(exe); | 104 | b.installArtifact(exe); |
| 84 | 105 | ||
| 85 | const run_cmd = b.addRunArtifact(exe); | 106 | const run_cmd = b.addRunArtifact(exe); |
| @@ -91,15 +112,17 @@ pub fn build(b: *std.Build) void { | |||
| 91 | 112 | ||
| 92 | // Tests | 113 | // Tests |
| 93 | const exe_unit_tests = b.addTest(.{ | 114 | const exe_unit_tests = b.addTest(.{ |
| 94 | .root_source_file = .{ .path = "src/grapheme.zig" }, | 115 | .root_source_file = .{ .path = "src/Normalizer.zig" }, |
| 95 | .target = target, | 116 | .target = target, |
| 96 | .optimize = optimize, | 117 | .optimize = optimize, |
| 97 | }); | 118 | }); |
| 98 | exe_unit_tests.root_module.addImport("ascii", ascii); | 119 | // exe_unit_tests.root_module.addImport("ascii", ascii); |
| 99 | exe_unit_tests.root_module.addImport("code_point", code_point); | 120 | exe_unit_tests.root_module.addImport("code_point", code_point); |
| 100 | exe_unit_tests.root_module.addImport("grapheme", grapheme); | 121 | // exe_unit_tests.root_module.addImport("grapheme", grapheme); |
| 101 | exe_unit_tests.root_module.addAnonymousImport("gbp", .{ .root_source_file = gbp_gen_out }); | 122 | // exe_unit_tests.root_module.addAnonymousImport("gbp", .{ .root_source_file = gbp_gen_out }); |
| 102 | exe_unit_tests.root_module.addAnonymousImport("dwp", .{ .root_source_file = dwp_gen_out }); | 123 | // exe_unit_tests.root_module.addAnonymousImport("dwp", .{ .root_source_file = dwp_gen_out }); |
| 124 | exe_unit_tests.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); | ||
| 125 | exe_unit_tests.root_module.addAnonymousImport("normp", .{ .root_source_file = normp_gen_out }); | ||
| 103 | 126 | ||
| 104 | const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); | 127 | const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); |
| 105 | 128 | ||