Skip to content

Commit

Permalink
OSX: Build universal binaries with ARM64
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga committed Nov 19, 2020
1 parent 9ddda05 commit c44015d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build-ios/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export OPTIONS="debug_symbols=no"
export OPTIONS_MONO="module_mono_enabled=yes mono_static=yes"
export TERM=xterm

export IOS_SDK="14.0"
export IOS_SDK="14.2"
export IOS_LIPO="/root/ioscross/arm64/bin/arm-apple-darwin11-lipo"

export IOS_GODOT_LIBS="libgodot libgodot_arkit_module libgodot_camera_module"
Expand Down
26 changes: 19 additions & 7 deletions build-macosx/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e

export BUILD_NAME=official
export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no"
export OPTIONS="osxcross_sdk=darwin19 debug_symbols=no"
export OPTIONS="osxcross_sdk=darwin20 debug_symbols=no"
export OPTIONS_MONO="module_mono_enabled=yes mono_static=yes mono_prefix=/root/dependencies/mono"
export TERM=xterm

Expand All @@ -20,14 +20,20 @@ tar xf /root/godot.tar.gz --strip-components=1
if [ "${CLASSICAL}" == "1" ]; then
echo "Starting classical build for macOS..."

$SCONS platform=osx $OPTIONS tools=yes target=release_debug
$SCONS platform=osx $OPTIONS arch=x86_64 tools=yes target=release_debug
$SCONS platform=osx $OPTIONS arch=arm64 tools=yes target=release_debug
lipo -create bin/godot.osx.opt.tools.x86_64 bin/godot.osx.opt.tools.arm64 -output bin/godot.osx.opt.tools.universal

