xcode.rst 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. .. _doc_configuring_an_ide_xcode:
  2. Xcode
  3. =====
  4. Xcode is a free macOS-only IDE. You can download it from the Mac App Store.
  5. Project setup
  6. -------------
  7. - Create an Xcode external build project anywhere.
  8. .. image:: img/xcode_1_create_external_build_project.png
  9. Go to the build target's **Info** tab, then:
  10. - Set **Build Tool** to the full path to SCons.
  11. - Set **Arguments** to something like
  12. ``platform=osx tools=yes bits=64 target=debug``.
  13. - Set **Directory** to the path to Godot's source folder.
  14. - You may uncheck **Pass build settings in environment**.
  15. .. image:: img/xcode_2_configure_scons.png
  16. Add a Command Line Tool target which will be used for indexing the project:
  17. - In Xcode's menu, choose **File > New > Target...** and add a new Xcode
  18. command line tool target.
  19. .. image:: img/xcode_3_add_new_target.png
  20. .. image:: img/xcode_4_select_command_line_target.png
  21. - Name it something so you know not to compile with this target (e.g. ``GodotXcodeIndex``).
  22. - Goto the newly created target's **Build Settings** tab and look for **Header Search Paths**.
  23. - Set **Header Search Paths** to the absolute path to Godot's source folder.
  24. - Make it recursive by adding two asterisks (``**``) to the end of the path,
  25. e.g. ``/Users/me/repos/godot-source/**``.
  26. Add the Godot source to the project:
  27. - Drag and drop Godot source into the project file browser.
  28. - Uncheck **Create external build system project**.
  29. .. image:: img/xcode_5_after_add_godot_source_to_project.png
  30. - Click **Next**.
  31. - Select **Create groups**.
  32. .. image:: img/xcode_6_after_add_godot_source_to_project_2.png
  33. - Check *only* your command line indexing target in the
  34. **Add to targets** section.
  35. - Click finish. Xcode will now index the files. This may take a few minutes.
  36. - Once Xcode is done indexing, you should have jump-to-definition,
  37. autocompletion, and full syntax highlighting.
  38. Scheme setup
  39. ------------
  40. To enable debugging support, edit the external build target's build scheme:
  41. - Open the scheme editor of the external build target.
  42. - Expand the **Build** menu.
  43. - Goto **Post Actions**.
  44. - Add a new script run action, select your project in **Provide build settings from**
  45. as this allows you to use the``${PROJECT_DIR}`` variable.
  46. .. image:: img/xcode_7_setup_build_post_action.png
  47. - Write a script that gives the binary a name that Xcode will recognize, such as:
  48. ``ln -f ${PROJECT_DIR}/godot/bin/godot.osx.tools.64 ${PROJECT_DIR}/godot/bin/godot``
  49. - Build the external build target.
  50. Edit the external build target's Run scheme:
  51. - Open the scheme editor again.
  52. - Click **Run**.
  53. .. image:: img/xcode_8_setup_run_scheme.png
  54. - Set the **Executable** to the file you linked in your post-build action script.
  55. - Check **Debug executable** if it isn't checked already.
  56. - You can go to **Arguments** tab and specify the full path to a
  57. ``project.godot`` file to debug the editor instead of the project manager.
  58. Alternatively, use ``--path`` to point to a project *folder* which will be
  59. run directly (instead of opening the editor).
  60. Test the Run scheme:
  61. - Set a breakpoint in ``platform/osx/godot_main_osx.mm``.
  62. - If all goes well, it should break at the specified breakpoint.
  63. If you run into any issues, ask for help in one of
  64. `Godot's community channels <https://godotengine.org/community>`__.