Closed charlieman closed 1 year ago
Reopen when Zig 0.11 is released
zig 0.11 is now released, and I added it in the build.zig.zon
file, with all the metadata. However, when building, zig build
panics on unable to find artifact 'raylib'
.
relavant extract of build.zig:
const raylib = b.dependency("raylib", .{
.target = target,
.optimize = optimize,
});
const exe = b.addExecutable(.{
.name = "beanmaths",
// In this case the main source file is merely a path, however, in more
// complicated build scripts, this could be a generated file.
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
exe.addModule("raylib", raylib.module("raylib"));
exe.linkLibrary(raylib.artifact("raylib"));
// This declares intent for the executable to be installed into the
// standard location when the user invokes the "install" step (the default
// step when running `zig build`).
b.installArtifact(exe);
Maybe that's because in our build.zig.zon
the library is called raylib-zig
well its named raylib in mine, and the tarball is independent from the package name in youyr build.zig.zon.
I still changed it, and it still doesnt work, with the error being unable to find module
This updates the build.zig file to work with the new Build API, which raylib master is already using. It also uses the new indexing in for loops.
In raylib-zig-math.zig I had to import raylib as a module instead of the file directly otherwise zig complains with this error:
Running the generator also added/removed some functions.
Tested the examples with zig version 0.11.0-dev.1910+6d7fb8f19