configuring_an_ide.rst 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. .. _doc_configuring_an_ide:
  2. Configuring an IDE
  3. ==================
  4. We assume that you already `cloned <https://github.com/godotengine/godot>`_
  5. and :ref:`compiled <toc-devel-compiling>` Godot.
  6. You can easily develop Godot with any text editor and by invoking ``scons``
  7. on the command line, but if you want to work with an IDE (Integrated
  8. Development Environment), here are setup instructions for some popular ones:
  9. - :ref:`Qt Creator <doc_configuring_an_ide_qtcreator>` (all desktop platforms)
  10. - :ref:`Kdevelop <doc_configuring_an_ide_kdevelop>` (all desktop platforms)
  11. - :ref:`Xcode <doc_configuring_an_ide_xcode>` (macOS)
  12. - :ref:`Visual Studio <doc_compiling_for_windows_install_vs>` (Windows)
  13. It is possible to use other IDEs, but their setup is not documented yet.
  14. Qt Creator
  15. ----------
  16. Importing the project
  17. ^^^^^^^^^^^^^^^^^^^^^
  18. - Choose *New Project* -> *Import Project* -> *Import Existing Project*.
  19. .. image:: img/qtcreator-new-project.png
  20. - Set the path to your Godot root directory and enter the project name.
  21. .. image:: img/qtcreator-set-project-path.png
  22. - Here you can choose which folders and files will be visible to the project. C/C++ files
  23. are added automatically. Potentially useful additions: \*.py for buildsystem files, \*.java for Android development,
  24. \*.mm for macOS. Click "Next".
  25. .. image:: img/qtcreator-apply-import-filter.png
  26. - Click *Finish*.
  27. - Add a line containing ``.`` to *project_name.includes* to get working code completion.
  28. .. image:: img/qtcreator-project-name-includes.png
  29. Build and run
  30. ^^^^^^^^^^^^^
  31. Build configuration:
  32. - Click on *Projects* and open the *Build* tab.
  33. - Delete the pre-defined ``make`` build step.
  34. .. image:: img/qtcreator-projects-build.png
  35. - Click *Add Build Step* -> *Custom Process Step*.
  36. .. image:: img/qtcreator-add-custom-process-step.png
  37. - Type ``scons`` in the *Command* field. If it fails with 'Could not start process "scons"',
  38. it can mean that ``scons`` is not in your ``PATH`` environment variable, so you may have to
  39. use the full path to the SCons binary.
  40. - Fill the *Arguments* field with your compilation options. (e.g.: ``p=x11 target=debug -j 4``)
  41. .. image:: img/qtcreator-set-scons-command.png
  42. Run configuration:
  43. - Open the *Run* tab.
  44. - Point the *Executable* to your compiled Godot binary (e.g: ``%{buildDir}/bin/godot.x11.opt.tools.64``)
  45. - If you want to run a specific game or project, point *Working directory* to the game directory.
  46. - If you want to run the editor, add ``-e`` to the *Command line arguments* field.
  47. .. image:: img/qtcreator-run-command.png
  48. Updating Sources after pulling latest commits
  49. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  50. As a developer you usually want to frequently pull the latest commits
  51. from the upstream git repository or a specific fork etc. However this
  52. brings a little problem with it: as the development continues, source files
  53. (and folders) are added or removed. These changes needs to be reflected in
  54. your project files for Qt Creator too, so you continue to have a nice
  55. experience coding in it. A simple way to check these things, is to right click
  56. at your root folder in the "Projects View" and click on "Edit files..."
  57. .. image:: img/qtcreator-edit-files-menu.png
  58. Now a new dialog should appear that is similar in functionality to the one in the third step
  59. of the "Importing the project" section. Here now you can check whether you want to add/remove
  60. specific files and/or folders. You can chose by clicking with your mouse or just simply by
  61. clicking the "Apply Filter" button. A simple click on "Ok" and you're ready to continue your work.
  62. .. image:: img/qtcreator-edit-files-dialog.png
  63. Kdevelop
  64. --------
  65. `Kdevelop <https://www.kdevelop.org>`_ is a free, open source IDE for all desktop platforms.
  66. You can find a video tutorial `here <https://www.youtube.com/watch?v=yNVoWQi9TJA>`_.
  67. Or you may follow this text version tutorial.
  68. Start by opening Kdevelop and choosing "open project".
  69. .. image:: img/kdevelop_newproject.png
  70. Choose the directory where you cloned Godot.
  71. .. image:: img/kdevelop_openproject.png
  72. For the build system, choose "custom build system".
  73. .. image:: img/kdevelop_custombuild.png
  74. Now that the project has been imported, open the project configuration.
  75. .. image:: img/kdevelop_openconfig.png
  76. Add the following includes/imports:
  77. ::
  78. . // a dot to indicate the root of the Godot project
  79. core/
  80. core/os/
  81. core/math/
  82. tools/
  83. drivers/
  84. platform/x11/ // make that platform/osx/ if you're using OS X
  85. .. image:: img/kdevelop_addincludes.png
  86. Apply the changes then switch to the "Custom Buildsystem" tab.
  87. Leave the build directory blank. Enable build tools and add ``scons``
  88. as the executable and add ``platform=x11 target=debug`` (``platform=osx``
  89. if you're on OS X).
  90. .. image:: img/kdevelop_buildconfig.png
  91. Next we need to tell KDevelop where to find the binary.
  92. From the "run" menu, choose "Configure Launches".
  93. .. image:: img/kdevelop_configlaunches.png
  94. Click "Add new" if no launcher exists. Then add the path to your
  95. executable in the executable section. Your executable should be located
  96. in the ``bin/`` sub-directory and should be named something like
  97. ``godot.x11.tools.64`` (the name could be different depending on your
  98. platform and depending on your build options).
  99. .. image:: img/kdevelop_configlaunches2.png
  100. That's it! Now you should be good to go :)
  101. Xcode
  102. -----
  103. Project Setup
  104. ^^^^^^^^^^^^^
  105. - Create an Xcode external build project anywhere
  106. .. image:: img/xcode_1_create_external_build_project.png
  107. - Set the *Build tool* to the path to scons
  108. Modify Build Target's Xcode Info Tab:
  109. - Set *Arguments* to something like: platform=osx tools=yes bits=64 target=debug
  110. - Set *Directory* to the path to Godot's source folder. Keep it blank if project is already there.
  111. - You may uncheck *Pass build settings in environment*
  112. .. image:: img/xcode_2_configure_scons.png
  113. Add a Command Line Target:
  114. - Go to Xcode File > New > Target... and add a new Xcode command line target
  115. .. image:: img/xcode_3_add_new_target.png
  116. .. image:: img/xcode_4_select_command_line_target.png
  117. - Name it something so you know not to compile with this target
  118. - e.g. ``GodotXcodeIndex``
  119. - Goto the newly created target's *Build Settings* tab and search for *Header Search Paths*
  120. - Set *Header Search Paths* to an absolute path to Godot's source folder
  121. - Make it recursive by adding two \*'s to the end of the path
  122. - e.g. ``/Users/me/repos/godot-source/\**``
  123. Add Godot Source to the Project:
  124. - Drag and drop godot source into project file browser.
  125. - Uncheck *Create External Build System*
  126. .. image:: img/xcode_5_after_add_godot_source_to_project.png
  127. - Click Next
  128. - Select *create groups*
  129. .. image:: img/xcode_6_after_add_godot_source_to_project_2.png
  130. - Check off only your command line target in the *Add to targets* section
  131. - Click finish. Xcode will now index the files.
  132. - Grab a cup of coffee... Maybe make something to eat, too
  133. - You should have jump to definition, auto completion, and full syntax highlighting when it is done.
  134. Scheme Setup
  135. ^^^^^^^^^^^^
  136. Edit Build Scheme of External Build Target:
  137. - Open scheme editor of external build target
  138. - Expand the *Build* menu
  139. - Goto *Post Actions*
  140. - Add a new script run action, select your project in ``Provide build settings from`` as this allows you to use ``${PROJECT_DIR}`` variable.
  141. .. image:: img/xcode_7_setup_build_post_action.png
  142. - Write a script that gives the binary a name that Xcode will recognize
  143. - e.g. ``ln -f ${PROJECT_DIR}/godot/bin/godot.osx.tools.64 ${PROJECT_DIR}/godot/bin/godot``
  144. - Build the external build target
  145. Edit Run Scheme of External Build Target:
  146. - Open the scheme editor again
  147. - Click Run
  148. .. image:: img/xcode_8_setup_run_scheme.png
  149. - Set the *Executable* to the file you linked in your post build action script
  150. - Check *Debug executable* if it isn't already
  151. - You can go to *Arguments* tab and add an -e and a -path to a project to debug the editor
  152. not the project selection screen
  153. Test it:
  154. - Set a breakpoint in platform/osx/godot_main_osx.mm
  155. - It should break at the point!