macOS へのコンパイル¶
必要条件¶
macOSでコンパイルするには、以下が必要です:
- Python 3.5 以降。
- SCons 3.0+ build system.
- Xcode (またはXcode用のより軽量なコマンドラインツール)。
- オプション - yasm (WebM SIMD最適化用)。
注釈
Homebrew がインストールされている場合、次のコマンドを使用してSConsとyasmを簡単にインストールできます:
brew install scons yasm
Homebrewをインストールすると、Xcodeのコマンドラインツールがまだない場合は自動的に取得されます。
参考
Godotにおける基本的なSconsの使い方については、ビルドシステムの説明を参照してください。
コンパイル¶
Start a terminal, go to the root directory of the engine source code.
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 (only for Godot 3.2.3+):
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
すべてうまくいけば、結果のバイナリ実行可能ファイルは bin/
サブディレクトリに置かれます。この実行可能ファイルにはエンジン全体が含まれており、依存関係なしで実行されます。それを実行すると、プロジェクトマネージャーが表示されます。
注釈
If you want to use separate editor settings for your own Godot builds
and official releases, you can enable
自己完結型モード 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
template located in misc/dist/osx_tools.app
. Typically, for an optimized
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.opt.tools.universal Godot.app/Contents/MacOS/Godot
chmod +x Godot.app/Contents/MacOS/Godot
Compiling a headless/server build¶
To compile a headless build which provides editor functionality to export projects in an automated manner, use:
scons platform=server tools=yes target=release_debug --jobs=$(sysctl -n hw.logicalcpu)
To compile a server build which is optimized to run dedicated game servers, use:
scons platform=server tools=no target=release --jobs=$(sysctl -n hw.logicalcpu)
LinuxからのmacOSのクロスコンパイル¶
Linux環境でmacOS用にコンパイルすることが可能です(Linux用のWindows Subsystemを使用してWindowsでコンパイルすることもできます)。そのためには、macOSをターゲットとして使用できるように、OSXCross をインストールする必要があります。まず、指示に従ってインストールします:
OSXCross repository をマシン上のどこかにクローンします(またはzipファイルをダウンロードしてどこかに解凍します)。例:
git clone --depth=1 https://github.com/tpoechtrager/osxcross.git "$HOME/osxcross"
- 以下のURLの内容に従ってSDKをパッケージ化します:https://github.com/tpoechtrager/osxcross#packaging-the-sdk
- OSXCrossをインストールするには、以下の手順に従ってください:https://github.com/tpoechtrager/osxcross#installation
その後、OSXCROSS_ROOT
をOSXCrossインストールへのパス(リポジトリをクローンした、またはzipを抽出したのと同じ場所)として定義する必要があります。例:
export OSXCROSS_ROOT="$HOME/osxcross"
これで、通常のようにSConsでコンパイルできます:
scons platform=osx
SConsビルドシステムで予期されているものとは異なるOSXCross SDKバージョンがある場合は、osxcross_sdk
引数でカスタムバージョンを指定できます:
scons platform=osx osxcross_sdk=darwin15