configuring_an_ide.rst 7.2 KB

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