Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
为 iOS 平台编译
参见
本页面描述的是如何从源码编译 iOS 编辑器和导出模板二进制文件。如果你想要将项目导出到 iOS,请移步《为 iOS 导出》。
需求
SCons 4.0+ build system.
- Xcode。
启动一次 Xcode 并安装 iOS 支持。如果你已经安装了 Xcode 后需要安装 iOS 支持,转到 Xcode -> Settings... -> Platforms 。
转到 Xcode -> Settings... -> Locations -> Command Line Tools 选择一个安装的版本。即使已经选择了一个版本,也需要重新选择它。
Download and follow README instructions to build a static
.xcframework
from the MoltenVK SDK.
编译
Open a Terminal, go to the root folder of the engine source code and type the following to compile a debug build:
scons platform=ios target=template_debug generate_bundle=yes
编译发布构建:
scons platform=ios target=template_release generate_bundle=yes
To create an Xcode project like in the official builds, you need to use the
template located in misc/dist/ios_xcode
. The release and debug libraries
should be placed in libgodot.ios.debug.xcframework
and
libgodot.ios.release.xcframework
respectively. This process can be automated
by using the generate_bundle=yes
option on the last SCons command used to
build export templates (so that all binaries can be included).
The MoltenVK static .xcframework
folder must also be placed in the
ios_xcode
folder once it has been created. MoltenVK is always statically
linked on iOS; there is no dynamic linking option available, unlike macOS.
运行
To run on a device, follow these instructions: 为 iOS 导出.
iOS exports can run directly on an Apple Silicon Mac. To run exported iOS project
on Mac, open exported project in Xcode and select My Mac
in the Run Destinations
dropdown.
故障排除
Fatal error: 'cstdint' file not found
If you get a compilation error of this form early on, it's likely because the Xcode command line tools installation needs to be repaired after a macOS or Xcode update:
./core/typedefs.h:45:10: fatal error: 'cstdint' file not found
45 | #include <cstdint>
| ^~~~~~~~~
Run these two commands to reinstall Xcode command line tools (enter your administrator password as needed):
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
If it still does not work, try updating Xcode from the Mac App Store and try again.