SDL.zig icon indicating copy to clipboard operation
SDL.zig copied to clipboard

MacOS cross compilation

Open emidoots opened this issue 4 years ago • 1 comments
trafficstars

Hey there!

I'm working on GLFW bindings for Zig that are zero-fuss and support cross compilation. You can read more about how I'm approaching this here.

I noticed your README says:

Right now, it's not possible to cross-compile for MacOS, which is very sad. We might find a way to do so, though! Also VCPKG is not well supported on windows platforms.

I wanted to say I think you can use the same method I'm using for cross compiling GLFW from Linux/Windows -> macOS. Basically, I have packaged the macOS SDK required for cross compilation and have it at https://github.com/hexops/sdk-macos-11.3 -- this also works for compiling on macOS without Xcode installed, which I think is quite nice.

Then from your Zig build script, you can automatically clone it and link it in where needed. e.g. as I am doing here: https://github.com/hexops/mach/blob/main/glfw/build.zig#L196-L270

Feel free to use the same hexops/sdk-macos-11.3 repository if you like (it won't change.) and reuse whatever bits of my build script are useful to you, it's all FOSS :) I'm not actually using SDL.zig, just wanted to offer this as an idea. Feel free to dismiss if not helpful!

emidoots avatar Jul 18 '21 21:07 emidoots

I'll check it out if i find the time!

ikskuh avatar Jul 19 '21 07:07 ikskuh