Skip to content

Using getGraph to get all artifacts #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ pub fn activateEmsdkStep(b: *std.Build) *std.Build.Step {
var emsdk_activate = b.addSystemCommand(&.{ emsdk_script_path, "activate", emsdk_version });
emsdk_activate.step.dependOn(&emsdk_install.step);

const chmod_emcc = b.addSystemCommand(&.{ "chmod", "+x", emccPath(b) });
chmod_emcc.step.dependOn(&emsdk_activate.step);

const chmod_emrun = b.addSystemCommand(&.{ "chmod", "+x", emrunPath(b) });
chmod_emrun.step.dependOn(&emsdk_activate.step);

const step = b.allocator.create(std.Build.Step) catch unreachable;
step.* = std.Build.Step.init(.{
.id = .custom,
Expand All @@ -75,8 +69,21 @@ pub fn activateEmsdkStep(b: *std.Build) *std.Build.Step {
fn make(_: *std.Build.Step, _: std.Build.Step.MakeOptions) anyerror!void {}
}.make,
});
step.dependOn(&chmod_emcc.step);
step.dependOn(&chmod_emrun.step);

switch (builtin.target.os.tag) {
.linux, .macos => {
const chmod_emcc = b.addSystemCommand(&.{ "chmod", "+x", emccPath(b) });
chmod_emcc.step.dependOn(&emsdk_activate.step);

const chmod_emrun = b.addSystemCommand(&.{ "chmod", "+x", emrunPath(b) });
chmod_emrun.step.dependOn(&emsdk_activate.step);

step.dependOn(&chmod_emcc.step);
step.dependOn(&chmod_emrun.step);
},
else => {},
}

return step;
}

Expand Down Expand Up @@ -165,7 +172,7 @@ pub fn emccStep(

emcc.addArtifactArg(wasm);
{
for (wasm.root_module.import_table.values()) |module| {
for (wasm.root_module.getGraph().modules) |module| {
for (module.link_objects.items) |link_object| {
switch (link_object) {
.other_step => |compile_step| {
Expand Down