diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 71 |
1 files changed, 47 insertions, 24 deletions
| @@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void { | |||
| 16 | .optimize = .Debug, | 16 | .optimize = .Debug, |
| 17 | }); | 17 | }); |
| 18 | const run_gbp_gen_exe = b.addRunArtifact(gbp_gen_exe); | 18 | const run_gbp_gen_exe = b.addRunArtifact(gbp_gen_exe); |
| 19 | const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.zig"); | 19 | const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.bin.z"); |
| 20 | 20 | ||
| 21 | // Display width | 21 | // Display width |
| 22 | const cjk = b.option(bool, "cjk", "Ambiguouse code points are wide (display width: 2).") orelse false; | 22 | const cjk = b.option(bool, "cjk", "Ambiguouse code points are wide (display width: 2).") orelse false; |
| @@ -31,17 +31,17 @@ pub fn build(b: *std.Build) void { | |||
| 31 | }); | 31 | }); |
| 32 | dwp_gen_exe.root_module.addOptions("options", options); | 32 | dwp_gen_exe.root_module.addOptions("options", options); |
| 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.bin.z"); |
| 35 | 35 | ||
| 36 | // Normalization properties | 36 | // Normalization properties |
| 37 | const normp_gen_exe = b.addExecutable(.{ | 37 | const ccc_gen_exe = b.addExecutable(.{ |
| 38 | .name = "normp", | 38 | .name = "ccc", |
| 39 | .root_source_file = .{ .path = "codegen/normp.zig" }, | 39 | .root_source_file = .{ .path = "codegen/ccc.zig" }, |
| 40 | .target = b.host, | 40 | .target = b.host, |
| 41 | .optimize = .Debug, | 41 | .optimize = .Debug, |
| 42 | }); | 42 | }); |
| 43 | const run_normp_gen_exe = b.addRunArtifact(normp_gen_exe); | 43 | const run_ccc_gen_exe = b.addRunArtifact(ccc_gen_exe); |
| 44 | const normp_gen_out = run_normp_gen_exe.addOutputFileArg("normp.zig"); | 44 | const ccc_gen_out = run_ccc_gen_exe.addOutputFileArg("ccc.bin.z"); |
| 45 | 45 | ||
| 46 | // Modules we provide | 46 | // Modules we provide |
| 47 | // Code points | 47 | // Code points |
| @@ -52,13 +52,20 @@ pub fn build(b: *std.Build) void { | |||
| 52 | }); | 52 | }); |
| 53 | 53 | ||
| 54 | // Grapheme clusters | 54 | // Grapheme clusters |
| 55 | const grapheme_data = b.createModule(.{ | ||
| 56 | .root_source_file = .{ .path = "src/GraphemeData.zig" }, | ||
| 57 | .target = target, | ||
| 58 | .optimize = optimize, | ||
| 59 | }); | ||
| 60 | grapheme_data.addAnonymousImport("gbp", .{ .root_source_file = gbp_gen_out }); | ||
| 61 | |||
| 55 | const grapheme = b.addModule("grapheme", .{ | 62 | const grapheme = b.addModule("grapheme", .{ |
| 56 | .root_source_file = .{ .path = "src/grapheme.zig" }, | 63 | .root_source_file = .{ .path = "src/grapheme.zig" }, |
| 57 | .target = target, | 64 | .target = target, |
| 58 | .optimize = optimize, | 65 | .optimize = optimize, |
| 59 | }); | 66 | }); |
| 60 | grapheme.addImport("code_point", code_point); | 67 | grapheme.addImport("code_point", code_point); |
| 61 | grapheme.addAnonymousImport("gbp", .{ .root_source_file = gbp_gen_out }); | 68 | grapheme.addImport("GraphemeData", grapheme_data); |
| 62 | 69 | ||
| 63 | // ASCII utilities | 70 | // ASCII utilities |
| 64 | const ascii = b.addModule("ascii", .{ | 71 | const ascii = b.addModule("ascii", .{ |
| @@ -68,17 +75,32 @@ pub fn build(b: *std.Build) void { | |||
| 68 | }); | 75 | }); |
| 69 | 76 | ||
| 70 | // Fixed pitch font display width | 77 | // Fixed pitch font display width |
| 71 | const display_width = b.addModule("display_width", .{ | 78 | const dw_data = b.createModule(.{ |
| 72 | .root_source_file = .{ .path = "src/display_width.zig" }, | 79 | .root_source_file = .{ .path = "src/DisplayWidthData.zig" }, |
| 80 | .target = target, | ||
| 81 | .optimize = optimize, | ||
| 82 | }); | ||
| 83 | dw_data.addAnonymousImport("dwp", .{ .root_source_file = dwp_gen_out }); | ||
| 84 | dw_data.addImport("GraphemeData", grapheme_data); | ||
| 85 | |||
| 86 | const display_width = b.addModule("DisplayWidth", .{ | ||
| 87 | .root_source_file = .{ .path = "src/DisplayWidth.zig" }, | ||
| 73 | .target = target, | 88 | .target = target, |
| 74 | .optimize = optimize, | 89 | .optimize = optimize, |
| 75 | }); | 90 | }); |
| 76 | display_width.addImport("ascii", ascii); | 91 | display_width.addImport("ascii", ascii); |
| 77 | display_width.addImport("code_point", code_point); | 92 | display_width.addImport("code_point", code_point); |
| 78 | display_width.addImport("grapheme", grapheme); | 93 | display_width.addImport("grapheme", grapheme); |
| 79 | display_width.addAnonymousImport("dwp", .{ .root_source_file = dwp_gen_out }); | 94 | display_width.addImport("DisplayWidthData", dw_data); |
| 80 | 95 | ||
| 81 | // Normalization | 96 | // Normalization |
| 97 | const ccc_data = b.createModule(.{ | ||
| 98 | .root_source_file = .{ .path = "src/CombiningClassData.zig" }, | ||
| 99 | .target = target, | ||
| 100 | .optimize = optimize, | ||
| 101 | }); | ||
| 102 | ccc_data.addAnonymousImport("ccc", .{ .root_source_file = ccc_gen_out }); | ||
| 103 | |||
| 82 | const norm = b.addModule("Normalizer", .{ | 104 | const norm = b.addModule("Normalizer", .{ |
| 83 | .root_source_file = .{ .path = "src/Normalizer.zig" }, | 105 | .root_source_file = .{ .path = "src/Normalizer.zig" }, |
| 84 | .target = target, | 106 | .target = target, |
| @@ -86,7 +108,7 @@ pub fn build(b: *std.Build) void { | |||
| 86 | }); | 108 | }); |
| 87 | norm.addImport("code_point", code_point); | 109 | norm.addImport("code_point", code_point); |
| 88 | norm.addImport("ziglyph", ziglyph.module("ziglyph")); | 110 | norm.addImport("ziglyph", ziglyph.module("ziglyph")); |
| 89 | norm.addAnonymousImport("normp", .{ .root_source_file = normp_gen_out }); | 111 | norm.addImport("CombiningClassData", ccc_data); |
| 90 | 112 | ||
| 91 | // Benchmark rig | 113 | // Benchmark rig |
| 92 | const exe = b.addExecutable(.{ | 114 | const exe = b.addExecutable(.{ |
| @@ -95,11 +117,11 @@ pub fn build(b: *std.Build) void { | |||
| 95 | .target = target, | 117 | .target = target, |
| 96 | .optimize = optimize, | 118 | .optimize = optimize, |
| 97 | }); | 119 | }); |
| 98 | exe.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); | 120 | // exe.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); |
| 99 | exe.root_module.addImport("ascii", ascii); | 121 | // exe.root_module.addImport("ascii", ascii); |
| 100 | exe.root_module.addImport("code_point", code_point); | 122 | // exe.root_module.addImport("code_point", code_point); |
| 101 | exe.root_module.addImport("grapheme", grapheme); | 123 | // exe.root_module.addImport("grapheme", grapheme); |
| 102 | exe.root_module.addImport("display_width", display_width); | 124 | // exe.root_module.addImport("DisplayWidth", display_width); |
| 103 | exe.root_module.addImport("Normalizer", norm); | 125 | exe.root_module.addImport("Normalizer", norm); |
| 104 | b.installArtifact(exe); | 126 | b.installArtifact(exe); |
| 105 | 127 | ||
| @@ -112,17 +134,18 @@ pub fn build(b: *std.Build) void { | |||
| 112 | 134 | ||
| 113 | // Tests | 135 | // Tests |
| 114 | const exe_unit_tests = b.addTest(.{ | 136 | const exe_unit_tests = b.addTest(.{ |
| 115 | .root_source_file = .{ .path = "src/Normalizer.zig" }, | 137 | .root_source_file = .{ .path = "src/DisplayWidth.zig" }, |
| 116 | .target = target, | 138 | .target = target, |
| 117 | .optimize = optimize, | 139 | .optimize = optimize, |
| 118 | }); | 140 | }); |
| 119 | // exe_unit_tests.root_module.addImport("ascii", ascii); | 141 | exe_unit_tests.root_module.addImport("ascii", ascii); |
| 120 | exe_unit_tests.root_module.addImport("code_point", code_point); | 142 | exe_unit_tests.root_module.addImport("code_point", code_point); |
| 121 | // exe_unit_tests.root_module.addImport("grapheme", grapheme); | 143 | // exe_unit_tests.root_module.addImport("GraphemeData", grapheme_data); |
| 122 | // exe_unit_tests.root_module.addAnonymousImport("gbp", .{ .root_source_file = gbp_gen_out }); | 144 | exe_unit_tests.root_module.addImport("grapheme", grapheme); |
| 123 | // exe_unit_tests.root_module.addAnonymousImport("dwp", .{ .root_source_file = dwp_gen_out }); | 145 | // exe_unit_tests.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); |
| 124 | exe_unit_tests.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); | 146 | // exe_unit_tests.root_module.addAnonymousImport("normp", .{ .root_source_file = normp_gen_out }); |
| 125 | exe_unit_tests.root_module.addAnonymousImport("normp", .{ .root_source_file = normp_gen_out }); | 147 | exe_unit_tests.root_module.addImport("DisplayWidthData", dw_data); |
| 148 | // exe_unit_tests.root_module.addImport("CombiningClassData", ccc_data); | ||
| 126 | 149 | ||
| 127 | const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); | 150 | const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); |
| 128 | 151 | ||