summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGravatar Jose Colon Rodriguez2024-03-01 20:31:52 -0400
committerGravatar Jose Colon Rodriguez2024-03-01 20:31:52 -0400
commit1ecfd06469ed4c2503034796faf4e7dca4196238 (patch)
treefc95244332b24780306228e12cb22ffd27979d5f /build.zig
parentChanges when case folded check; 20ms faster (diff)
downloadzg-1ecfd06469ed4c2503034796faf4e7dca4196238.tar.gz
zg-1ecfd06469ed4c2503034796faf4e7dca4196238.tar.xz
zg-1ecfd06469ed4c2503034796faf4e7dca4196238.zip
Moved case fold stuff to src/Caser.zig
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig33
1 files changed, 22 insertions, 11 deletions
diff --git a/build.zig b/build.zig
index 3d4d1c4..731bb74 100644
--- a/build.zig
+++ b/build.zig
@@ -183,14 +183,6 @@ pub fn build(b: *std.Build) void {
183 }); 183 });
184 normp_data.addAnonymousImport("normp", .{ .root_source_file = normp_gen_out }); 184 normp_data.addAnonymousImport("normp", .{ .root_source_file = normp_gen_out });
185 185
186 // Case folding
187 const fold_data = b.createModule(.{
188 .root_source_file = .{ .path = "src/FoldData.zig" },
189 .target = target,
190 .optimize = optimize,
191 });
192 fold_data.addAnonymousImport("fold", .{ .root_source_file = fold_gen_out });
193
194 const norm_data = b.createModule(.{ 186 const norm_data = b.createModule(.{
195 .root_source_file = .{ .path = "src/NormData.zig" }, 187 .root_source_file = .{ .path = "src/NormData.zig" },
196 .target = target, 188 .target = target,
@@ -201,7 +193,6 @@ pub fn build(b: *std.Build) void {
201 norm_data.addImport("CompatData", compat_data); 193 norm_data.addImport("CompatData", compat_data);
202 norm_data.addImport("HangulData", hangul_data); 194 norm_data.addImport("HangulData", hangul_data);
203 norm_data.addImport("NormPropsData", normp_data); 195 norm_data.addImport("NormPropsData", normp_data);
204 norm_data.addImport("FoldData", fold_data);
205 196
206 const norm = b.addModule("Normalizer", .{ 197 const norm = b.addModule("Normalizer", .{
207 .root_source_file = .{ .path = "src/Normalizer.zig" }, 198 .root_source_file = .{ .path = "src/Normalizer.zig" },
@@ -220,6 +211,23 @@ pub fn build(b: *std.Build) void {
220 }); 211 });
221 gencat_data.addAnonymousImport("gencat", .{ .root_source_file = gencat_gen_out }); 212 gencat_data.addAnonymousImport("gencat", .{ .root_source_file = gencat_gen_out });
222 213
214 // Case
215 const fold_data = b.createModule(.{
216 .root_source_file = .{ .path = "src/FoldData.zig" },
217 .target = target,
218 .optimize = optimize,
219 });
220 fold_data.addAnonymousImport("fold", .{ .root_source_file = fold_gen_out });
221
222 const caser = b.addModule("Caser", .{
223 .root_source_file = .{ .path = "src/Caser.zig" },
224 .target = target,
225 .optimize = optimize,
226 });
227 caser.addImport("ascii", ascii);
228 caser.addImport("FoldData", fold_data);
229 caser.addImport("Normalizer", norm);
230
223 // Benchmark rig 231 // Benchmark rig
224 const exe = b.addExecutable(.{ 232 const exe = b.addExecutable(.{
225 .name = "zg", 233 .name = "zg",
@@ -233,6 +241,7 @@ pub fn build(b: *std.Build) void {
233 // exe.root_module.addImport("grapheme", grapheme); 241 // exe.root_module.addImport("grapheme", grapheme);
234 // exe.root_module.addImport("DisplayWidth", display_width); 242 // exe.root_module.addImport("DisplayWidth", display_width);
235 exe.root_module.addImport("Normalizer", norm); 243 exe.root_module.addImport("Normalizer", norm);
244 exe.root_module.addImport("Caser", caser);
236 // exe.root_module.addImport("GenCatData", gencat_data); 245 // exe.root_module.addImport("GenCatData", gencat_data);
237 b.installArtifact(exe); 246 b.installArtifact(exe);
238 247
@@ -245,18 +254,20 @@ pub fn build(b: *std.Build) void {
245 254
246 // Tests 255 // Tests
247 const exe_unit_tests = b.addTest(.{ 256 const exe_unit_tests = b.addTest(.{
248 .root_source_file = .{ .path = "src/Normalizer.zig" }, 257 .root_source_file = .{ .path = "src/Caser.zig" },
249 .target = target, 258 .target = target,
250 .optimize = optimize, 259 .optimize = optimize,
251 }); 260 });
252 exe_unit_tests.root_module.addImport("ascii", ascii); 261 exe_unit_tests.root_module.addImport("ascii", ascii);
253 exe_unit_tests.root_module.addImport("code_point", code_point); 262 // exe_unit_tests.root_module.addImport("code_point", code_point);
254 // exe_unit_tests.root_module.addImport("GraphemeData", grapheme_data); 263 // exe_unit_tests.root_module.addImport("GraphemeData", grapheme_data);
255 // exe_unit_tests.root_module.addImport("grapheme", grapheme); 264 // exe_unit_tests.root_module.addImport("grapheme", grapheme);
256 // exe_unit_tests.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); 265 // exe_unit_tests.root_module.addImport("ziglyph", ziglyph.module("ziglyph"));
257 // exe_unit_tests.root_module.addAnonymousImport("normp", .{ .root_source_file = normp_gen_out }); 266 // exe_unit_tests.root_module.addAnonymousImport("normp", .{ .root_source_file = normp_gen_out });
258 // exe_unit_tests.root_module.addImport("DisplayWidthData", dw_data); 267 // exe_unit_tests.root_module.addImport("DisplayWidthData", dw_data);
259 exe_unit_tests.root_module.addImport("NormData", norm_data); 268 exe_unit_tests.root_module.addImport("NormData", norm_data);
269 exe_unit_tests.root_module.addImport("Normalizer", norm);
270 exe_unit_tests.root_module.addImport("FoldData", fold_data);
260 // exe_unit_tests.filter = "nfd !ASCII"; 271 // exe_unit_tests.filter = "nfd !ASCII";
261 272
262 const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); 273 const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);