compiling_for_ios.rst 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. .. _doc_compiling_for_ios:
  2. Compiling for iOS
  3. =================
  4. .. highlight:: shell
  5. .. seealso::
  6. This page describes how to compile iOS export template binaries from source.
  7. If you're looking to export your project to iOS instead, read :ref:`doc_exporting_for_ios`.
  8. Requirements
  9. ------------
  10. - `Python 3.8+ <https://www.python.org/downloads/macos/>`_.
  11. - `SCons 4.0+ <https://scons.org/pages/download.html>`_ build system.
  12. - `Xcode <https://apps.apple.com/us/app/xcode/id497799835>`_.
  13. - Launch Xcode once and install iOS support. If you have already launched
  14. Xcode and need to install iOS support, go to *Xcode -> Settings... -> Platforms*.
  15. - Go to *Xcode -> Settings... -> Locations -> Command Line Tools* and select
  16. an installed version. Even if one is already selected, re-select it.
  17. - Download and follow README instructions to build a static ``.xcframework``
  18. from the `MoltenVK SDK <https://github.com/KhronosGroup/MoltenVK#fetching-moltenvk-source-code>`__.
  19. .. note:: If you have `Homebrew <https://brew.sh/>`_ installed, you can easily
  20. install SCons using the following command::
  21. brew install scons
  22. Installing Homebrew will also fetch the Command Line Tools
  23. for Xcode automatically if you don't have them already.
  24. Similarly, if you have `MacPorts <https://www.macports.org/>`_
  25. installed, you can easily install SCons using the
  26. following command::
  27. sudo port install scons
  28. .. seealso:: To get the Godot source code for compiling, see
  29. :ref:`doc_getting_source`.
  30. For a general overview of SCons usage for Godot, see
  31. :ref:`doc_introduction_to_the_buildsystem`.
  32. Compiling
  33. ---------
  34. Open a Terminal, go to the root folder of the engine source code and type
  35. the following to compile a debug build:
  36. ::
  37. scons platform=ios target=template_debug generate_bundle=yes
  38. To compile a release build:
  39. ::
  40. scons platform=ios target=template_release generate_bundle=yes
  41. Alternatively, you can run the following command for Xcode simulator libraries (optional):
  42. ::
  43. scons platform=ios target=template_debug ios_simulator=yes arch=arm64
  44. scons platform=ios target=template_debug ios_simulator=yes arch=x86_64 generate_bundle=yes
  45. These simulator libraries cannot be used to run the exported project on the
  46. target device. Instead, they can be used to run the exported project directly on
  47. your Mac while still testing iOS platform-specific functionality.
  48. To create an Xcode project like in the official builds, you need to use the
  49. template located in ``misc/dist/ios_xcode``. The release and debug libraries
  50. should be placed in ``libgodot.ios.debug.xcframework`` and
  51. ``libgodot.ios.release.xcframework`` respectively. This process can be automated
  52. by using the ``generate_bundle=yes`` option on the *last* SCons command used to
  53. build export templates (so that all binaries can be included).
  54. The MoltenVK static ``.xcframework`` folder must also be placed in the
  55. ``ios_xcode`` folder once it has been created. MoltenVK is always statically
  56. linked on iOS; there is no dynamic linking option available, unlike macOS.
  57. Run
  58. ---
  59. To run on a device or simulator, follow these instructions:
  60. :ref:`doc_exporting_for_ios`.