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.

Компіляція для iOS

Дивись також

На цій сторінці описано, як скомпілювати двійкові файли шаблону експорту iOS із джерела. Якщо ви натомість хочете експортувати свій проект до iOS, прочитайте Експорт для iOS.

Вимоги

  • Python 3.8+.

  • SCons 4.0+ build system.

  • xcode.
    • Запустіть Xcode один раз і встановіть підтримку iOS. Якщо ви вже запустили Xcode і вам потрібно інсталювати підтримку iOS, перейдіть до Xcode -> Налаштування... -> Платформи.

    • Перейдіть до Xcode -> Налаштування... -> Розташування -> Інструменти командного рядка та виберіть встановлену версію. Навіть якщо один із них уже вибрано, виберіть його ще раз.

  • Завантажте та дотримуйтесь інструкцій README, щоб створити статичний .xcframework з MoltenVK SDK.

Примітка

Якщо у вас встановлено Homebrew, ви можете легко встановити SCons за допомогою такої команди:

brew install scons

Встановлення Homebrew також призведе до автоматичного отримання інструментів командного рядка для Xcode, якщо ви їх ще не маєте.

Так само, якщо у вас встановлено MacPorts, ви можете легко встановити SCons за допомогою такої команди:

sudo port install scons

Дивись також

Щоб отримати вихідний код Godot для компіляції, перегляньте Отримання джерела.

Для загального огляду використання SCons для Godot див. Знайомство з системою побудови.

Компілювання

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

To compile a release build:

scons platform=ios target=template_release generate_bundle=yes

Alternatively, you can run the following command for Xcode simulator libraries (optional):

scons platform=ios target=template_debug ios_simulator=yes arch=arm64
scons platform=ios target=template_debug ios_simulator=yes arch=x86_64 generate_bundle=yes

These simulator libraries cannot be used to run the exported project on the target device. Instead, they can be used to run the exported project directly on your Mac while still testing iOS platform-specific functionality.

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.

Запустити

Щоб запустити на пристрої чи симуляторі, виконайте ці інструкції: Експорт для iOS.