Cleanups to the Compiling for OSX section.

This commit is contained in:
Relintai 2023-04-06 23:28:17 +02:00
parent 959567f782
commit 25afcd0b0a

View File

@ -1,17 +1,10 @@
# Compiling for macOS
Compiling for macOS This page describes how to compile macOS editor and export template binaries from source. If you're looking to
=================== export your project to macOS instead, read `doc_exporting_for_macos`.
## Requirements
Note:
This page describes how to compile macOS editor and export template binaries from source.
If you're looking to export your project to macOS instead, read `doc_exporting_for_macos`.
Requirements
------------
For compiling under macOS, the following is required: For compiling under macOS, the following is required:
@ -21,34 +14,28 @@ For compiling under macOS, the following is required:
(or the more lightweight Command Line Tools for Xcode). (or the more lightweight Command Line Tools for Xcode).
- *Optional* - `yasm ( https://yasm.tortall.net/ )` (for WebM SIMD optimizations). - *Optional* - `yasm ( https://yasm.tortall.net/ )` (for WebM SIMD optimizations).
Note: ### Note:
If you have `Homebrew ( https://brew.sh/ )` installed, you can easily
install SCons and yasm using the following command: If you have `Homebrew ( https://brew.sh/ )` installed, you can easily install SCons and yasm using the following command:
``` ```
brew install scons yasm brew install scons yasm
``` ```
Installing Homebrew will also fetch the Command Line Tools Installing Homebrew will also fetch the Command Line Tools for Xcode automatically if you don't have them already.
for Xcode automatically if you don't have them already.
Similarly, if you have `MacPorts ( https://www.macports.org/ )` Similarly, if you have `MacPorts ( https://www.macports.org/ )` installed, you can easily install
installed, you can easily install SCons and yasm using the SCons and yasm using the following command:
following command:
``` ```
sudo port install scons yasm sudo port install scons yasm
``` ```
See also: To get the Godot source code for compiling, see `doc_getting_source`.
To get the Godot source code for compiling, see
`doc_getting_source`.
For a general overview of SCons usage for Godot, see For a general overview of SCons usage for Godot, see `doc_introduction_to_the_buildsystem`.
`doc_introduction_to_the_buildsystem`.
Compiling ## Compiling
---------
Start a terminal, go to the root directory of the engine source code. Start a terminal, go to the root directory of the engine source code.
@ -70,16 +57,11 @@ To support both architectures in a single "Universal 2" binary, run the above tw
lipo -create bin/godot.osx.tools.x86_64 bin/godot.osx.tools.arm64 -output bin/godot.osx.tools.universal 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 If all goes well, the resulting binary executable will be placed in the `bin/` subdirectory. This executable
`bin/` subdirectory. This executable file contains the whole engine and file contains the whole engine and runs without any dependencies. Executing it will bring up the project manager.
runs without any dependencies. Executing it will bring up the project
manager.
Note: If you want to use separate editor settings for your own Godot builds and official releases, you can enable
If you want to use separate editor settings for your own Godot builds `doc_data_paths_self_contained_mode` by creating a file called `._sc_` or `sc_` in the `bin/` folder.
and official releases, you can enable
`doc_data_paths_self_contained_mode` by creating a file called
`._sc_` or `sc_` in the `bin/` folder.
To create an `.app` bundle like in the official builds, you need to use the 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 template located in `misc/dist/osx_tools.app`. Typically, for an optimized
@ -92,8 +74,7 @@ editor binary built with `target=release_debug`:
chmod +x Godot.app/Contents/MacOS/Godot chmod +x Godot.app/Contents/MacOS/Godot
``` ```
Compiling a headless/server build ## Compiling a headless/server build
---------------------------------
To compile a *headless* build which provides editor functionality to export To compile a *headless* build which provides editor functionality to export
projects in an automated manner, use: projects in an automated manner, use:
@ -116,8 +97,7 @@ use:
scons platform=server tools=no target=release --jobs=$(sysctl -n hw.logicalcpu) scons platform=server tools=no target=release --jobs=$(sysctl -n hw.logicalcpu)
``` ```
Building export templates ## Building export templates
-------------------------
To build macOS export templates, you have to compile with `tools=no` (no To build macOS export templates, you have to compile with `tools=no` (no
editor) and respectively for `target=release` (release template) and editor) and respectively for `target=release` (release template) and
@ -171,8 +151,7 @@ template from the official Godot distribution:
zip -q -9 -r osx.zip osx_template.app zip -q -9 -r osx.zip osx_template.app
``` ```
Cross-compiling for macOS from Linux ## Cross-compiling for macOS from Linux
------------------------------------
It is possible to compile for macOS in a Linux environment (and maybe also in It is possible to compile for macOS in a Linux environment (and maybe also in
Windows using the Windows Subsystem for Linux). For that, you'll need to install Windows using the Windows Subsystem for Linux). For that, you'll need to install