CLion

CLion é uma IDE comercial desenvolvida pela JetBrains para programação em C++.

Importando o projeto

O CLion requer um arquivo CMakeLists.txt como arquivo de projeto, que é um problema pelo Godot porque usa o SCons buildsystem ao invés do CMake. Porém, existe uma configuração do CMakeLists.txt para o Android Studio que também pode ser usado pelo CLion.

  • From the CLion's welcome window choose the option to import an existing project. If you've already opened another project, choose File > Open from the top menu.

  • Navigate to <Godot root directory>/platform/android/java/nativeSrcsConfigs (the CMakeLists.txt file is located there) and select it (but not the CMakeLists.txt file itself), then click OK.

../../../_images/clion_1_open.png

The folder containing the CMakeLists.txt file.

  • If this popup window appears, select This Window to open the project:

../../../_images/clion_2_this_window.png
  • Choose Tools > CMake > Change Project Root from the top menu and select the Godot root folder.

../../../_images/clion_3_change_project_root.png
  • You should be now be able to see all the project files. Autocomplete should work once the project has finished indexing.

Se você se deparar com qualquer problema, peça ajuda em um dos canais da comunidade do Godot.

Debugging the project

Since CLion does not support SCons, you won't be able to compile, launch, and debug Godot from CLion in one step. You will first need to compile godot yourself and run the binary without CLion. You will then be able to debug Godot by using the Attach to process feature.

  • Run the compilation in debug mode by entering scons.

  • Run the binary you have created (in the bin directory). If you want to debug a specific project, run the binary with the following arguments : --editor --path path/to/your/godot/project. To run the project instead of editing it, remove the --editor argument.

  • In CLion, go to Run > Attach to Process...

../../../_images/clion_4_select_attach_to_process.png
  • Find and Select godot in the list (or type the binary name/Process ID)

../../../_images/clion_5_select_godot_process.png

You can now use the debugging tools from CLion.

Nota

If you run the binary without any arguments, you will only debug the project manager window. Don't forget to add the --path path/to/your/godot/project argument to debug a project.