summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig34
1 files changed, 27 insertions, 7 deletions
diff --git a/build.zig b/build.zig
index c3d9fe0..316292e 100644
--- a/build.zig
+++ b/build.zig
@@ -97,6 +97,16 @@ pub fn build(b: *std.Build) void {
97 const run_fold_gen_exe = b.addRunArtifact(fold_gen_exe); 97 const run_fold_gen_exe = b.addRunArtifact(fold_gen_exe);
98 const fold_gen_out = run_fold_gen_exe.addOutputFileArg("fold.bin.z"); 98 const fold_gen_out = run_fold_gen_exe.addOutputFileArg("fold.bin.z");
99 99
100 // Numeric types
101 const num_gen_exe = b.addExecutable(.{
102 .name = "numeric",
103 .root_source_file = .{ .path = "codegen/numeric.zig" },
104 .target = b.host,
105 .optimize = .Debug,
106 });
107 const run_num_gen_exe = b.addRunArtifact(num_gen_exe);
108 const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.bin.z");
109
100 // Modules we provide 110 // Modules we provide
101 // Code points 111 // Code points
102 const code_point = b.addModule("code_point", .{ 112 const code_point = b.addModule("code_point", .{
@@ -228,6 +238,14 @@ pub fn build(b: *std.Build) void {
228 case_fold.addImport("FoldData", fold_data); 238 case_fold.addImport("FoldData", fold_data);
229 case_fold.addImport("Normalize", norm); 239 case_fold.addImport("Normalize", norm);
230 240
241 // Numeric type
242 const num_data = b.createModule(.{
243 .root_source_file = .{ .path = "src/NumericData.zig" },
244 .target = target,
245 .optimize = optimize,
246 });
247 num_data.addAnonymousImport("numeric", .{ .root_source_file = num_gen_out });
248
231 // Benchmark rig 249 // Benchmark rig
232 const exe = b.addExecutable(.{ 250 const exe = b.addExecutable(.{
233 .name = "zg", 251 .name = "zg",
@@ -238,12 +256,13 @@ pub fn build(b: *std.Build) void {
238 }); 256 });
239 // exe.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); 257 // exe.root_module.addImport("ziglyph", ziglyph.module("ziglyph"));
240 // exe.root_module.addImport("ascii", ascii); 258 // exe.root_module.addImport("ascii", ascii);
241 // exe.root_module.addImport("code_point", code_point); 259 exe.root_module.addImport("code_point", code_point);
242 // exe.root_module.addImport("grapheme", grapheme); 260 // exe.root_module.addImport("grapheme", grapheme);
243 // exe.root_module.addImport("DisplayWidth", display_width); 261 // exe.root_module.addImport("DisplayWidth", display_width);
244 exe.root_module.addImport("Normalize", norm); 262 // exe.root_module.addImport("Normalize", norm);
245 // exe.root_module.addImport("CaseFold", case_fold); 263 // exe.root_module.addImport("CaseFold", case_fold);
246 // exe.root_module.addImport("GenCatData", gencat_data); 264 // exe.root_module.addImport("GenCatData", gencat_data);
265 exe.root_module.addImport("NumericData", num_data);
247 b.installArtifact(exe); 266 b.installArtifact(exe);
248 267
249 const run_cmd = b.addRunArtifact(exe); 268 const run_cmd = b.addRunArtifact(exe);
@@ -255,20 +274,21 @@ pub fn build(b: *std.Build) void {
255 274
256 // Tests 275 // Tests
257 const exe_unit_tests = b.addTest(.{ 276 const exe_unit_tests = b.addTest(.{
258 .root_source_file = .{ .path = "src/CaseFold.zig" }, 277 .root_source_file = .{ .path = "src/NumericData.zig" },
259 .target = target, 278 .target = target,
260 .optimize = optimize, 279 .optimize = optimize,
261 }); 280 });
262 exe_unit_tests.root_module.addImport("ascii", ascii); 281 // exe_unit_tests.root_module.addImport("ascii", ascii);
263 // exe_unit_tests.root_module.addImport("code_point", code_point); 282 // exe_unit_tests.root_module.addImport("code_point", code_point);
264 // exe_unit_tests.root_module.addImport("GraphemeData", grapheme_data); 283 // exe_unit_tests.root_module.addImport("GraphemeData", grapheme_data);
265 // exe_unit_tests.root_module.addImport("grapheme", grapheme); 284 // exe_unit_tests.root_module.addImport("grapheme", grapheme);
266 // exe_unit_tests.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); 285 // exe_unit_tests.root_module.addImport("ziglyph", ziglyph.module("ziglyph"));
267 // exe_unit_tests.root_module.addAnonymousImport("normp", .{ .root_source_file = normp_gen_out }); 286 // exe_unit_tests.root_module.addAnonymousImport("normp", .{ .root_source_file = normp_gen_out });
268 // exe_unit_tests.root_module.addImport("DisplayWidthData", dw_data); 287 // exe_unit_tests.root_module.addImport("DisplayWidthData", dw_data);
269 exe_unit_tests.root_module.addImport("NormData", norm_data); 288 // exe_unit_tests.root_module.addImport("NormData", norm_data);
270 exe_unit_tests.root_module.addImport("Normalize", norm); 289 // exe_unit_tests.root_module.addImport("Normalize", norm);
271 exe_unit_tests.root_module.addImport("FoldData", fold_data); 290 // exe_unit_tests.root_module.addImport("FoldData", fold_data);
291 exe_unit_tests.root_module.addAnonymousImport("numeric", .{ .root_source_file = num_gen_out });
272 // exe_unit_tests.filter = "nfd !ASCII"; 292 // exe_unit_tests.filter = "nfd !ASCII";
273 293
274 const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); 294 const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);