mkdir -p /root/out/tools
cp -rvp bin/* /root/out/tools
rm -rf bin

$SCONS platform=osx $OPTIONS tools=no target=release_debug
$SCONS platform=osx $OPTIONS tools=no target=release
$SCONS platform=osx $OPTIONS arch=x86_64 tools=no target=release_debug
$SCONS platform=osx $OPTIONS arch=arm64 tools=no target=release_debug
lipo -create bin/godot.osx.opt.debug.x86_64 bin/godot.osx.opt.debug.arm64 -output bin/godot.osx.opt.debug.universal
$SCONS platform=osx $OPTIONS arch=x86_64 tools=no target=release
$SCONS platform=osx $OPTIONS arch=arm64 tools=no target=release
lipo -create bin/godot.osx.opt.x86_64 bin/godot.osx.opt.arm64 -output bin/godot.osx.opt.universal

mkdir -p /root/out/templates
cp -rvp bin/* /root/out/templates
Expand All @@ -43,14 +49,20 @@ if [ "${MONO}" == "1" ]; then
cp -r /root/mono-glue/GodotSharp/GodotSharp/Generated modules/mono/glue/GodotSharp/GodotSharp/
cp -r /root/mono-glue/GodotSharp/GodotSharpEditor/Generated modules/mono/glue/GodotSharp/GodotSharpEditor/

$SCONS platform=osx $OPTIONS $OPTIONS_MONO tools=yes target=release_debug copy_mono_root=yes
$SCONS platform=osx $OPTIONS $OPTIONS_MONO arch=x86_64 tools=yes target=release_debug copy_mono_root=yes
$SCONS platform=osx $OPTIONS $OPTIONS_MONO arch=arm64 tools=yes target=release_debug copy_mono_root=yes
lipo -create bin/godot.osx.opt.tools.x86_64.mono bin/godot.osx.opt.tools.arm64.mono -output bin/godot.osx.opt.tools.universal.mono

mkdir -p /root/out/tools-mono
cp -rvp bin/* /root/out/tools-mono
rm -rf bin

$SCONS platform=osx $OPTIONS $OPTIONS_MONO tools=no target=release_debug
$SCONS platform=osx $OPTIONS $OPTIONS_MONO tools=no target=release
$SCONS platform=osx $OPTIONS $OPTIONS_MONO arch=x86_64 tools=no target=release_debug
$SCONS platform=osx $OPTIONS $OPTIONS_MONO arch=arm64 tools=no target=release_debug
lipo -create bin/godot.osx.opt.debug.x86_64.mono bin/godot.osx.opt.debug.arm64.mono -output bin/godot.osx.opt.debug.universal.mono
$SCONS platform=osx $OPTIONS $OPTIONS_MONO arch=x86_64 tools=no target=release
$SCONS platform=osx $OPTIONS $OPTIONS_MONO arch=arm64 tools=no target=release
lipo -create bin/godot.osx.opt.x86_64.mono bin/godot.osx.opt.arm64.mono -output bin/godot.osx.opt.universal.mono

mkdir -p /root/out/templates-mono
cp -rvp bin/* /root/out/templates-mono
Expand Down
26 changes: 13 additions & 13 deletions build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ if [ "${build_classical}" == "1" ]; then
## OSX (Classical) ##

# Editor
binname="${godot_basename}_osx.64"
binname="${godot_basename}_osx.universal"
rm -rf Godot.app
cp -r git/misc/dist/osx_tools.app Godot.app
mkdir -p Godot.app/Contents/MacOS
cp out/macosx/x64/tools/godot.osx.opt.tools.64 Godot.app/Contents/MacOS/Godot
cp out/macosx/tools/godot.osx.opt.tools.universal Godot.app/Contents/MacOS/Godot
chmod +x Godot.app/Contents/MacOS/Godot
zip -q -9 -r "${reldir}/${binname}.zip" Godot.app
rm -rf Godot.app
Expand All @@ -150,8 +150,8 @@ if [ "${build_classical}" == "1" ]; then
cp -r git/misc/dist/osx_template.app .
mkdir -p osx_template.app/Contents/MacOS

cp out/macosx/x64/templates/godot.osx.opt.64 osx_template.app/Contents/MacOS/godot_osx_release.64
cp out/macosx/x64/templates/godot.osx.opt.debug.64 osx_template.app/Contents/MacOS/godot_osx_debug.64
cp out/macosx/templates/godot.osx.opt.universal osx_template.app/Contents/MacOS/godot_osx_release.64
cp out/macosx/templates/godot.osx.opt.debug.universal osx_template.app/Contents/MacOS/godot_osx_debug.64
chmod +x osx_template.app/Contents/MacOS/godot_osx*
zip -q -9 -r "${templatesdir}/osx.zip" osx_template.app
rm -rf osx_template.app
Expand Down Expand Up @@ -324,18 +324,18 @@ if [ "${build_mono}" == "1" ]; then
## OSX (Mono) ##

# Editor
binname="${godot_basename}_mono_osx.64"
binname="${godot_basename}_mono_osx.universal"
rm -rf Godot_mono.app
cp -r git/misc/dist/osx_tools.app Godot_mono.app
mkdir -p Godot_mono.app/Contents/MacOS
cp out/macosx/x64/tools-mono/godot.osx.opt.tools.64.mono Godot_mono.app/Contents/MacOS/Godot
cp out/macosx/tools-mono/godot.osx.opt.tools.universal.mono Godot_mono.app/Contents/MacOS/Godot
mkdir -p Godot_mono.app/Contents/{Frameworks,Resources}
mkdir -p Godot_mono.app/Contents/{Frameworks,Resources}/GodotSharp
mkdir -p Godot_mono.app/Contents/{Frameworks,Resources}/GodotSharp/Mono
cp -rp out/macosx/x64/tools-mono/GodotSharp/Api Godot_mono.app/Contents/Frameworks/GodotSharp
cp -rp out/macosx/x64/tools-mono/GodotSharp/Mono/lib Godot_mono.app/Contents/Frameworks/GodotSharp/Mono
cp -rp out/macosx/x64/tools-mono/GodotSharp/Tools Godot_mono.app/Contents/Frameworks/GodotSharp
cp -rp out/macosx/x64/tools-mono/GodotSharp/Mono/etc Godot_mono.app/Contents/Resources/GodotSharp/Mono
cp -rp out/macosx/tools-mono/GodotSharp/Api Godot_mono.app/Contents/Frameworks/GodotSharp
cp -rp out/macosx/tools-mono/GodotSharp/Mono/lib Godot_mono.app/Contents/Frameworks/GodotSharp/Mono
cp -rp out/macosx/tools-mono/GodotSharp/Tools Godot_mono.app/Contents/Frameworks/GodotSharp
cp -rp out/macosx/tools-mono/GodotSharp/Mono/etc Godot_mono.app/Contents/Resources/GodotSharp/Mono
cp -rp out/aot-compilers Godot_mono.app/Contents/Frameworks/GodotSharp/Tools/
chmod +x Godot_mono.app/Contents/MacOS/Godot
zip -q -9 -r "${reldir_mono}/${binname}.zip" Godot_mono.app
Expand All @@ -346,9 +346,9 @@ if [ "${build_mono}" == "1" ]; then
cp -r git/misc/dist/osx_template.app .
mkdir -p osx_template.app/Contents/MacOS

cp out/macosx/x64/templates-mono/godot.osx.opt.debug.64.mono osx_template.app/Contents/MacOS/godot_osx_debug.64
cp out/macosx/x64/templates-mono/godot.osx.opt.64.mono osx_template.app/Contents/MacOS/godot_osx_release.64
cp -rp out/macosx/x64/templates-mono/data.mono.osx.64.* osx_template.app/Contents/MacOS/
cp out/macosx/templates-mono/godot.osx.opt.debug.universal.mono osx_template.app/Contents/MacOS/godot_osx_debug.64
cp out/macosx/templates-mono/godot.osx.opt.universal.mono osx_template.app/Contents/MacOS/godot_osx_release.64
cp -rp out/macosx/templates-mono/data.mono.osx.universal.* osx_template.app/Contents/MacOS/
chmod +x osx_template.app/Contents/MacOS/godot_osx*
zip -q -9 -r "${templatesdir_mono}/osx.zip" osx_template.app
rm -rf osx_template.app
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ ${podman_run} -v ${basedir}/build-linux:/root/build -v ${basedir}/out/linux/x86:
mkdir -p ${basedir}/out/javascript
${podman_run} -v ${basedir}/build-javascript:/root/build -v ${basedir}/out/javascript:/root/out localhost/godot-javascript:${img_version} bash build/build.sh 2>&1 | tee ${basedir}/out/logs/javascript

mkdir -p ${basedir}/out/macosx/x64
${podman_run} -v ${basedir}/build-macosx:/root/build -v ${basedir}/out/macosx/x64:/root/out localhost/godot-osx:${img_version} bash build/build.sh 2>&1 | tee ${basedir}/out/logs/macosx
mkdir -p ${basedir}/out/macosx
${podman_run} -v ${basedir}/build-macosx:/root/build -v ${basedir}/out/macosx:/root/out localhost/godot-osx:${img_version} bash build/build.sh 2>&1 | tee ${basedir}/out/logs/macosx

mkdir -p ${basedir}/out/android
${podman_run} -v ${basedir}/build-android:/root/build -v ${basedir}/out/android:/root/out localhost/godot-android:${img_version} bash build/build.sh 2>&1 | tee ${basedir}/out/logs/android
Expand Down

0 comments on commit c44015d

Please sign in to comment.