-
Notifications
You must be signed in to change notification settings - Fork 181
Add web build support using emscripten #52
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
Conversation
Hey there, first of all thank you very much for your efforts, it looks great so far. I do have a few notes though:
Additionally I'll add your |
Don't worry about the merge conflict, we'll cross that bridge when we come to it |
Yeah, I still have some work to do in order to make it work more intuitively. I made it work based on the target for the examples, and webexport for the project but I think it would be best to build based on the target for both scenarios. |
the webExport function is used in the project_setup.sh |
|
Then I suggest we keep the I will convert this PR into a draft; do convert it back once you feel it is ready for review |
I'm confused about the entry point. Couldn't we define the main function in Zig as an extern function with the C ABI? We'd still build a library, but not use C as an intermediary. |
Try to make the main method extern, and you'll get an error: Removing The intermediate C file isn't really a big deal anyway, since it's hidden and it all gets linked together nicely. |
I did some more testing an apparently I've been wrong about emscripten's ability to find entry points this entire time. It's able to find zig's main method no matter what the function signature is, and errors even work properly. I'm not sure if something changed since I last tested, or if I just missed something obvious, but either way I'm glad I found out because it means I can remove a lot of the hackiness here. |
Looks good to me, if this is ready I'll merge it. |
I think it's pretty much ready to merge, so go ahead if you think so too. |
I added web support to this project using emscripten. It probably only works on Linux at the moment, I haven't tested it on any other OS.
The changes in the readme file should make it clear what the changes entail.
Side note, this is my first "real" project with Zig, and as such my experience with it is quite limited.
It's probably worth noting that I am using Zig version 0.11.0, and the project uses of a lot of tricks to make it work.