summaryrefslogtreecommitdiffhomepage
path: root/src/build.zig
diff options
context:
space:
mode:
authorInKryption <[email protected]>2024-06-27 20:25:15 +0000
committerGitHub <[email protected]>2024-06-27 22:25:15 +0200
commit5e91444e3e6a96813a491070de88358403ab5a75 (patch)
tree47ade1c9cedf593c9dabbdc62d2c28bbc5210982 /src/build.zig
parent57b5f11e2a2595ea189fae03d41c8b1c194c8dfa (diff)
downloadraylib-5e91444e3e6a96813a491070de88358403ab5a75.tar.gz
raylib-5e91444e3e6a96813a491070de88358403ab5a75.zip
[build.zig] pass the real build.zig file (#4113)
`@This()` was naively passed to `dependencyFromBuildZig` while inside a file that is not actually the build file, causing a panic when actually used. Passing `@import("../build.zig")` fixes this.
Diffstat (limited to 'src/build.zig')
-rw-r--r--src/build.zig7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/build.zig b/src/build.zig
index e3bb04a0..0b85e5f8 100644
--- a/src/build.zig
+++ b/src/build.zig
@@ -9,9 +9,14 @@ comptime {
// get the flags a second time when adding raygui
var raylib_flags_arr: std.ArrayListUnmanaged([]const u8) = .{};
+/// we're not inside the actual build script recognized by the
+/// zig build system; use this type where one would otherwise
+/// use `@This()` when inside the actual entrypoint file.
+const BuildScript = @import("../build.zig");
+
// This has been tested with zig version 0.12.0
pub fn addRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, options: Options) !*std.Build.Step.Compile {
- const raylib_dep = b.dependencyFromBuildZig(@This(), .{
+ const raylib_dep = b.dependencyFromBuildZig(BuildScript, .{
.target = target,
.optimize = optimize,
.raudio = options.raudio,