Skip to content
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

Building for WebAssembly #24

Closed
tupini07 opened this issue Jun 29, 2022 · 7 comments
Closed

Building for WebAssembly #24

tupini07 opened this issue Jun 29, 2022 · 7 comments

Comments

@tupini07
Copy link

As the title says, is there any possibility building a project using raylib-zig to wasm ? Any examples of how to accomplish this?

@Not-Nik
Copy link
Owner

Not-Nik commented Jul 12, 2022

Should be possible, at least with some hacks. Raylib currently uses emscripten for web apps iirc. I'll check on this when I get back from vacation later this week.

@Akselmo
Copy link

Akselmo commented Jan 22, 2023

I'd also like to know. I would like to try Zig in a gamejam but I think WASM is essential for that.

Any news on this front?

@Not-Nik
Copy link
Owner

Not-Nik commented Jan 23, 2023

Currently not possible, since raylib's build.zig only offers support for Windows, Linux, macOS and *BSD. I have created an issue on its repository: raysan5/raylib#2884

@Not-Nik
Copy link
Owner

Not-Nik commented Feb 7, 2023

raylib now has support for building for emscripten since raysan5/raylib#2901 was merged, but Zig can't generate the required extra files that create the required JS functions (for OpenGL etc.) so at least the link step for the final "executable" has to be done with emscripten.

On the Zig side ziglang/zig#10836 tracks this issue.

@Not-Nik Not-Nik changed the title Possibility of building for WebAssembly? Building for WebAssembly Feb 7, 2023
@bluesillybeard
Copy link
Contributor

bluesillybeard commented Aug 10, 2023

I was able to get it to work: https://github.com/bluesillybeard/ZigAndRaylibSetup

It's a hassle to set up and it's also pretty janky, but it does work.

Edit: Forgot to mention, I didn't use this wrapper, but instead used Raylib by itself

@Not-Nik
Copy link
Owner

Not-Nik commented Aug 10, 2023

If you can neatly integrate it into the current build script, don't hesitate to open a PR

@Not-Nik
Copy link
Owner

Not-Nik commented Aug 16, 2023

Fixed in #52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants