compiling_for_ios.rst 3.0 KB

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