compiling_for_ios.rst 3.0 KB

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