Up to date

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

在 Linux 平台上为 iOS 做交叉编译

The procedure for this is somewhat complex and requires a lot of steps, but once you have the environment properly configured you can compile Godot for iOS anytime you want.

免责声明

While it is possible to compile for iOS on a Linux environment, Apple is very restrictive about the tools to be used (especially hardware-wise), allowing pretty much only their products to be used for development. So this is not official. However, in 2010 Apple said they relaxed some of the App Store review guidelines to allow any tool to be used, as long as the resulting binary does not download any code, which means it should be OK to use the procedure described here and cross-compiling the binary.

需求

  • XCode with the iOS SDK (a dmg image, for newer versions a xip file is going to be downloaded.)

  • Clang >= 3.5 for your development machine installed and in the PATH. It has to be version >= 3.5 to target arm64 architecture.

  • Fuse for mounting and unmounting the dmg image.

  • darling-dmg, 需要从源码构建. 下面说明其过程.

    • For newer versions you should download xar and pbzx.

    • 要构建darling-dmg, 你需要以下库的开发包:fuse,icu,openssl,zlib,bzip2.

    • For building xar and pbzx you may want to follow this guide.

  • cctools-port 用于所需的构建工具. 构建过程非常特殊, 下面将进行描述.

    • 这也有一些额外的依赖:automake,autogen,libtool.

配置环境

darling-dmg

在你的机器上克隆该仓库:

$ git clone https://github.com/darlinghq/darling-dmg.git

构建它:

$ cd darling-dmg
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Release
$ make -j 4  # The number is the amount of cores your processor has, for faster build
$ cd ../..

准备 SDK

挂载 XCode 镜像:

$ mkdir xcode
$ ./darling-dmg/build/darling-dmg /path/to/Xcode_7.1.1.dmg xcode
[...]
Everything looks OK, disk mounted

For newer versions you should extract the xip file:

$ mkdir xcode
$ xar -x