diff options
| author | 2026-02-04 18:36:18 -0500 | |
|---|---|---|
| committer | 2026-02-04 18:36:18 -0500 | |
| commit | e476250ea9326b2550847b301c265115ff375a31 (patch) | |
| tree | cf627ced47cecce80020b7a1f30aa51852c0c59b /build.zig | |
| parent | Normalization and case folding (diff) | |
| download | zg-e476250ea9326b2550847b301c265115ff375a31.tar.gz zg-e476250ea9326b2550847b301c265115ff375a31.tar.xz zg-e476250ea9326b2550847b301c265115ff375a31.zip | |
Rest of the 'easy' stuff
This gets us up to feature parity with Jacob's work. I want to
eliminate that last allocation using the comptime hash map, and then
see about eliminating allocations from case comparisons as well.
That should just about do it.
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 57 |
1 files changed, 15 insertions, 42 deletions
| @@ -151,7 +151,7 @@ pub fn build(b: *std.Build) void { | |||
| 151 | }); | 151 | }); |
| 152 | gencat_gen_exe.root_module.addAnonymousImport("DerivedGeneralCategory.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedGeneralCategory.txt") }); | 152 | gencat_gen_exe.root_module.addAnonymousImport("DerivedGeneralCategory.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedGeneralCategory.txt") }); |
| 153 | const run_gencat_gen_exe = b.addRunArtifact(gencat_gen_exe); | 153 | const run_gencat_gen_exe = b.addRunArtifact(gencat_gen_exe); |
| 154 | const gencat_gen_out = run_gencat_gen_exe.addOutputFileArg("gencat.bin.z"); | 154 | const gencat_gen_out = run_gencat_gen_exe.addOutputFileArg("gencat.zig"); |
| 155 | 155 | ||
| 156 | const fold_gen_exe = b.addExecutable(.{ | 156 | const fold_gen_exe = b.addExecutable(.{ |
| 157 | .name = "fold", | 157 | .name = "fold", |
| @@ -177,47 +177,21 @@ pub fn build(b: *std.Build) void { | |||
| 177 | }); | 177 | }); |
| 178 | num_gen_exe.root_module.addAnonymousImport("DerivedNumericType.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedNumericType.txt") }); | 178 | num_gen_exe.root_module.addAnonymousImport("DerivedNumericType.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedNumericType.txt") }); |
| 179 | const run_num_gen_exe = b.addRunArtifact(num_gen_exe); | 179 | const run_num_gen_exe = b.addRunArtifact(num_gen_exe); |
| 180 | const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.bin.z"); | 180 | const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.zig"); |
| 181 | 181 | ||
| 182 | // Letter case properties | 182 | // Case mappings |
| 183 | const case_prop_gen_exe = b.addExecutable(.{ | 183 | const case_gen_exe = b.addExecutable(.{ |
| 184 | .name = "case_prop", | 184 | .name = "case", |
| 185 | .root_module = b.createModule(.{ | 185 | .root_module = b.createModule(.{ |
| 186 | .root_source_file = b.path("codegen/case_prop.zig"), | 186 | .root_source_file = b.path("codegen/case.zig"), |
| 187 | .target = b.graph.host, | 187 | .target = b.graph.host, |
| 188 | .optimize = .Debug, | 188 | .optimize = .Debug, |
| 189 | }), | 189 | }), |
| 190 | }); | 190 | }); |
| 191 | case_prop_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") }); | 191 | case_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") }); |
| 192 | const run_case_prop_gen_exe = b.addRunArtifact(case_prop_gen_exe); | ||
| 193 | const case_prop_gen_out = run_case_prop_gen_exe.addOutputFileArg("case_prop.bin.z"); | ||
| 194 | |||
| 195 | // Uppercase mappings | ||
| 196 | const upper_gen_exe = b.addExecutable(.{ | ||
| 197 | .name = "upper", | ||
| 198 | .root_module = b.createModule(.{ | ||
| 199 | .root_source_file = b.path("codegen/upper.zig"), | ||
| 200 | .target = b.graph.host, | ||
| 201 | .optimize = .Debug, | ||
| 202 | }), | ||
| 203 | }); | ||
| 204 | upper_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") }); | ||
| 205 | const run_upper_gen_exe = b.addRunArtifact(upper_gen_exe); | ||
| 206 | const upper_gen_out = run_upper_gen_exe.addOutputFileArg("upper.bin.z"); | ||
| 207 | |||
| 208 | // Lowercase mappings | ||
| 209 | const lower_gen_exe = b.addExecutable(.{ | ||
| 210 | .name = "lower", | ||
| 211 | .root_module = b.createModule(.{ | ||
| 212 | .root_source_file = b.path("codegen/lower.zig"), | ||
| 213 | .target = b.graph.host, | ||
| 214 | .optimize = .Debug, | ||
| 215 | }), | ||
| 216 | }); | ||
| 217 | lower_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") }); | ||
| 218 | const run_lower_gen_exe = b.addRunArtifact(lower_gen_exe); | ||
| 219 | const lower_gen_out = run_lower_gen_exe.addOutputFileArg("lower.bin.z"); | ||
| 220 | 192 | ||
| 193 | const run_case_gen_exe = b.addRunArtifact(case_gen_exe); | ||
| 194 | const case_gen_out = run_case_gen_exe.addOutputFileArg("case.zig"); | ||
| 221 | const scripts_gen_exe = b.addExecutable(.{ | 195 | const scripts_gen_exe = b.addExecutable(.{ |
| 222 | .name = "scripts", | 196 | .name = "scripts", |
| 223 | .root_module = b.createModule(.{ | 197 | .root_module = b.createModule(.{ |
| @@ -226,9 +200,10 @@ pub fn build(b: *std.Build) void { | |||
| 226 | .optimize = .Debug, | 200 | .optimize = .Debug, |
| 227 | }), | 201 | }), |
| 228 | }); | 202 | }); |
| 203 | |||
| 229 | scripts_gen_exe.root_module.addAnonymousImport("Scripts.txt", .{ .root_source_file = b.path("data/unicode/Scripts.txt") }); | 204 | scripts_gen_exe.root_module.addAnonymousImport("Scripts.txt", .{ .root_source_file = b.path("data/unicode/Scripts.txt") }); |
| 230 | const run_scripts_gen_exe = b.addRunArtifact(scripts_gen_exe); | 205 | const run_scripts_gen_exe = b.addRunArtifact(scripts_gen_exe); |
| 231 | const scripts_gen_out = run_scripts_gen_exe.addOutputFileArg("scripts.bin.z"); | 206 | const scripts_gen_out = run_scripts_gen_exe.addOutputFileArg("scripts.zig"); |
| 232 | 207 | ||
| 233 | const core_gen_exe = b.addExecutable(.{ | 208 | const core_gen_exe = b.addExecutable(.{ |
| 234 | .name = "core", | 209 | .name = "core", |
| @@ -240,7 +215,7 @@ pub fn build(b: *std.Build) void { | |||
| 240 | }); | 215 | }); |
| 241 | core_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") }); | 216 | core_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") }); |
| 242 | const run_core_gen_exe = b.addRunArtifact(core_gen_exe); | 217 | const run_core_gen_exe = b.addRunArtifact(core_gen_exe); |
| 243 | const core_gen_out = run_core_gen_exe.addOutputFileArg("core_props.bin.z"); | 218 | const core_gen_out = run_core_gen_exe.addOutputFileArg("core_props.zig"); |
| 244 | 219 | ||
| 245 | const props_gen_exe = b.addExecutable(.{ | 220 | const props_gen_exe = b.addExecutable(.{ |
| 246 | .name = "props", | 221 | .name = "props", |
| @@ -253,7 +228,7 @@ pub fn build(b: *std.Build) void { | |||
| 253 | 228 | ||
| 254 | props_gen_exe.root_module.addAnonymousImport("PropList.txt", .{ .root_source_file = b.path("data/unicode/PropList.txt") }); | 229 | props_gen_exe.root_module.addAnonymousImport("PropList.txt", .{ .root_source_file = b.path("data/unicode/PropList.txt") }); |
| 255 | const run_props_gen_exe = b.addRunArtifact(props_gen_exe); | 230 | const run_props_gen_exe = b.addRunArtifact(props_gen_exe); |
| 256 | const props_gen_out = run_props_gen_exe.addOutputFileArg("props.bin.z"); | 231 | const props_gen_out = run_props_gen_exe.addOutputFileArg("props.zig"); |
| 257 | 232 | ||
| 258 | // Modules we provide | 233 | // Modules we provide |
| 259 | 234 | ||
| @@ -457,9 +432,7 @@ pub fn build(b: *std.Build) void { | |||
| 457 | .optimize = optimize, | 432 | .optimize = optimize, |
| 458 | }); | 433 | }); |
| 459 | letter_case.addImport("code_point", code_point); | 434 | letter_case.addImport("code_point", code_point); |
| 460 | letter_case.addAnonymousImport("case_prop", .{ .root_source_file = case_prop_gen_out }); | 435 | letter_case.addAnonymousImport("case", .{ .root_source_file = case_gen_out }); |
| 461 | letter_case.addAnonymousImport("upper", .{ .root_source_file = upper_gen_out }); | ||
| 462 | letter_case.addAnonymousImport("lower", .{ .root_source_file = lower_gen_out }); | ||
| 463 | 436 | ||
| 464 | const letter_case_t = b.addTest(.{ | 437 | const letter_case_t = b.addTest(.{ |
| 465 | .name = "lettercase", | 438 | .name = "lettercase", |
| @@ -473,7 +446,7 @@ pub fn build(b: *std.Build) void { | |||
| 473 | .target = target, | 446 | .target = target, |
| 474 | .optimize = optimize, | 447 | .optimize = optimize, |
| 475 | }); | 448 | }); |
| 476 | scripts.addAnonymousImport("scripts", .{ .root_source_file = scripts_gen_out }); | 449 | scripts.addAnonymousImport("script", .{ .root_source_file = scripts_gen_out }); |
| 477 | 450 | ||
| 478 | const scripts_t = b.addTest(.{ | 451 | const scripts_t = b.addTest(.{ |
| 479 | .name = "scripts", | 452 | .name = "scripts", |