CLion¶
CLion 是用於 C++ 的商業版 JetBrains IDE。
匯入專案¶
使用 CLion 會需要有一個作為專案檔的 CMakeLists.txt
,這對於 Godot 來說會是個問題,因為 Godot 使用 SCons 建置系統而非 CMake。但,我們有一個用於 Android Studio 的 CMakeLists.txt
設定檔,該設定檔也能用於 CLion。
在 CLion 的歡迎視窗中選擇匯入現有專案的選項。若已開啟另一個專案,請從上方選單中選擇 File > Open 。
Navigate to
<Godot root directory>/platform/android/java/nativeSrcsConfigs
(theCMakeLists.txt
file is located there) and select it (but not theCMakeLists.txt
file itself), then click OK.

該資料夾包含 CMakeLists.txt
檔案。¶
若出現了這個彈出視窗,請選擇 This Window 來開啟專案:

從上方選單選擇 Tools > CMake > Change Project Root 然後選擇 Godot 的根目錄。

現在應該可以看到所有專案檔案了。專案完成索引後應該就能使用自動補全。
若遇到任何問題,請在 任何一個 Godot 的社群頻道 中尋求幫助。
對專案進行除錯¶
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...

Find and Select godot in the list (or type the binary name/Process ID)

You can now use the debugging tools from CLion.
備註
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.