[build.zig] Fix Zig emscripten build (#4012)
* Fix for issue #4010 Split the code for Zig's master branch and >= 0.12.0 due to changes in https://github.com/ziglang/zig/pull/19623 * Restore the cache_include path which was removed in error Accidently removed a couple lines I didn't mean to 🙈
This commit is contained in:
parent
a942a3bc70
commit
2e38069475
1 changed files with 9 additions and 4 deletions
|
@ -201,10 +201,15 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
||||||
const cache_include = std.fs.path.join(b.allocator, &.{ b.sysroot.?, "cache", "sysroot", "include" }) catch @panic("Out of memory");
|
const cache_include = std.fs.path.join(b.allocator, &.{ b.sysroot.?, "cache", "sysroot", "include" }) catch @panic("Out of memory");
|
||||||
defer b.allocator.free(cache_include);
|
defer b.allocator.free(cache_include);
|
||||||
|
|
||||||
|
if (comptime builtin.zig_version.minor > 12) {
|
||||||
|
var dir = std.fs.cwd().openDir(cache_include, std.fs.Dir.OpenDirOptions{ .access_sub_paths = true, .no_follow = true }) catch @panic("No emscripten cache. Generate it!");
|
||||||
|
dir.close();
|
||||||
|
raylib.addIncludePath(b.path(cache_include));
|
||||||
|
} else {
|
||||||
var dir = std.fs.openDirAbsolute(cache_include, std.fs.Dir.OpenDirOptions{ .access_sub_paths = true, .no_follow = true }) catch @panic("No emscripten cache. Generate it!");
|
var dir = std.fs.openDirAbsolute(cache_include, std.fs.Dir.OpenDirOptions{ .access_sub_paths = true, .no_follow = true }) catch @panic("No emscripten cache. Generate it!");
|
||||||
dir.close();
|
dir.close();
|
||||||
|
raylib.addIncludePath(.{ .path = cache_include });
|
||||||
raylib.addIncludePath(b.path(cache_include));
|
}
|
||||||
},
|
},
|
||||||
else => {
|
else => {
|
||||||
@panic("Unsupported OS");
|
@panic("Unsupported OS");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue