diff options
Diffstat (limited to 'bench/build.zig')
| -rw-r--r-- | bench/build.zig | 146 |
1 files changed, 0 insertions, 146 deletions
diff --git a/bench/build.zig b/bench/build.zig deleted file mode 100644 index b7fb6af..0000000 --- a/bench/build.zig +++ /dev/null | |||
| @@ -1,146 +0,0 @@ | |||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | const Import = struct { | ||
| 4 | name: []const u8, | ||
| 5 | module: *std.Build.Module, | ||
| 6 | }; | ||
| 7 | |||
| 8 | const Bench = struct { | ||
| 9 | name: []const u8, | ||
| 10 | src: []const u8, | ||
| 11 | imports: []const Import, | ||
| 12 | }; | ||
| 13 | |||
| 14 | pub fn build(b: *std.Build) !void { | ||
| 15 | const target = b.standardTargetOptions(.{}); | ||
| 16 | const optimize = b.standardOptimizeOption(.{}); | ||
| 17 | |||
| 18 | const ziglyph = b.dependency("ziglyph", .{}); | ||
| 19 | const zg = b.dependency("zg", .{}); | ||
| 20 | |||
| 21 | const benches = [_]Bench{ | ||
| 22 | .{ | ||
| 23 | .name = "ziglyph_normalizer", | ||
| 24 | .src = "src/ziglyph_normalizer.zig", | ||
| 25 | .imports = &.{ | ||
| 26 | .{ .name = "ziglyph", .module = ziglyph.module("ziglyph") }, | ||
| 27 | }, | ||
| 28 | }, | ||
| 29 | .{ | ||
| 30 | .name = "ziglyph_caseless", | ||
| 31 | .src = "src/ziglyph_caseless.zig", | ||
| 32 | .imports = &.{ | ||
| 33 | .{ .name = "ziglyph", .module = ziglyph.module("ziglyph") }, | ||
| 34 | }, | ||
| 35 | }, | ||
| 36 | .{ | ||
| 37 | .name = "ziglyph_codepoint", | ||
| 38 | .src = "src/ziglyph_codepoint.zig", | ||
| 39 | .imports = &.{ | ||
| 40 | .{ .name = "ziglyph", .module = ziglyph.module("ziglyph") }, | ||
| 41 | }, | ||
| 42 | }, | ||
| 43 | .{ | ||
| 44 | .name = "ziglyph_grapheme", | ||
| 45 | .src = "src/ziglyph_grapheme.zig", | ||
| 46 | .imports = &.{ | ||
| 47 | .{ .name = "ziglyph", .module = ziglyph.module("ziglyph") }, | ||
| 48 | }, | ||
| 49 | }, | ||
| 50 | .{ | ||
| 51 | .name = "ziglyph_width", | ||
| 52 | .src = "src/ziglyph_width.zig", | ||
| 53 | .imports = &.{ | ||
| 54 | .{ .name = "ziglyph", .module = ziglyph.module("ziglyph") }, | ||
| 55 | }, | ||
| 56 | }, | ||
| 57 | .{ | ||
| 58 | .name = "ziglyph_case", | ||
| 59 | .src = "src/ziglyph_case.zig", | ||
| 60 | .imports = &.{ | ||
| 61 | .{ .name = "ziglyph", .module = ziglyph.module("ziglyph") }, | ||
| 62 | }, | ||
| 63 | }, | ||
| 64 | |||
| 65 | .{ | ||
| 66 | .name = "zg_normalize", | ||
| 67 | .src = "src/zg_normalize.zig", | ||
| 68 | .imports = &.{ | ||
| 69 | .{ .name = "Normalize", .module = zg.module("Normalize") }, | ||
| 70 | }, | ||
| 71 | }, | ||
| 72 | .{ | ||
| 73 | .name = "zg_caseless", | ||
| 74 | .src = "src/zg_caseless.zig", | ||
| 75 | .imports = &.{ | ||
| 76 | .{ .name = "CaseFolding", .module = zg.module("CaseFolding") }, | ||
| 77 | .{ .name = "Normalize", .module = zg.module("Normalize") }, | ||
| 78 | }, | ||
| 79 | }, | ||
| 80 | .{ | ||
| 81 | .name = "zg_codepoint", | ||
| 82 | .src = "src/zg_codepoint.zig", | ||
| 83 | .imports = &.{ | ||
| 84 | .{ .name = "code_point", .module = zg.module("code_point") }, | ||
| 85 | }, | ||
| 86 | }, | ||
| 87 | .{ | ||
| 88 | .name = "zg_grapheme", | ||
| 89 | .src = "src/zg_grapheme.zig", | ||
| 90 | .imports = &.{ | ||
| 91 | .{ .name = "Graphemes", .module = zg.module("Graphemes") }, | ||
| 92 | }, | ||
| 93 | }, | ||
| 94 | .{ | ||
| 95 | .name = "zg_width", | ||
| 96 | .src = "src/zg_width.zig", | ||
| 97 | .imports = &.{ | ||
| 98 | .{ .name = "DisplayWidth", .module = zg.module("DisplayWidth") }, | ||
| 99 | }, | ||
| 100 | }, | ||
| 101 | .{ | ||
| 102 | .name = "zg_case", | ||
| 103 | .src = "src/zg_case.zig", | ||
| 104 | .imports = &.{ | ||
| 105 | .{ .name = "LetterCasing", .module = zg.module("LetterCasing") }, | ||
| 106 | }, | ||
| 107 | }, | ||
| 108 | }; | ||
| 109 | |||
| 110 | for (&benches) |bench| { | ||
| 111 | const exe = b.addExecutable(.{ | ||
| 112 | .name = bench.name, | ||
| 113 | .root_source_file = b.path(bench.src), | ||
| 114 | .target = target, | ||
| 115 | .optimize = optimize, | ||
| 116 | .strip = true, | ||
| 117 | }); | ||
| 118 | |||
| 119 | for (bench.imports) |import| { | ||
| 120 | exe.root_module.addImport(import.name, import.module); | ||
| 121 | } | ||
| 122 | |||
| 123 | b.installArtifact(exe); | ||
| 124 | } | ||
| 125 | |||
| 126 | // Tests | ||
| 127 | const unit_tests = b.addTest(.{ | ||
| 128 | .root_source_file = b.path("src/tests.zig"), | ||
| 129 | .target = target, | ||
| 130 | .optimize = optimize, | ||
| 131 | }); | ||
| 132 | unit_tests.root_module.addImport("GeneralCategories", zg.module("GeneralCategories")); | ||
| 133 | unit_tests.root_module.addImport("Properties", zg.module("Properties")); | ||
| 134 | unit_tests.root_module.addImport("LetterCasing", zg.module("LetterCasing")); | ||
| 135 | unit_tests.root_module.addImport("Normalize", zg.module("Normalize")); | ||
| 136 | unit_tests.root_module.addImport("CaseFolding", zg.module("CaseFolding")); | ||
| 137 | unit_tests.root_module.addImport("DisplayWidth", zg.module("DisplayWidth")); | ||
| 138 | unit_tests.root_module.addImport("code_point", zg.module("code_point")); | ||
| 139 | unit_tests.root_module.addImport("Graphemes", zg.module("Graphemes")); | ||
| 140 | unit_tests.root_module.addImport("Scripts", zg.module("Scripts")); | ||
| 141 | |||
| 142 | const run_unit_tests = b.addRunArtifact(unit_tests); | ||
| 143 | |||
| 144 | const unit_test_step = b.step("test", "Run tests"); | ||
| 145 | unit_test_step.dependOn(&run_unit_tests.step); | ||
| 146 | } | ||