Compilando para IOS

Ver también

Esta página describe cómo compilar binarios de plantillas de exportación para iOS desde el código fuente. Si estás buscando exportar tu proyecto a iOS, lee Exportando para iOS.

Requerimientos

  • Python 3.8+.

  • SCons 4.0+ build system.

  • Xcode.
    • Ejecuta Xcode una vez e instale la compatibilidad con iOS. Si ya ha ejecutado Xcode y necesita instalar la compatibilidad con iOS, vaya a Xcode -> Configuración... -> Plataformas.

    • Vaya a Xcode -> Settings... -> Locations -> Command Line Tools y selecciona una versión instalada. Incluso si ya hay una seleccionada, vuelva a seleccionarla.

  • Descargue y siga las instrucciones del README para crear un .xcframework estático desde el MoltenVK SDK.

Nota

If you have Homebrew installed, you can easily install SCons using the following command:

brew install scons

La instalación de Homebrew también descargará automáticamente las Command Line Tools para Xcode si aún no las tienes.

Similarly, if you have MacPorts installed, you can easily install SCons using the following command:

sudo port install scons

Ver también

Para obtener el código fuente de Godot para compilarlo, consulta la sección Consiguiendo el código fuente.

Para obtener una visión general del uso de SCons para Godot, consulta la sección Introducción al sistema de compilación.

Compilando

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

Para compilar una versión de lanzamiento:

scons platform=ios target=template_release generate_bundle=yes

Alternativamente, puede ejecutar el siguiente comando para las bibliotecas del simulador Xcode (opcional):

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

Estas bibliotecas de simulación no se pueden usar para ejecutar el proyecto exportado en el dispositivo de destino. Sin embargo, sí se pueden usar para ejecutarlo directamente en su Mac mientras prueba las funciones específicas de la plataforma iOS.

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.

Ejecutar

Para ejecutar en un dispositivo o simulador, sigue estas instrucciones: Exportando para iOS.

Solución De Problemas

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.