Skip to content

Instantly share code, notes, and snippets.

@Calinou
Last active September 1, 2020 00:19
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Calinou/95a6244fc84178091d10fab70faf909a to your computer and use it in GitHub Desktop.
Save Calinou/95a6244fc84178091d10fab70faf909a to your computer and use it in GitHub Desktop.
Compile Godot for iOS easily (from Linux)
#!/bin/sh -x
# This script compiles Godot for iOS in 64-bit and 32-bit.
# It must be run from a GNU/Linux system.
# Place this script at the root of your Godot Git clone.
# CC0 1.0 Universal
# This needs to be set so that SCons detects OS X as a valid option
export OSXCROSS_IOS="anything"
# Change these to the path of your iPhone SDK and iOS toolchain
IPHONESDK="/opt/iphonesdk/iPhoneOS9.1.sdk"
IPHONEPATH="/opt/iostoolchain"
# Build 64-bit Godot for iOS, in debug and release mode
scons platform=iphone -j$(nproc) verbose=no bits=64 target=release_debug IPHONESDK=$IPHONESDK IPHONEPATH=$IPHONEPATH ios_triple="arm-apple-darwin11-"
scons platform=iphone -j$(nproc) verbose=no bits=64 target=release IPHONESDK=$IPHONESDK IPHONEPATH=$IPHONEPATH ios_triple="arm-apple-darwin11-"
# Build 32-bit Godot for iOS, in debug and release mode
scons platform=iphone -j$(nproc) verbose=no bits=32 target=release_debug IPHONESDK=$IPHONESDK IPHONEPATH=$IPHONEPATH ios_triple="arm-apple-darwin11-"
scons platform=iphone -j$(nproc) verbose=no bits=32 target=release IPHONESDK=$IPHONESDK IPHONEPATH=$IPHONEPATH ios_triple="arm-apple-darwin11-"
# Make a fat binary that contains both 32-bit and 64-bit builds and copy to the
# godot_ios_xcode/ directory
# You can get this folder from here: https://archive.hugo.pro/misc/godot/godot_ios_xcode.zip
# Extract it to the bin/ directory of your Godot Git clone.
cd bin/
$IPHONEPATH/usr/bin/arm-apple-darwin11-lipo -create godot.iphone.opt.debug.32 godot.iphone.opt.debug.64 -output godot_ios_xcode/godot_debug.iphone
$IPHONEPATH/usr/bin/arm-apple-darwin11-lipo -create godot.iphone.opt.32 godot.iphone.opt.64 -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