-
Notifications
You must be signed in to change notification settings - Fork 57
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
Finalize WASM and zig-0.12.0 support (see #50) #51
Conversation
Adds 'official' WASM/Emscripten support and fixes the build scripts for zig-0.12.0
@kassane fyi 👆(PR into master to keep track of what I'm adding... e.g. the black screen samples are working now... |
|
- only run emsdk setup once - move emsdk linker and run steps into separate functions - remove stuff that's only needed when not using package manager - some general structural cleanup
…d some code cleanup
On: a2e4b46 Does this do a recursive dependency lookup on libsokol? |
The idea is that one could add additional C library compile steps (like for instance cimgui) to the top-level module (same as happens with the sokol C library), and the Emscripten linker step would pick those up automatically. I don't actually know whether it's fully recursive, but for the cimgui case, I wouldn't add that dependency to the sokol module, but to the 'Zig main module' (obviously that loop which scans for dependencies isn't recursive, but I don't know if the 'dependency iterator' does that for me... from looking around in the stdlib where this dependency iterator is used, all places I saw don't have any sort of 'explicit recursion', but still seem to walk over all dependencies). I haven't actually tested it though, only made sure that it discovers the sokol library dependency. |
Whoop whoop! |
@floooh Been tracing through these changes as I look to move my own sokol-based engine to work with wasm. If the intention is that sokol is being comsumed as a wasm module directly (DLL-like), is it sufficient to use wasm32-freestanding or does sokol always require the intermediate emscripten step (and hence the build.zig template here) for the EM_JS() stuff you mentioned in another thread? |
@kkukshtel yeah, you'll need to compile the sokol C library as Decoupling the sokol headers from Emscripten is currently not feasable unfortunately (since even without the use of EM_JS, it would require writing our own browser API shims and/or parts of the Emscripten helper functions). |
-sUSE_OFFSET_CONVERTER
requirement for Emscripten linker option when using Zig allocators...not this time, but should be considered for an update