-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.zig
More file actions
162 lines (128 loc) · 4.84 KB
/
build.zig
File metadata and controls
162 lines (128 loc) · 4.84 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const zimalloc_dep = b.dependency("zimalloc", .{
.target = target,
.optimize = optimize,
});
const rlfw_dep = b.dependency("rlfw", .{
.target = target,
.optimize = optimize,
});
const rgl_dep = b.dependency("rgl", .{
.target = target,
.optimize = optimize,
});
const rui_dep = b.dependency("rui", .{
.target = target,
.optimize = optimize,
.backend = .custom,
});
const roml_dep = b.dependency("roml", .{
.target = target,
.optimize = optimize,
});
const Application_mod = b.addModule("Application", .{
.root_source_file = b.path("src/Application.zig"),
.target = target,
.optimize = optimize,
});
const assets_mod = b.createModule(.{
.root_source_file = b.path("src/assets.zig"),
.target = target,
.optimize = optimize,
});
const HostApi_mod = b.addModule("HostApi", .{
.root_source_file = b.path("src/HostApi.zig"),
.target = target,
.optimize = optimize,
});
const HostApi_impl_mod = b.createModule(.{
.root_source_file = b.path("src/HostApi_impl.zig"),
.target = target,
.optimize = optimize,
});
const Window_mod = b.createModule(.{
.root_source_file = b.path("src/Window.zig"),
.target = target,
.optimize = optimize,
});
const input_mod = b.createModule(.{
.root_source_file = b.path("src/input.zig"),
.target = target,
.optimize = optimize,
});
const linalg_mod = b.createModule(.{
.root_source_file = b.path("src/linalg.zig"),
.target = target,
.optimize = optimize,
});
const SlotMap_mod = b.createModule(.{
.root_source_file = b.path("src/SlotMap.zig"),
.target = target,
.optimize = optimize,
});
const surface_mod = b.createModule(.{
.root_source_file = b.path("src/surface.zig"),
.target = target,
.optimize = optimize,
});
const ecs_mod = b.createModule(.{
.root_source_file = b.path("src/ecs.zig"),
.target = target,
.optimize = optimize,
});
const exe_mod = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
// FIXME: currently, due to a bug/nyi details in std.DynLib, we need libc on host in order to have any globals in dyn libs.
.link_libc = true,
});
Application_mod.addImport("zimalloc", zimalloc_dep.module("zimalloc"));
Application_mod.addImport("rlfw", rlfw_dep.module("rlfw"));
Application_mod.addImport("rui", rui_dep.module("rui"));
Application_mod.addImport("rgl", rgl_dep.module("rgl"));
Application_mod.addImport("HostApi", HostApi_mod);
Application_mod.addImport("HostApi_impl", HostApi_impl_mod);
Application_mod.addImport("assets", assets_mod);
Application_mod.addImport("linalg", linalg_mod);
Application_mod.addImport("surface", surface_mod);
Application_mod.addImport("ecs", ecs_mod);
Application_mod.addImport("Window", Window_mod);
HostApi_impl_mod.addImport("Application", Application_mod);
HostApi_impl_mod.addImport("HostApi", HostApi_mod);
HostApi_impl_mod.addImport("assets", assets_mod);
HostApi_impl_mod.addImport("rgl", rgl_dep.module("rgl"));
Window_mod.addImport("rlfw", rlfw_dep.module("rlfw"));
Window_mod.addImport("rgl", rgl_dep.module("rgl"));
Window_mod.addImport("rui", rui_dep.module("rui"));
Window_mod.addImport("linalg", linalg_mod);
Window_mod.addImport("input", input_mod);
Window_mod.addImport("HostApi", HostApi_mod);
Window_mod.addImport("Application", Application_mod);
rui_dep.module("rui").addImport("backend", Window_mod);
assets_mod.addImport("HostApi", HostApi_mod);
assets_mod.addImport("zimalloc", zimalloc_dep.module("zimalloc"));
assets_mod.addImport("rgl", rgl_dep.module("rgl"));
assets_mod.addImport("roml", roml_dep.module("roml"));
input_mod.addImport("linalg", linalg_mod);
ecs_mod.addImport("HostApi", HostApi_mod);
ecs_mod.addImport("SlotMap", SlotMap_mod);
exe_mod.addImport("Application", Application_mod);
const exe = b.addExecutable(.{
.name = "host",
.root_module = exe_mod,
});
const test_exe = b.addTest(.{
.name = "host_test",
.root_module = exe_mod,
});
const check = b.step("check", "Run semantic analysis");
check.dependOn(&test_exe.step);
const install = b.default_step;
install.dependOn(&b.addInstallArtifact(exe, .{}).step);
const run = b.step("run", "Run the proto");
run.dependOn(&b.addRunArtifact(exe).step);
}