From 443f7d47397b29cdca635cd53debdfe4b471e24b Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 1 Jul 2020 21:04:07 +0300 Subject: [PATCH] [Compiling for macOS] Add instructions for Apple Silicon / Universal 2 build, and MoltenVK library bundling. --- development/compiling/compiling_for_osx.rst | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/development/compiling/compiling_for_osx.rst b/development/compiling/compiling_for_osx.rst index 6f4e77f1e..d0290af6a 100644 --- a/development/compiling/compiling_for_osx.rst +++ b/development/compiling/compiling_for_osx.rst @@ -33,9 +33,19 @@ If you are building the ``master`` branch: Compiling --------- -Start a terminal, go to the root directory of the engine source code and type:: +Start a terminal, go to the root directory of the engine source code. - scons platform=osx --jobs=$(sysctl -n hw.logicalcpu) +To compile for Intel (x86-64) powered Macs, use:: + + scons platform=osx arch=x86_64 --jobs=$(sysctl -n hw.logicalcpu) + +To compile for Apple Silicon (ARM64) powered Macs, use:: + + scons platform=osx arch=arm64 --jobs=$(sysctl -n hw.logicalcpu) + +To support both architectures in a single "Universal 2" binary, run the above two commands and then use ``lipo`` to bundle them together:: + + lipo -create bin/godot.osx.tools.x86_64 bin/godot.osx.tools.arm64 -output bin/godot.osx.tools.universal If all goes well, the resulting binary executable will be placed in the ``bin/`` subdirectory. This executable file contains the whole engine and @@ -49,13 +59,18 @@ manager. To create an ``.app`` bundle like in the official builds, you need to use the template located in ``misc/dist/osx_tools.app``. Typically, for an optimized -editor binary built with ``scons p=osx target=release_debug``:: +editor binary built with ``target=release_debug``:: cp -r misc/dist/osx_tools.app ./Godot.app mkdir -p Godot.app/Contents/MacOS - cp bin/godot.osx.tools.64 Godot.app/Contents/MacOS/Godot + cp bin/godot.osx.opt.tools.universal Godot.app/Contents/MacOS/Godot chmod +x Godot.app/Contents/MacOS/Godot +If you are building the ``master`` branch, additionally copy the Vulkan library: + + mkdir -p Godot.app/Contents/Frameworks + cp /macOS/libs/libMoltenVK.dylib Godot.app/Contents/Frameworks/libMoltenVK.dylib + Compiling a headless/server build ---------------------------------