Currently I am trying to use raylib in my zig project, by using the .zon file containing the url and hash of where its located. This seems to work and the build step seems to finish for that (and i can see some header files from it in the zig-cache folder), but in my own build.zig file I'm having trouble linking it for my code. I see examples online of people who have done this when they pull in raylib as a git submodule, and i see examples of people doing this when they are using the zig bindings for raylib, but i can't find any examples for using .zon file as a dependency.
const raylib_optimize = b.option(
std.builtin.OptimizeMode,
"raylib-optimize",
"Prioritize performance, safety, or binary size (-O flag), defaults to value of optimize option",
) orelse optimize;
const strip = b.option(
bool,
"strip",
"Strip debug info to reduce binary size, defaults to false",
) orelse false;
exe.strip = strip;
const raylib_dep = b.dependency("raylib", .{
.target = target,
.optimize = raylib_optimize,
});
exe.linkLibrary(raylib_dep.artifact("raylib"));
The above code in the build.zig file and adding const rl = @import("raylib"); to the top of my main.zig file doesn't work, it gives the error: src/main.zig:2:20: error: no package named 'raylib' available within package 'root'; const rl = @import("raylib");
I think i'm missing something obvious here, but I've been trying to solve this myself all day and haven't come across any examples of how to do this, so thought it was time to ask the question here. Any help would be greatly appreciated.
