compiling_for_ios.rst 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. - SCons 3.0+ (you can install it via `Homebrew <https://brew.sh/>`_ or
  11. `MacPorts <https://www.macports.org/>`_, you should be able
  12. to run ``scons`` in a terminal when installed).
  13. - Xcode 10.0 (or later) with the iOS (10.0) SDK and the command line tools.
  14. .. seealso:: To get the Godot source code for compiling, see
  15. :ref:`doc_getting_source`.
  16. For a general overview of SCons usage for Godot, see
  17. :ref:`doc_introduction_to_the_buildsystem`.
  18. Compiling
  19. ---------
  20. Open a Terminal, go to the root dir of the engine source code and type:
  21. ::
  22. $ scons p=iphone target=debug
  23. for a debug build, or:
  24. ::
  25. $ scons p=iphone target=release
  26. for a release build (check ``platform/iphone/detect.py`` for the compiler
  27. flags used for each configuration).
  28. Alternatively, you can run
  29. ::
  30. $ scons p=iphone arch=x86_64 target=debug
  31. for a Simulator executable.
  32. For recent devices, Apple requires 64-bit versions of application binaries when you are uploading to the Apple Store.
  33. The best way to provide these is to create a bundle in which there are both 32-bit and 64-bit binaries, so every device will be able to run the game.
  34. It can be done in three steps: first compile the 32-bit version, then compile the 64-bit version and then use ``lipo`` to bundle them into one "universal" binary.
  35. All those steps can be performed with following commands:
  36. ::
  37. $ scons p=iphone tools=no target=release arch=arm
  38. $ scons p=iphone tools=no target=release arch=arm64
  39. $ lipo -create bin/libgodot.iphone.opt.arm.a bin/libgodot.iphone.opt.arm64.a -output bin/libgodot.iphone.release.fat.a
  40. $ lipo -create bin/libgodot_camera_module.iphone.opt.arm.a bin/libgodot_camera_module.iphone.opt.arm64.a -output bin/libgodot_camera_module.iphone.release.fat.a
  41. $ lipo -create bin/libgodot_arkit_module.iphone.opt.arm.a bin/libgodot_arkit_module.iphone.opt.arm64.a -output bin/libgodot_arkit_module.iphone.release.fat.a
  42. If you also want to provide a simulator build (reduces the chance of any linker errors with dependencies), you'll need to build and lipo the ``x86_64`` architecture as well.
  43. ::
  44. $ scons p=iphone tools=no target=release arch=arm
  45. $ scons p=iphone tools=no target=release arch=arm64
  46. $ scons p=iphone tools=no target=release arch=x86_64
  47. $ lipo -create bin/libgodot.iphone.opt.arm.a bin/libgodot.iphone.opt.arm64.a bin/libgodot.iphone.opt.x86_64.a -output bin/libgodot.iphone.release.fat.a
  48. $ lipo -create bin/libgodot_camera_module.iphone.opt.arm.a bin/libgodot_camera_module.iphone.opt.arm64.a bin/libgodot_camera_module.iphone.opt.x86_64.a -output bin/libgodot_camera_module.iphone.release.fat.a
  49. $ lipo -create bin/libgodot_arkit_module.iphone.opt.arm.a bin/libgodot_arkit_module.iphone.opt.arm64.a bin/libgodot_arkit_module.iphone.opt.x86_64.a -output bin/libgodot_arkit_module.iphone.release.fat.a
  50. Run
  51. ---
  52. To run on a device or simulator, follow these instructions:
  53. :ref:`doc_exporting_for_ios`.
  54. Replace or add your executable to the Xcode project, and change the
  55. "executable name" property on Info.plist accordingly if you use an
  56. alternative build.