compiling_for_osx.rst 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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+ (3.0 is untested as of now)
  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 "fat" binary that
  23. supports both 32-bit and 64-bit architectures, and with an optimised binary
  24. built with `scons p=osx target=release_debug`:
  25. ::
  26. user@host:~/godot$ cp -r misc/dist/osx_tools.app ./Godot.app
  27. user@host:~/godot$ mkdir -p Godot.app/Contents/MacOS
  28. user@host:~/godot$ cp bin/godot.osx.opt.tools.fat Godot.app/Contents/MacOS/Godot
  29. user@host:~/godot$ chmod +x Godot.app/Contents/MacOS/Godot
  30. Cross-compiling
  31. ---------------
  32. It is possible to compile for OSX in a Linux environment (and maybe
  33. also in Windows with Cygwin). For that you will need
  34. `OSXCross <https://github.com/tpoechtrager/osxcross>`__ to be able
  35. to use OSX as target. First, follow the instructions to install it:
  36. Clone the `OSXCross repository <https://github.com/tpoechtrager/osxcross>`
  37. somewhere on your machine (or download a zip file and extract it somewhere),
  38. e.g.:
  39. ::
  40. user@host:~$ git clone https://github.com/tpoechtrager/osxcross.git /home/myuser/sources/osxcross
  41. 1. Follow the instructions to package the SDK:
  42. https://github.com/tpoechtrager/osxcross#packaging-the-sdk
  43. 2. Follow the instructions to install OSXCross:
  44. https://github.com/tpoechtrager/osxcross#installation
  45. After that, you will need to define the ``OSXCROSS_ROOT`` as the path to
  46. the OSXCross installation (the same place where you cloned the
  47. repository/extracted the zip), e.g.:
  48. ::
  49. user@host:~$ export OSXCROSS_ROOT=/home/myuser/sources/osxcross
  50. Now you can compile with SCons like you normally would:
  51. ::
  52. user@host:~/godot$ scons platform=osx
  53. 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:
  54. ::
  55. user@host:~/godot$ scons platform=osx osxcross_sdk=darwin15