diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 64 |
1 files changed, 60 insertions, 4 deletions
| @@ -107,6 +107,46 @@ pub fn build(b: *std.Build) void { | |||
| 107 | const run_num_gen_exe = b.addRunArtifact(num_gen_exe); | 107 | const run_num_gen_exe = b.addRunArtifact(num_gen_exe); |
| 108 | const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.bin.z"); | 108 | const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.bin.z"); |
| 109 | 109 | ||
| 110 | // Letter case properties | ||
| 111 | const case_prop_gen_exe = b.addExecutable(.{ | ||
| 112 | .name = "case_prop", | ||
| 113 | .root_source_file = .{ .path = "codegen/case_prop.zig" }, | ||
| 114 | .target = b.host, | ||
| 115 | .optimize = .Debug, | ||
| 116 | }); | ||
| 117 | const run_case_prop_gen_exe = b.addRunArtifact(case_prop_gen_exe); | ||
| 118 | const case_prop_gen_out = run_case_prop_gen_exe.addOutputFileArg("case_prop.bin.z"); | ||
| 119 | |||
| 120 | // Uppercase mappings | ||
| 121 | const upper_gen_exe = b.addExecutable(.{ | ||
| 122 | .name = "upper", | ||
| 123 | .root_source_file = .{ .path = "codegen/upper.zig" }, | ||
| 124 | .target = b.host, | ||
| 125 | .optimize = .Debug, | ||
| 126 | }); | ||
| 127 | const run_upper_gen_exe = b.addRunArtifact(upper_gen_exe); | ||
| 128 | const upper_gen_out = run_upper_gen_exe.addOutputFileArg("upper.bin.z"); | ||
| 129 | |||
| 130 | // Lowercase mappings | ||
| 131 | const lower_gen_exe = b.addExecutable(.{ | ||
| 132 | .name = "lower", | ||
| 133 | .root_source_file = .{ .path = "codegen/lower.zig" }, | ||
| 134 | .target = b.host, | ||
| 135 | .optimize = .Debug, | ||
| 136 | }); | ||
| 137 | const run_lower_gen_exe = b.addRunArtifact(lower_gen_exe); | ||
| 138 | const lower_gen_out = run_lower_gen_exe.addOutputFileArg("lower.bin.z"); | ||
| 139 | |||
| 140 | // Titlecase mappings | ||
| 141 | const title_gen_exe = b.addExecutable(.{ | ||
| 142 | .name = "title", | ||
| 143 | .root_source_file = .{ .path = "codegen/title.zig" }, | ||
| 144 | .target = b.host, | ||
| 145 | .optimize = .Debug, | ||
| 146 | }); | ||
| 147 | const run_title_gen_exe = b.addRunArtifact(title_gen_exe); | ||
| 148 | const title_gen_out = run_title_gen_exe.addOutputFileArg("title.bin.z"); | ||
| 149 | |||
| 110 | // Modules we provide | 150 | // Modules we provide |
| 111 | // Code points | 151 | // Code points |
| 112 | const code_point = b.addModule("code_point", .{ | 152 | const code_point = b.addModule("code_point", .{ |
| @@ -221,7 +261,7 @@ pub fn build(b: *std.Build) void { | |||
| 221 | }); | 261 | }); |
| 222 | gencat_data.addAnonymousImport("gencat", .{ .root_source_file = gencat_gen_out }); | 262 | gencat_data.addAnonymousImport("gencat", .{ .root_source_file = gencat_gen_out }); |
| 223 | 263 | ||
| 224 | // Case | 264 | // Case folding |
| 225 | const fold_data = b.createModule(.{ | 265 | const fold_data = b.createModule(.{ |
| 226 | .root_source_file = .{ .path = "src/FoldData.zig" }, | 266 | .root_source_file = .{ .path = "src/FoldData.zig" }, |
| 227 | .target = target, | 267 | .target = target, |
| @@ -246,6 +286,18 @@ pub fn build(b: *std.Build) void { | |||
| 246 | }); | 286 | }); |
| 247 | num_data.addAnonymousImport("numeric", .{ .root_source_file = num_gen_out }); | 287 | num_data.addAnonymousImport("numeric", .{ .root_source_file = num_gen_out }); |
| 248 | 288 | ||
| 289 | // Letter case | ||
| 290 | const case_data = b.createModule(.{ | ||
| 291 | .root_source_file = .{ .path = "src/CaseData.zig" }, | ||
| 292 | .target = target, | ||
| 293 | .optimize = optimize, | ||
| 294 | }); | ||
| 295 | case_data.addImport("code_point", code_point); | ||
| 296 | case_data.addAnonymousImport("case_prop", .{ .root_source_file = case_prop_gen_out }); | ||
| 297 | case_data.addAnonymousImport("upper", .{ .root_source_file = upper_gen_out }); | ||
| 298 | case_data.addAnonymousImport("lower", .{ .root_source_file = lower_gen_out }); | ||
| 299 | case_data.addAnonymousImport("title", .{ .root_source_file = title_gen_out }); | ||
| 300 | |||
| 249 | // Benchmark rig | 301 | // Benchmark rig |
| 250 | const exe = b.addExecutable(.{ | 302 | const exe = b.addExecutable(.{ |
| 251 | .name = "zg", | 303 | .name = "zg", |
| @@ -274,12 +326,12 @@ pub fn build(b: *std.Build) void { | |||
| 274 | 326 | ||
| 275 | // Tests | 327 | // Tests |
| 276 | const exe_unit_tests = b.addTest(.{ | 328 | const exe_unit_tests = b.addTest(.{ |
| 277 | .root_source_file = .{ .path = "src/NumericData.zig" }, | 329 | .root_source_file = .{ .path = "src/CaseData.zig" }, |
| 278 | .target = target, | 330 | .target = target, |
| 279 | .optimize = optimize, | 331 | .optimize = optimize, |
| 280 | }); | 332 | }); |
| 281 | // exe_unit_tests.root_module.addImport("ascii", ascii); | 333 | // exe_unit_tests.root_module.addImport("ascii", ascii); |
| 282 | // exe_unit_tests.root_module.addImport("code_point", code_point); | 334 | exe_unit_tests.root_module.addImport("code_point", code_point); |
| 283 | // exe_unit_tests.root_module.addImport("GraphemeData", grapheme_data); | 335 | // exe_unit_tests.root_module.addImport("GraphemeData", grapheme_data); |
| 284 | // exe_unit_tests.root_module.addImport("grapheme", grapheme); | 336 | // exe_unit_tests.root_module.addImport("grapheme", grapheme); |
| 285 | // exe_unit_tests.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); | 337 | // exe_unit_tests.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); |
| @@ -288,7 +340,11 @@ pub fn build(b: *std.Build) void { | |||
| 288 | // exe_unit_tests.root_module.addImport("NormData", norm_data); | 340 | // exe_unit_tests.root_module.addImport("NormData", norm_data); |
| 289 | // exe_unit_tests.root_module.addImport("Normalize", norm); | 341 | // exe_unit_tests.root_module.addImport("Normalize", norm); |
| 290 | // exe_unit_tests.root_module.addImport("FoldData", fold_data); | 342 | // exe_unit_tests.root_module.addImport("FoldData", fold_data); |
| 291 | exe_unit_tests.root_module.addAnonymousImport("numeric", .{ .root_source_file = num_gen_out }); | 343 | // exe_unit_tests.root_module.addAnonymousImport("numeric", .{ .root_source_file = num_gen_out }); |
| 344 | exe_unit_tests.root_module.addAnonymousImport("case_prop", .{ .root_source_file = case_prop_gen_out }); | ||
| 345 | exe_unit_tests.root_module.addAnonymousImport("upper", .{ .root_source_file = upper_gen_out }); | ||
| 346 | exe_unit_tests.root_module.addAnonymousImport("lower", .{ .root_source_file = lower_gen_out }); | ||
| 347 | exe_unit_tests.root_module.addAnonymousImport("title", .{ .root_source_file = title_gen_out }); | ||
| 292 | // exe_unit_tests.filter = "nfd !ASCII"; | 348 | // exe_unit_tests.filter = "nfd !ASCII"; |
| 293 | 349 | ||
| 294 | const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); | 350 | const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); |