clion.rst 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. .. _doc_configuring_an_ide_clion:
  2. CLion
  3. =====
  4. `CLion <https://www.jetbrains.com/clion/>`_ is a commercial
  5. `JetBrains <https://www.jetbrains.com/>`_ IDE for C++.
  6. Importing the project
  7. ---------------------
  8. CLion requires a ``CMakeLists.txt`` file as a project file, which is problematic
  9. for Godot because it uses the SCons buildsystem instead of CMake. However,
  10. there is a ``CMakeLists.txt`` configuration for :ref:`Android Studio <doc_configuring_an_ide_android_studio>`
  11. which can also be used by CLion.
  12. - From the CLion's welcome window choose the option to import an existing
  13. project. If you've already opened another project, choose **File > Open**
  14. from the top menu.
  15. - Navigate to ``<Godot root directory>/platform/android/java/nativeSrcsConfigs`` (the
  16. ``CMakeLists.txt`` file is located there) and select it (but *not* the
  17. ``CMakeLists.txt`` file itself), then click **OK**.
  18. .. figure:: img/clion_1_open.png
  19. :align: center
  20. The folder containing the ``CMakeLists.txt`` file.
  21. - If this popup window appears, select **This Window** to open the project:
  22. .. figure:: img/clion_2_this_window.png
  23. :align: center
  24. - Choose **Tools > CMake > Change Project Root** from the top menu and select
  25. the Godot root folder.
  26. .. figure:: img/clion_3_change_project_root.png
  27. :align: center
  28. - You should be now be able to see all the project files. Autocomplete should
  29. work once the project has finished indexing.
  30. If you run into any issues, ask for help in one of
  31. `Godot's community channels <https://godotengine.org/community>`__.
  32. Debugging the project
  33. ---------------------
  34. Since CLion does not support SCons, you won't be able to compile, launch, and debug Godot from CLion in one step.
  35. You will first need to `compile godot yourself <https://docs.godotengine.org/en/stable/development/compiling/index.html>`__ and run the binary without CLion. You will then be able to debug Godot by using the `Attach to process <https://www.jetbrains.com/help/clion/attaching-to-local-process.html>`__ feature.
  36. - Run the compilation in debug mode by entering ``scons``.
  37. - 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.
  38. - In CLion, go to **Run > Attach to Process...**
  39. .. figure:: img/clion_4_select_attach_to_process.png
  40. :align: center
  41. - Find and Select godot in the list (or type the binary name/Process ID)
  42. .. figure:: img/clion_5_select_godot_process.png
  43. :align: center
  44. You can now use the debugging tools from CLion.
  45. .. note::
  46. If you run the binary without any arguments, you will only debug the project manager window.
  47. Don't forget to add the ``--path path/to/your/godot/project`` argument to debug a project.