-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Zig package manager #38
base: main
Are you sure you want to change the base?
Conversation
std.log.info("include '{s}' to {s}", .{ cwd, lib.name }); | ||
return lib; | ||
} | ||
fn emscriptenRunStep(b: *std.Build) !*std.Build.Step.Run { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I snatched these emscripten utility functions from https://github.com/Not-Nik/raylib-zig/blob/devel/build.zig
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. |
This PR helped me use the new package managment. I added the zon entry via: 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:
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 |
Sure! This is pretty much what I'm using as a baseline. Very simple and minimal setup: |
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 #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 #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.