From f7dcf8aba0745ca480ae637aad9ece42db040483 Mon Sep 17 00:00:00 2001 From: Viktor Pocedulic Date: Sun, 2 Jun 2024 12:24:10 +0200 Subject: [PATCH] [build.zig] Fix raygui build when using addRaygui externally When addRaygui is used from an external build, for example in a bindings project, the build of a generated `raygui.c` fails with "raylib.h not found" error from the compiler. I've traced this down to a raylib step not adding its `src/` to the shared list of include paths using `addIncludePath` but relying on `addCSourceFiles` `.root` to provide the implicit include path for raylib proper's own files. If raygui is later added to the step the compiler won't know where to look for `raylib.h` and friends and will fail to build. This change simply adds raylib's `src/` to the include path list. --- src/build.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/build.zig b/src/build.zig index 51a8ab7b0..851cf702f 100644 --- a/src/build.zig +++ b/src/build.zig @@ -216,6 +216,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. }, } + raylib.addIncludePath(b.path("src")); raylib.root_module.addCSourceFiles(.{ .root = b.path("src"), .files = c_source_files.items,