5 ms·
I'm cross-compiling Mach engine[0] with Zig, it ends up being a quite small toolchain to cross-compile a game engine (using DirectX, Vulkan, OpenGL, and Metal o
by slimsag 4y ago
I'm cross-compiling Mach engine[0] with Zig, it ends up being a quite small toolchain to cross-compile a game engine (using DirectX, Vulkan, OpenGL, and Metal on respective platforms) from any OS. The Zig toolchain is:
* Windows: 61 MiB
* Linux (x86): 49 MiB
* macOS (x86): 42 MiB
* macOS (arm): 38 MiB
Zig provides almost everything that is needed to cross compile to those same targets out of the box, including libc and some system libraries. Except macOS frameworks and some updated DirectX headers/libraries (provides MinGW ones), which we bundle and ship separately:
* Windows: 7 MiB (updated D3D12 headers & libs)
* MacOS: 112 MiB (almost all frameworks provided by XCode, for x86+arm+iOS)
* Linux (x86): 22 MiB (x11/wayland headers & libs)
* Linux (arm): 15 MiB
That's full cross compilation of WebGPU GUI applications to all desktop platforms in under ~217 MiB for most platforms.
[0] https://machengine.org https://machengine.org
- TazeTSchnitzel 4y agoYou can accomplish similar things by targeting, say, SDL2 with a C compiler. It's a nice solution when you don't need platform-specific stuff, but it's not a general substitute for having the platform SDK, alas. With that said, targeting SDL2 is what I do… but the apps I like to write are games.
- slimsag 4y agoActually, it's better - my work includes everything needed to build: * GLFW * Dawn (Chrome's WebGPU implementation) * The DirectX Shader Compiler (a fork of LLVM) * Freetype and HarfBuzz All from source, cross-compiled to every OS. Plus with Zig you can link+sign macOS binaries from Linux and Windows (AFAIK that's not possible with a regular C compiler, but maybe that's changed recently?)
- password4321 4y agoZig's toolchain is awesome; I was very sad to discover they don't support my comfy, ancient MacBook Air.