-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
98 lines (84 loc) · 2.68 KB
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
const std = @import("std");
const tools = @import("tools/build.zig");
const tests = @import("tests/build.zig");
const wasm = @import("wasm/build.zig");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Private modules
const mod_datastructs = b.createModule(.{
.root_source_file = b.path("src/datastructs/datastructs.zig"),
.target = target,
.optimize = optimize,
});
const mod_utf8utils = b.createModule(.{
.root_source_file = b.path("src/utf8utils/utf8utils.zig"),
.target = target,
.optimize = optimize,
});
const mod_core = b.createModule(.{
.root_source_file = b.path("src/core/core.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "datastructs", .module = mod_datastructs },
.{ .name = "utf8utils", .module = mod_utf8utils },
},
});
// Dictionary serializer tool
const dict_path = tools.build(b, .{
.src_dir = "tools",
.imports = &.{
.{ .name = "datastructs", .module = mod_datastructs },
.{ .name = "core", .module = mod_core },
},
});
// Public (exported) modules
// kana
const mod_kana = b.addModule("kana", .{
.root_source_file = b.path("src/kana.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "core", .module = mod_core },
},
});
// ime-core
_ = b.addModule("ime_core", .{
.root_source_file = b.path("src/ime_core.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "core", .module = mod_core },
},
});
// ime-ipadic
const ime_ipadic = b.addModule("ime_ipadic", .{
.root_source_file = b.path("src/ime_ipadic.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "core", .module = mod_core },
},
});
ime_ipadic.addAnonymousImport("ipadic", .{ .root_source_file = dict_path });
// WASM lib
wasm.build(b, .{
.src_dir = "wasm",
.imports = &.{
.{ .name = "ime_ipadic", .module = ime_ipadic },
},
});
// Tests
tests.build(b, .{
.src_dir = "tests",
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "datastructs", .module = mod_datastructs },
.{ .name = "core", .module = mod_core },
.{ .name = "utf8utils", .module = mod_utf8utils },
.{ .name = "kana", .module = mod_kana },
},
});
}