Open jmrico01 opened 9 months ago
Excited for this! 🎉 I'll take it for a spin and report back any issues.
EDIT: just tried it out on a small test project of mine by following the new README and everything worked out of the box 👌
Super awesome PR! I was recently trying to do this myself but struggled a bit to get it working.
I'm not sure if it is important but would it make sense to also add the reason why you probably picked the support for 0.12.0-dev.2063+804cee3b9
to have compatibility with zig-gamedev
and mach
? https://github.com/zig-gamedev/zig-gamedev
This PR helped me use the new package managment. I added the zon entry via:
zig fetch --save 'https://github.com/ryupold/raylib.zig/archive/44360a577aec4916e32337f9a900cd407aca4e13.tar.gz'
The main stalling points where that the build.zig changed obliterate the default flow, and it would be nice to just have the dependency be 'added' rather than needing to replace all of the default build options. Also I was missing various system dependencies, but that's likely another topic.
Overall, I think this PR brings value towards a much more streamlined package for the latest zig updates, and with a few changed could really simplify usage.
I'm also using it for https://github.com/schmee/zig-raylib-imgui-template/.
@ryupold what about this?
@ryupold can we approve this?
There are open issues for months now. Last commit is also from 5 months ago. Might be the original maintainer's available time/goals changed.
Hi all, thank you for all the comments! FYI, I've decided to move to using raylib's C APIs directly instead of using any Zig bindings. 2 reasons:
build.zig
and work nicely out of the box with the latest zig & package manager.Still happy to address any comments needed to merge this PR if they come up, but probably won't need to use these bindings anymore, and will just write my own small glue code as needed.
Hi @jmrico01 Having an example of how you do this direct integration would be nice.
Hi @jmrico01 Having an example of how you do this direct integration would be nice.
Sure! This is pretty much what I'm using as a baseline. Very simple and minimal setup: https://github.com/kapricorn-media/sample-raylib-zig
This is my attempt/take on reworking the build script to support the new Zig package manager and ditch git submodules. Supporting a native build was pretty easy, but I read through the comments on https://github.com/ryupold/raylib.zig/pull/15 and figured I'd try to also add a more ergonomic way of building a raylib project for the WASM+emscripten target.
I've wrapped everything under a function
setup
, which takes over the creation of the compile step, but still returns it back so you can customize things further (e.g. adding custom module imports). Taking over the compile step is necessary because of the fancier build/link step required for emscripten.I set up a minimal example project here - hopefully it's clear enough: https://github.com/kapricorn-media/raylib-sample
Closes https://github.com/ryupold/raylib.zig/issues/14 Tested with zig version
0.12.0-dev.2063+804cee3b9
NOTE: Seems like the
marshal.h
/marshal.c
files were meant as a workaround to some WASM build issues, and ideally wouldn't be necessary? Zig seems to be compilingmarshal.c
just fine and the resulting emscripten sample runs correctly, so maybe this is worth revisiting. That seemed too ambitious to attempt in this same PR though.