Hoping someone can help me, I fully expect this is some very basic misunderstanding of the zig build system but I’ve been banging my head against the wall for hours now and i just need to scream for help into the void hoping I hear something back
I have a very basic raylib setup, where my zig.zon looks like:
.dependencies = .{
.raylib = .{
.url = "git+https://github.com/raysan5/raylib#58fe34d9cc2dd1929efb864e5222f25253c4ad89",
.hash = "122076f6c16e9917eaa3a878e8e3af0cd358afe5eb4029f974521beeef51181ae5d5",
},
.raygui = .{
.url = "git+https://github.com/raysan5/raygui#dbfd9c78801e31992500bc22b46d5ff98e3b8bd0",
.hash = "12207b13a5e7e41463ea9748e03aa04f786804fcd7bcd550f44464a201a0a5bfc9da",
},
},
which FYI is just the latest master commits, and my build.zig looks like this:
const raylib_dependency = b.dependency("raylib", .{
.optimize = optimize,
.target = target,
// Default is set to use wayland, which is not on every distro
.linux_display_backend = .X11,
});
const raylib_artifact = raylib_dependency.artifact("raylib");
raylib_build.addRaygui(b, raylib_artifact, b.dependency("raygui", .{}));
obviously truncating the rest, this is just the important parts. but i get this build error:
pav@linux:~/git/personal/raylib-game$ zig build
error: `wayland-scanner` may not be installed on the system.
You can switch to X11 in your `build.zig` by changing `Options.linux_display_backend`
yup, which corresponds to this: raylib/build.zig at master · raysan5/raylib · GitHub
What I think is happening is me trying to set X11 the way i am is not valid somehow and the code in raylibs build.zig will set the option to the default value of .Both
if it gets something that isnt a valid LinuxDisplayBackend
enum value.
All the google fu brings up people talking about setting options exactly as i am, just as part of the anonymous struct argument for the b.dependency function call. But clearly that isnt working here. I’ve tried silly things like raylib_build.LinuxDisplayBackend.X11
but that doesn’t work and infact ZLS tells me it can’t see .X11
as a value on LinuxDisplayBackend
and i’ve also tried using raylib_dependency.builder.addUserInputOption("linux_display_backend", "X11");
and that also fails.
How do i set the valid type for the option? Any help would be greatly appreciated!