Skip to content

Commit a7142f9

Browse files
authored
[build.zig] using getGraph to get all artifacts (#5)
1 parent 6848105 commit a7142f9

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

build.zig

+16-9
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ pub fn activateEmsdkStep(b: *std.Build) *std.Build.Step {
6060
var emsdk_activate = b.addSystemCommand(&.{ emsdk_script_path, "activate", emsdk_version });
6161
emsdk_activate.step.dependOn(&emsdk_install.step);
6262

63-
const chmod_emcc = b.addSystemCommand(&.{ "chmod", "+x", emccPath(b) });
64-
chmod_emcc.step.dependOn(&emsdk_activate.step);
65-
66-
const chmod_emrun = b.addSystemCommand(&.{ "chmod", "+x", emrunPath(b) });
67-
chmod_emrun.step.dependOn(&emsdk_activate.step);
68-
6963
const step = b.allocator.create(std.Build.Step) catch unreachable;
7064
step.* = std.Build.Step.init(.{
7165
.id = .custom,
@@ -75,8 +69,21 @@ pub fn activateEmsdkStep(b: *std.Build) *std.Build.Step {
7569
fn make(_: *std.Build.Step, _: std.Build.Step.MakeOptions) anyerror!void {}
7670
}.make,
7771
});
78-
step.dependOn(&chmod_emcc.step);
79-
step.dependOn(&chmod_emrun.step);
72+
73+
switch (builtin.target.os.tag) {
74+
.linux, .macos => {
75+
const chmod_emcc = b.addSystemCommand(&.{ "chmod", "+x", emccPath(b) });
76+
chmod_emcc.step.dependOn(&emsdk_activate.step);
77+
78+
const chmod_emrun = b.addSystemCommand(&.{ "chmod", "+x", emrunPath(b) });
79+
chmod_emrun.step.dependOn(&emsdk_activate.step);
80+
81+
step.dependOn(&chmod_emcc.step);
82+
step.dependOn(&chmod_emrun.step);
83+
},
84+
else => {},
85+
}
86+
8087
return step;
8188
}
8289

@@ -165,7 +172,7 @@ pub fn emccStep(
165172

166173
emcc.addArtifactArg(wasm);
167174
{
168-
for (wasm.root_module.import_table.values()) |module| {
175+
for (wasm.root_module.getGraph().modules) |module| {
169176
for (module.link_objects.items) |link_object| {
170177
switch (link_object) {
171178
.other_step => |compile_step| {

0 commit comments

Comments
 (0)