compiling_for_osx.rst 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. .. _doc_compiling_for_osx:
  2. Compiling for OSX
  3. =================
  4. .. highlight:: shell
  5. Requirements
  6. ------------
  7. For compiling under Linux or other Unix variants, the following is
  8. required:
  9. - Python 2.7+ or Python 3.5+
  10. - SCons build system
  11. - Xcode (or the more lightweight Command Line Tools for Xcode)
  12. Compiling
  13. ---------
  14. Start a terminal, go to the root dir of the engine source code and type:
  15. ::
  16. user@host:~/godot$ scons platform=osx
  17. If all goes well, the resulting binary executable will be placed in the
  18. "bin" subdirectory. This executable file contains the whole engine and
  19. runs without any dependencies. Executing it will bring up the project
  20. manager.
  21. To create an .app like in the official builds, you need to use the template
  22. located in ``misc/dist/osx_tools.app``. Typically, for a ".64" optimised binary
  23. built with `scons p=osx target=release_debug`:
  24. ::
  25. user@host:~/godot$ cp -r misc/dist/osx_tools.app ./Godot.app
  26. user@host:~/godot$ mkdir -p Godot.app/Contents/MacOS
  27. user@host:~/godot$ cp bin/godot.osx.tools.64 Godot.app/Contents/MacOS/Godot
  28. user@host:~/godot$ chmod +x Godot.app/Contents/MacOS/Godot
  29. Compiling for 32 and 64-bit
  30. ---------------------------
  31. All macOS versions after 10.6 are 64-bit exclusive, so the executable
  32. will be a ".64" file by default for most users. If you would like to
  33. compile a ".fat" executable which contains both 32 and 64-bit code,
  34. you can do so by specifying the bits in the scons command like so:
  35. ::
  36. user@host:~/godot$ scons platform=osx bits=fat
  37. Cross-compiling
  38. ---------------
  39. It is possible to compile for OSX in a Linux environment (and maybe
  40. also in Windows with Cygwin). For that you will need
  41. `OSXCross <https://github.com/tpoechtrager/osxcross>`__ to be able
  42. to use OSX as target. First, follow the instructions to install it:
  43. Clone the `OSXCross repository <https://github.com/tpoechtrager/osxcross>`
  44. somewhere on your machine (or download a zip file and extract it somewhere),
  45. e.g.:
  46. ::
  47. user@host:~$ git clone https://github.com/tpoechtrager/osxcross.git /home/myuser/sources/osxcross
  48. 1. Follow the instructions to package the SDK:
  49. https://github.com/tpoechtrager/osxcross#packaging-the-sdk
  50. 2. Follow the instructions to install OSXCross:
  51. https://github.com/tpoechtrager/osxcross#installation
  52. After that, you will need to define the ``OSXCROSS_ROOT`` as the path to
  53. the OSXCross installation (the same place where you cloned the
  54. repository/extracted the zip), e.g.:
  55. ::
  56. user@host:~$ export OSXCROSS_ROOT=/home/myuser/sources/osxcross
  57. Now you can compile with SCons like you normally would:
  58. ::
  59. user@host:~/godot$ scons platform=osx
  60. If you have an OSXCross SDK version different from the one expected by the SCons buildsystem, you can specify a custom one with the ``osxcross_sdk`` argument:
  61. ::
  62. user@host:~/godot$ scons platform=osx osxcross_sdk=darwin15