Bump to Zig 0.12/raylib 5.1-dev (#81)

* Update to Zig 0.12.0 and raylib 5.1-dev

* More build.zig fixes for 0.12

* Get module with target and optimization

* Add examples to build step when compiling for emscripten

* Remove unused function

* Add build.* and emcc.zig to the zon paths (#83)

As per some info found through https://github.com/ziglang/zig/issues/18282,
this is apparently necessary to use this library as a dependency.

Co-authored-by: Drum Ogilvie <me@daogilvie.com>

* Update binding
This commit is contained in:
Nikolas 2024-04-28 22:52:24 +02:00 committed by Not-Nik
parent 6eeb304ff3
commit ae751ce82e
Failed to generate hash of commit
17 changed files with 1161 additions and 327 deletions

View file

@ -26,12 +26,12 @@ pub fn build(b: *std.Build) !void {
const raylib_artifact = raylib_dep.artifact("raylib");
//web exports are completely separate
if (target.getOsTag() == .emscripten) {
if (target.query.os_tag == .emscripten) {
const exe_lib = emcc.compileForEmscripten(b, "'$PROJECT_NAME'", "src/main.zig", target, optimize);
exe_lib.linkLibrary(raylib_artifact);
exe_lib.addModule("raylib", raylib);
exe_lib.addModule("raylib-math", raylib_math);
exe_lib.root_module.addImport("raylib", raylib);
exe_lib.root_module.addImport("raylib-math", raylib_math);
// Note that raylib itself is not actually added to the exe_lib output file, so it also needs to be linked with emscripten.
const link_step = try emcc.linkWithEmscripten(b, &[_]*std.Build.Step.Compile{ exe_lib, raylib_artifact });
@ -47,8 +47,8 @@ pub fn build(b: *std.Build) !void {
const exe = b.addExecutable(.{ .name = "'$PROJECT_NAME'", .root_source_file = .{ .path = "src/main.zig" }, .optimize = optimize, .target = target });
exe.linkLibrary(raylib_artifact);
exe.addModule("raylib", raylib);
exe.addModule("raylib-math", raylib_math);
exe.root_module.addImport("raylib", raylib);
exe.root_module.addImport("raylib-math", raylib_math);
const run_cmd = b.addRunArtifact(exe);
const run_step = b.step("run", "Run '$PROJECT_NAME'");