Kompilieren für iOS
Siehe auch
Diese Seite beschreibt, wie man iOS-Exportvorlagen-Binärdateien aus dem Quellcode kompiliert. Wenn Sie Ihr Projekt stattdessen für iOS exportieren möchten, lesen Sie Exportieren für iOS.
Anforderungen
SCons 4.0+ build system.
- Xcode.
Starten Sie Xcode einmal und installieren Sie die iOS-Unterstützung. Wenn Sie Xcode bereits gestartet haben und die iOS-Unterstützung installieren müssen, gehen Sie zu Xcode -> Einstellungen... -> Plattformen.
Gehen Sie zu Xcode -> Einstellungen... -> Speicherorte -> Befehlszeilentools und wählen Sie eine installierte Version aus. Auch wenn bereits eine Version ausgewählt ist, wählen Sie sie erneut aus.
Laden Sie ein statisches
.xcframeworkaus dem MoltenVK SDK herunter und folgen Sie den README-Anweisungen, um es zu bauen.
Bemerkung
If you have Homebrew installed, you can easily install SCons using the following command:
brew install scons
Bei der Installation von Homebrew werden auch automatisch die Kommandozeilen-Tools für Xcode installiert, falls Sie diese noch nicht haben.
Ähnlich wenn Sie MacPorts installiert haben, können Sie SCons einfach mit dem folgenden Befehl installieren:
sudo port install scons
Siehe auch
Um den Godot-Quellcode zum Kompilieren zu erhalten, siehe Beschaffung des Quellcodes.
Eine allgemeine Übersicht über die Verwendung von SCons für Godot finden Sie unter Einführung in das Buildsystem.
Kompilieren
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
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.
Warnung
Compiling for the iOS simulator is currently not supported as per GH-102149.
Apple Silicon Macs can run iOS apps natively, so you can run exported iOS projects directly on an Apple Silicon Mac without needing the iOS simulator.
Ausführen
To run on a device, follow these instructions: Exportieren für 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.
Fehlersuche
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.