summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorDylan <[email protected]>2024-05-29 11:07:28 -0400
committerGitHub <[email protected]>2024-05-29 17:07:28 +0200
commit2e38069475d78c75580e95c23c01216dda185ee4 (patch)
treef73ca60dddad8bcf79d2a4429d368bdc2e759bfe /src
parenta942a3bc70d994183fdd94b0346ba34211c50b20 (diff)
downloadraylib-2e38069475d78c75580e95c23c01216dda185ee4.tar.gz
raylib-2e38069475d78c75580e95c23c01216dda185ee4.zip
[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 🙈
Diffstat (limited to 'src')
-rw-r--r--src/build.zig13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/build.zig b/src/build.zig
index d172b3c2..51a8ab7b 100644
--- a/src/build.zig
+++ b/src/build.zig
@@ -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");
defer b.allocator.free(cache_include);
- 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();
-
- raylib.addIncludePath(b.path(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!");
+ dir.close();
+ raylib.addIncludePath(.{ .path = cache_include });
+ }
},
else => {
@panic("Unsupported OS");