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

Improve cross-compilation with zig builds #4468

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

deathbeam
Copy link
Contributor

@deathbeam
Copy link
Contributor Author

deathbeam commented Nov 5, 2024

For testing:

zig build -Doptimize=ReleaseFast -Dtarget=wasm32-emscripten
zig build -Doptimize=ReleaseFast -Dtarget=x86_64-macos

should just work ™️ with no external dependencies

- Add xcode_frameworks when cross compiling for mac (ref:
https://github.com/hexops/mach/blob/main/build.zig)
- Add emsdk when cross compiling for wasm (ref:
https://github.com/floooh/sokol-zig/blob/master/build.zig)

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
@raysan5 raysan5 merged commit 53b929c into raysan5:master Nov 8, 2024
@raysan5
Copy link
Owner

raysan5 commented Nov 8, 2024

@deathbeam I don't like specially adding a separate .zig.zon file, more files usually mean more maintenance work and more breaking possibilities... but I'm merging it.

@deathbeam deathbeam deleted the zig-cross branch November 8, 2024 13:37
@deathbeam
Copy link
Contributor Author

@deathbeam I don't like specially adding a separate .zig.zon file, more files usually mean more maintenance work and more breaking possibilities... but I'm merging it.

Yea if there was an option to put it to the build.zig i would do it but to use the zig dependency manager the zig.zon file is sadly necessary (at least afaik). but benefit is that when you use raylib as dependency in zig for other projects they will also get the 2 dependencies resolved at same time and cross-compilation should work for them out of the box as well (when set up properly).

psxdev pushed a commit to raylib4Consoles/raylib that referenced this pull request Nov 18, 2024
- Add xcode_frameworks when cross compiling for mac (ref:
https://github.com/hexops/mach/blob/main/build.zig)
- Add emsdk when cross compiling for wasm (ref:
https://github.com/floooh/sokol-zig/blob/master/build.zig)

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
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

Successfully merging this pull request may close these issues.

2 participants