compiling_for_ios.rst 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.6+ <https://www.python.org/downloads/macos/>`_.
  11. - `SCons 3.1.2+ <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. If you are building the ``master`` branch:
  18. - Download and follow README instructions to build a static ``.xcframework``
  19. from the `MoltenVK SDK <https://github.com/KhronosGroup/MoltenVK#fetching-moltenvk-source-code>`__.
  20. .. note:: If you have `Homebrew <https://brew.sh/>`_ installed, you can easily
  21. install SCons using the following command::
  22. brew install scons
  23. Installing Homebrew will also fetch the Command Line Tools
  24. for Xcode automatically if you don't have them already.
  25. Similarly, if you have `MacPorts <https://www.macports.org/>`_
  26. installed, you can easily install SCons using the
  27. following command::
  28. sudo port install scons
  29. .. seealso:: To get the Godot source code for compiling, see
  30. :ref:`doc_getting_source`.
  31. For a general overview of SCons usage for Godot, see
  32. :ref:`doc_introduction_to_the_buildsystem`.
  33. Compiling
  34. ---------
  35. Open a Terminal, go to the root dir of the engine source code and type:
  36. ::
  37. $ scons p=ios target=template_debug
  38. for a debug build, or:
  39. ::
  40. $ scons p=ios target=template_release
  41. for a release build (check ``platform/ios/detect.py`` for the compiler
  42. flags used for each configuration).
  43. Alternatively, you can run
  44. ::
  45. $ scons p=ios target=template_debug ios_simulator=yes arch=x86_64
  46. $ scons p=ios target=template_debug ios_simulator=yes arch=arm64
  47. for a Simulator libraries.
  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 ``libgodot.ios.release.xcframework`` respectively.
  51. ::
  52. $ cp -r misc/dist/ios_xcode .
  53. $ cp libgodot.ios.template_debug.arm64.a ios_xcode/libgodot.ios.debug.xcframework/ios-arm64/libgodot.a
  54. $ lipo -create libgodot.ios.template_debug.arm64.simulator.a libgodot.ios.template_debug.x86_64.simulator.a -output ios_xcode/libgodot.ios.debug.xcframework/ios-arm64_x86_64-simulator/libgodot.a
  55. $ cp libgodot.ios.template_release.arm64.a ios_xcode/libgodot.ios.release.xcframework/ios-arm64/libgodot.a
  56. $ lipo -create libgodot.ios.template_release.arm64.simulator.a libgodot.ios.template_release.x86_64.simulator.a -output ios_xcode/libgodot.ios.release.xcframework/ios-arm64_x86_64-simulator/libgodot.a
  57. The MoltenVK static ``.xcframework`` folder must also be placed in the ``ios_xcode``
  58. folder once it has been created.
  59. Run
  60. ---
  61. To run on a device or simulator, follow these instructions:
  62. :ref:`doc_exporting_for_ios`.