geooot/zig-sokol-crossplatform-starter
A template for an app that runs on iOS, Android, PC, and Mac. Built with Sokol, and using Zig
dfbfaf077ced93bb3274a138c8d4a303d635984a
A template for an app that runs on iOS, Android, PC and Mac. Built using the Zig programming language, and using the floooh/sokol
graphics/app library.
Also, taken inspiration from kubkon/zig-ios-example
, MasterQ32/ZigAndroidTemplate
, and cnlohr/rawdrawandroid
git clone https://github.com/geooot/zig-sokol-crossplatform-starter.git
You will need the 0.14
release of Zig, you can find it here.
For iOS
build.zig
with APP_NAME
and BUNDLE_PREFIX
changed as necessary.For Android
ANDROID_HOME
environment variable set. keytool
(should be included in JDK install). $JAVA_HOME
should be set to the install locationbuild.zig
with ANDROID_
prefixed constants as necessary. You probably only need to change *_VERSION
const's to match what you have installed in your android SDK (check $ANDROID_HOME
).build.zig
with APP_NAME
and BUNDLE_PREFIX
changed as necessary.For PC/Mac
zig build run
.Make sure to perform the edits and get the dependencies described in "Required Dependencies" before continuing below.
$ zig build run # builds and runs executable on your computer
$ zig build # builds everything (iOS, android, your computer)
$ zig build ios # generates iOS project (in zig-out/MyApp.xcodeproj).
# - You have to open xcode and build from there
$ zig build android # builds android apks (in zig-out/MyApp.apks).
# - You have to use `zig build bundletool -- install-apks --apks=zig-out/MyApp.apks`
# to install it to a device.
# - But you use the `.aab` file when submitting to Google Play.
$ zig build default # builds a executable for your computer
Features
xcodegen
)Quirks
In no particular order
Move sokol-zig to be a zig dependency rather than a git submodule
Can we get rid of the dependency on xcodegen
and bundletool
? I think we can at least use zig package manager to fetch those dependencies on build. We need zip support (xcodegen releases itself as a zip file rather than a tarball) and single file download support (bundletool packages itself as a single .jar
) to make that possible.
xcodegen
and bundletool
as zig libraries.
kubkon/zig-ios-example
since it doesn't require generating a xcode project at all. I think in reality, people might need some xcode project generation support, but like...
This is Public Domain software with the UNLICENSE license. All code except for the following exceptions are under the UNLICENSE license.
build/auto-detect.zig
falls under the MIT License [[[See here]]](https://github.com/MasterQ32/ZigAndroidTemplate/blob/master/LICENCE).sokol-zig
(and sokol in general) fall under the Zlib license [[[See here]]](https://github.com/floooh/sokol/blob/master/LICENSE).