CLion 2020.3 for MacOSX + UE4.25.4: Why does it take so long to start a build?
Completed
- I select target MYPROJECTEDITOR | DEBUG
- Click on Build
- The following line appears in the Build log:
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/myusername/dev/git/private/unreal/myproject/cmake-build-debug --target myprojectEditor -- -j 9
This line stays for almost 3 full minutes before it continues with:
Running system mono/msbuild, version: Mono JIT compiler version 6.12.0.107 (2020-02/a22ed3f094e Wed Oct 28 07:48:22 EDT 2020)
Fast forward to the end of the log and it shows:
Building myprojectEditor...
Performing 4 actions (12 in parallel)
@progress 'Compiling C++ source code...' 0%
[1/4] Compile MainCharacter.cpp
[2/4] Compile MainCharacter.gen.cpp
@progress 'Compiling C++ source code...' 20%
@progress 'Compiling C++ source code...' 40%
[3/4] Link UE4Editor-myproject-0002.dylib
@progress 'Compiling C++ source code...' 60%
[4/4] UnrealBuildTool.exe myprojectEditor.target
@progress 'Compiling C++ source code...' 80%
Total time in Local executor: 11.75 seconds
Total execution time: 21.61 seconds
Built target myprojectEditor
If I rebuild immediately after it finishes, I'm again stuck waiting 3 minutes. What is it doing in this time?
Please sign in to leave a comment.
I found my answer, in case someone else faces this: it was the codeBlocks generator. I changed it to Ninja and now it takes less than 10 seconds.
CLion -> Preferences -> Build, Execution, Deployment -> CMake: CMake options:
Add "-G Ninja", so you get:
-DCMAKE_BUILD_TYPE=DEBUG - G Ninja
Just in case some words about CLion + Unreal Engine:
When you generate a CLion project in the Unreal Engine editor, it generates custom targets for building and cleaning your game (
add_custom_target()
commands in the CMakeLists.txt). So you can call Build for these targets (not for the entire project) and external Unreal Engine building processes will be launched.Also the plugin adds one fake target (
add_executable(FakeTarget ...)
command in the CMakeLists.txt) for CLion needs. It's used in the[ProjectName]Editor
configuration and makes all the intellisense possible. Note that it doesn't really make sense to build this target.Hi Anna, thanks for clarifying. The problem for me seems that this external Unreal Engine building processes doesn't start until after 3 minutes, but when I choose Ninja as a generator those 3 minutes are reduced to seconds.
According to
you build the fake target, not custom targets for building and cleaning your game. Once again: this target is created for CLion needs only, it doesn't really make sense to build this target.
Hi Anna,
That's not correct, I didn't build the fake target. I'm supposed to build the <projectname>Editor target. The fake target is called FakeTarget.
As far as I know, FakeTarget (
add_executable(FakeTarget ...)
command in the CMakeLists.txt) is used in the[ProjectName]Editor
configuration. Please go to `Run | Edit Configurations...`, find the[ProjectName]Editor
configuration and check what target is selected in it.Hi Anna,
in myprojectEditor it targets myprojectEditor with Executable UE4Editor, which I might have set myself.
Program arguments: <path>/myproject.uproject -UNATTENDED
For FakeTarget, both the Target and the Executable are FakeTarget.
But don't you recommend to run the custom target [ProjectName]Editor to build and debug? I've always been using that and it works like a charm.
You recommended it here:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360006705279/comments/360001014260
If not, what target should I choose instead?
>You recommended it here
I recommended to just select the [ProjectName]Editor configuration in the run/debug configurations switcher in order to get code insight features working, not to build it.
The thing is that Unreal Engine Editor is responsible for creating a CMakeLists.txt and run/debug configurations. And I can't find any proper documentation about it. I was sure that the FakeTarget was used in the [ProjectName]Editor configuration and this configuration was only needed for code insight features to work. It turns out I was wrong, sorry for that. I installed Unreal Engine Editor, generated a project, and now I see that the [ProjectName]Editor configuration uses the [ProjectName]Editor target which is one of the custom targets that launch external Unreal Engine processes.
I'm sincerely sorry for taking your time. Thank you very much for your patience!
No worries, I appreciate you reached out and investigated. Either way, my suggestion to change the generator to NINJA probably belongs on an Unreal forum, unless you guys work together on it :)
Currently, in terms of Unreal Engine projects, we are focused on developing Rider for Unreal Engine - https://www.jetbrains.com/lp/rider-unreal/. For now, it only operates on Windows. We plan to extend it to macOS and Linux in the future. If you're interested, please subscribe to the blog https://blog.jetbrains.com/dotnet/ to get the news when it happens.