From 4b7dfe149422efa848e62a791b5ca73c2065480b Mon Sep 17 00:00:00 2001 From: Jose Colon Rodriguez Date: Fri, 16 Feb 2024 19:36:19 -0400 Subject: display_width with table --- build.zig | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index 6353874..2a39549 100644 --- a/build.zig +++ b/build.zig @@ -17,6 +17,15 @@ pub fn build(b: *std.Build) void { const run_gbp_gen_exe = b.addRunArtifact(gbp_gen_exe); const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.zig"); + const dwp_gen_exe = b.addExecutable(.{ + .name = "dwp", + .root_source_file = .{ .path = "codegen/dwp.zig" }, + .target = b.host, + .optimize = .Debug, + }); + const run_dwp_gen_exe = b.addRunArtifact(dwp_gen_exe); + const dwp_gen_out = run_dwp_gen_exe.addOutputFileArg("dwp.zig"); + // Modules we provide const code_point = b.addModule("CodePoint", .{ .root_source_file = .{ .path = "src/CodePoint.zig" }, @@ -32,6 +41,15 @@ pub fn build(b: *std.Build) void { grapheme.addImport("CodePoint", code_point); grapheme.addAnonymousImport("gbp", .{ .root_source_file = gbp_gen_out }); + const display_width = b.addModule("display_width", .{ + .root_source_file = .{ .path = "src/display_width.zig" }, + .target = target, + .optimize = optimize, + }); + display_width.addImport("CodePoint", code_point); + display_width.addImport("Grapheme", grapheme); + display_width.addAnonymousImport("dwp", .{ .root_source_file = dwp_gen_out }); + // Benchmark rig const exe = b.addExecutable(.{ .name = "zgbench", @@ -40,7 +58,9 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); exe.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); + exe.root_module.addImport("CodePoint", code_point); exe.root_module.addImport("Grapheme", grapheme); + exe.root_module.addImport("display_width", display_width); b.installArtifact(exe); const run_cmd = b.addRunArtifact(exe); @@ -52,12 +72,13 @@ pub fn build(b: *std.Build) void { // Tests const exe_unit_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = .{ .path = "src/display_width.zig" }, .target = target, .optimize = optimize, }); - exe_unit_tests.root_module.addImport("ziglyph", ziglyph.module("ziglyph")); + exe_unit_tests.root_module.addImport("CodePoint", code_point); exe_unit_tests.root_module.addImport("Grapheme", grapheme); + exe_unit_tests.root_module.addAnonymousImport("dwp", .{ .root_source_file = dwp_gen_out }); const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); -- cgit v1.2.3