Last active
August 20, 2019 08:33
-
-
Save Calinou/e412688adfd079398c8d5b7de6a72931 to your computer and use it in GitHub Desktop.
Compile Godot for iOS easily (from macOS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -x | |
# This script must be run from a macOS machine with Xcode installed. | |
# Place this script at the root of your Godot Git clone. | |
# CC0 1.0 Universal | |
# Number of CPU threads to use for compilation (no "nproc" on macOS...) | |
nproc=4 | |
# Clean all build files before building (due to a bug causing SCons to become stuck) | |
# Install GNU find using Homebrew: `brew install findutils` | |
gfind -name "*.o" -o -name "*.a" -delete | |
# Build 64-bit Godot for iOS, in debug and release mode | |
scons p=iphone -j$nproc verbose=no tools=no arch=arm64 target=release_debug | |
scons p=iphone -j$nproc verbose=no tools=no arch=arm64 target=release | |
# Build 32-bit Godot for iOS, in debug and release mode | |
scons p=iphone -j$nproc verbose=no tools=no arch=armv7 target=release_debug | |
scons p=iphone -j$nproc verbose=no tools=no arch=armv7 target=release | |
# Create a fat binary (contains both 32-bit and 64-bit executables in a single binary) | |
cd bin/ | |
strip *iphone* | |
lipo -create -arch armv7 godot.iphone.opt.debug.arm -arch arm64 godot.iphone.opt.debug.arm64 -output godot_ios_xcode/godot_debug.iphone | |
lipo -create -arch armv7 godot.iphone.opt.arm -arch arm64 godot.iphone.opt.arm64 -output godot_ios_xcode/godot_opt.iphone | |
# Create .zip of export template and copy it to Godot's templates directory | |
zip -r9 GodotiOSXCode.zip godot_ios_xcode/ | |
cp GodotiOSXCode.zip ~/.godot/templates/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment