Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

為 iOS 進行編譯

也參考

這個頁面描述的是如何從源碼編譯 iOS 匯出範本二進位。如果你想要找的是匯出專案到 iOS,請閱讀 為 iOS 匯出

系統需求

若想回到 master 分支,可以使用:

備註

若有安裝 Homebrew ,則可以通過下列指令來輕鬆安裝 SCons 與 yasm:

brew install scons

安裝 Homebrew 時,若還未有適用於 Xcode 的命令行工具,也會自動安裝。

若有安裝 Homebrew ,則可以通過下列指令來輕鬆安裝 SCons 與 yasm:

sudo port install scons

也參考

要獲取編譯所需的 Godot 源碼,請參閱 取得原始碼

有關配合 Godot 使用 SCons 的一般說明,請參考 建置系統簡介

編譯

開啟終端機,前往 Godot 原始碼的根目錄並輸入:

$ scons p=ios target=template_debug

若要建置除錯版,則:

$ scons p=ios target=template_release

若要建置釋出版本 (請檢查用於各個設定的 platform/iphone/detect.py 編譯旗標)。

另外,也可以執行

$ scons p=ios target=template_debug ios_simulator=yes arch=x86_64
$ scons p=ios target=template_debug ios_simulator=yes arch=arm64

來執行模擬器。

若要建立與官方建置相同的 .app 捆綁,則必須使用放在 misc/dist/osx_tools.app 樣板。一般來說,如果是使用 target=release_debug 建置的最佳化編輯器,則:

$ cp -r misc/dist/ios_xcode .

$ cp libgodot.ios.debug.arm64.a ios_xcode/libgodot.ios.debug.xcframework/ios-arm64/libgodot.a
$ lipo -create libgodot.ios.debug.arm64.simulator.a libgodot.ios.debug.x86_64.simulator.a -output ios_xcode/libgodot.ios.debug.xcframework/ios-arm64_x86_64-simulator/libgodot.a

$ cp libgodot.ios.opt.arm64.a ios_xcode/libgodot.ios.release.xcframework/ios-arm64/libgodot.a
$ lipo -create libgodot.ios.opt.arm64.simulator.a libgodot.ios.opt.x86_64.simulator.a -output ios_xcode/libgodot.ios.release.xcframework/ios-arm64_x86_64-simulator/libgodot.a

建立 MoltenVK 靜態「.xcframework」資料夾後,也必須將其放置在「ios_xcode」資料夾中。

執行

若要在一台裝置或模擬器上執行,請依照下列指示: 為 iOS 匯出