code_blocks.rst 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. .. _doc_configuring_an_ide_code_blocks:
  2. Code::Blocks
  3. ============
  4. `Code::Blocks <https://codeblocks.org/>`_ is a free, open-source, cross-platform IDE.
  5. Creating a new project
  6. ----------------------
  7. From Code::Blocks' main screen, click **Create a new project** or select **File > New > Project...**.
  8. .. figure:: img/code_blocks_file_new_project.png
  9. :figclass: figure-w480
  10. :align: center
  11. In the **New from template** window, from **Projects**, select **Empty project**, and click **Go**.
  12. .. figure:: img/code_blocks_new_empty_project.png
  13. :figclass: figure-w480
  14. :align: center
  15. Click Next, to pass the welcome to the new empty project wizard.
  16. .. figure:: img/code_blocks_wizard_welcome.png
  17. :figclass: figure-w480
  18. :align: center
  19. The project file should be created in the root of the cloned project folder. To achieve this, first, ensure that the **Project title** is the same as the folder name that Godot was cloned into. Unless you cloned the project into a folder with a different name, this will be ``godot``.
  20. Second, ensure that the **Folder to create project in** is the folder you ran the Git clone command from, not the ``godot`` project folder. Confirm that the **Resulting filename** field will create the project file in the root of the cloned project folder.
  21. .. figure:: img/code_blocks_project_title_and_location.png
  22. :figclass: figure-w480
  23. :align: center
  24. The compiler and configuration settings are managed through **SCons** and will be configured later. However, it's worth deselecting the **Create "Release" configuration** option; so only a single build target is created before clicking **Finish**.
  25. .. figure:: img/code_blocks_compiler_and_configuration.png
  26. :figclass: figure-w480
  27. :align: center
  28. Configuring the build
  29. ---------------------
  30. The first step is to change the project properties. Right-click on the new project and select **Properties...**.
  31. .. figure:: img/code_blocks_open_properties.png
  32. :figclass: figure-w480
  33. :align: center
  34. Check the **This is a custom Makefile** property. Click OK to save the changes.
  35. .. figure:: img/code_blocks_project_properties.png
  36. :figclass: figure-w480
  37. :align: center
  38. The next step is to change the build options. Right-click on the new project and select **Build Options...**.
  39. .. figure:: img/code_blocks_open_build_options.png
  40. :figclass: figure-w480
  41. :align: center
  42. Select the **"Make" commands** tab and remove all the existing commands for all the build targets. For each build target enter the **SCons** command for creating the desired build in the **Build project/target** field. The minimum is ``scons``. For details on the **SCons** build options, see :ref:`doc_introduction_to_the_buildsystem`. It's also useful to add the ``scons --clean`` command in the **Clean project/target** field to the project's default commands.
  43. If you're using Windows, all the commands need to be preceded with ``cmd /c`` to initialize the command interpreter.
  44. .. figure:: img/code_blocks_scons_minimum.png
  45. :figclass: figure-w480
  46. :align: center
  47. .. figure:: img/code_blocks_scons_clean.png
  48. :figclass: figure-w480
  49. :align: center
  50. Windows example:
  51. .. figure:: img/code_blocks_scons_windows.png
  52. :figclass: figure-w480
  53. :align: center
  54. Code::Blocks should now be configured to build Godot; so either select **Build > Build**, click the gear button, or press :kbd:`Ctrl + F9`.
  55. Configuring the run
  56. -------------------
  57. Once **SCons** has successfully built the desired target, reopen the project **Properties...** and select the **Build targets** tab. In the **Output filename** field, browse to the ``bin`` folder and select the compiled file.
  58. Deselect the **Auto-generate filename prefix** and **Auto-generate filename extension** options.
  59. .. figure:: img/code_blocks_build_targets.png
  60. :figclass: figure-w480
  61. :align: center
  62. Code::Blocks should now be configured to run your compiled Godot executable; so either select **Build > Run**, click the green arrow button, or press :kbd:`Ctrl + F10`.
  63. There are two additional points worth noting. First, if required, the **Execution working dir** field can be used to test specific projects, by setting it to the folder containing the ``project.godot`` file. Second, the **Build targets** tab can be used to add and remove build targets for working with and creating different builds.
  64. Adding files to the project
  65. ---------------------------
  66. To add all the Godot code files to the project, right-click on the new project and select **Add files recursively...**.
  67. .. figure:: img/code_blocks_add_files_recursively.png
  68. :figclass: figure-w480
  69. :align: center
  70. It should automatically select the project folder; so simply click **Open**. By default, all code files are included, so simply click **OK**.
  71. .. figure:: img/code_blocks_select_files.png
  72. :figclass: figure-w480
  73. :align: center
  74. Code style configuration
  75. ------------------------
  76. Before editing any files, remember that all code needs to comply with the :ref:`doc_code_style_guidelines`. One important difference with Godot is the use of tabs for indents. Therefore, the key default editor setting that needs to be changed in Code::Blocks is to enable tabs for indents. This setting can be found by selecting **Settings > Editor**.
  77. .. figure:: img/code_blocks_update_editor_settings.png
  78. :figclass: figure-w480
  79. :align: center
  80. Under **General Settings**, on the **Editor Settings** tab, under **Tab Options** check **Use TAB character**.
  81. .. figure:: img/code_block_use_tab_character.png
  82. :figclass: figure-w480
  83. :align: center
  84. That's it. You're ready to start contributing to Godot using the Code::Blocks IDE. Remember to save the project file and the **Workspace**. If you run into any issues, ask for help in one of `Godot's community channels <https://godotengine.org/community>`__.