Skip to content

Add a way for consumers of sokol-zig to install the Emscripten SDK#157

Merged
floooh merged 1 commit into
floooh:masterfrom
Katipo007:master
Jun 7, 2026
Merged

Add a way for consumers of sokol-zig to install the Emscripten SDK#157
floooh merged 1 commit into
floooh:masterfrom
Katipo007:master

Conversation

@Katipo007

Copy link
Copy Markdown
Contributor

As of the changes in #156 consumers of the sokol-zig library no longer have a direct way of installing the Emscripten SDK from their own zig build.

In the mentioned pull request, the install of the SDK is now performed via zig build install-emsdk step, and (as far as I'm aware) there is no way for a downstream build.zig to perform or depend upon an upstream step.

The changes in this pull request expose the function which creates a std.Build.Step to perform the install and activation of the SDK so that downstream projects have a way to perform the install as they see fit.

e.g.

// build.zig
const std = @import("std");
pub fn build(b: *std.Build) void {
    const sokol_dep = b.dependency("sokol", .{});
    const emsdk_dep = sokol_dep.builder.dependency("emsdk", .{});

    // Create a step to handle installing the Emscripten SDK
    const emsdk_install_step = @import("sokol").emSdkInstallStep(b, emsdk_dep, .{});

    // We can now expose our for manual install:
    b.step("install-emsdk", "Install Emscripten SDK in zig-pkg").dependOn(emsdk_install_step);

    // Or add it as a dependency to the "sokol_clib" artifact so that it is performed automatically
    sokol_dep.artifact("sokol_clib").step.dependOn(emsdk_install_step);
}

I have further ideas on how to streamline this process further, but it is conditional on a feature such as https://codeberg.org/ziglang/zig/issues/35614 being implemented to Zig, and thus would not be backwards compatible with 0.16.0

@floooh

floooh commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Good fix, thanks! I'll give it a whirl later today and then merge.

@floooh floooh merged commit f162ea7 into floooh:master Jun 7, 2026
3 checks passed
@floooh

floooh commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Ok tested and merged. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants