Skip to content
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
10 changes: 6 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ pub fn build(b: *std.Build) void {
mod.addCMacro("__EMSCRIPTEN_PTHREADS__ ", "1");
mod.addCMacro("USE_SDL", "2");
mod.addCSourceFiles(.{ .files = &emscripten_src_files });
if (b.sysroot == null) {
@panic("Pass '--sysroot \"$EMSDK/upstream/emscripten\"'");
}

const cache_include = std.fs.path.join(b.allocator, &.{ b.sysroot.?, "cache", "sysroot", "include" }) catch @panic("Out of memory");
const sysroot = if (@hasField(std.Build, "sysroot"))
b.sysroot orelse @panic("Pass '--sysroot \"$EMSDK/upstream/emscripten\"'")
else
@panic("`sysroot` was removed from the build system in newer versions of Zig"); // Help wanted

const cache_include = std.fs.path.join(b.allocator, &.{ sysroot, "cache", "sysroot", "include" }) catch @panic("Out of memory");
defer b.allocator.free(cache_include);

// TODO: Remove compatibility shim when minimum Zig version is 0.16.0.
Expand Down
Loading