Repository navigation
Description
Godot version
4.4-beta1
godot-cpp version
System information
Windows 11, CMake 3.30.5, Visual Studio 2022
Issue description
When using CMake and compiling godot-cpp::template_release debugging features will still be enabled.
Specifically in
godot-cpp/cmake/godotcpp.cmake
Line 283 in 13cd2d9
| set( DEBUG_FEATURES "$<NOT:$<STREQUAL:${TARGET_NAME},template_release>>" ) |
${TARGET_NAME}is set to template_release, however it needs to be ${TARGET_ALIAS}.
This can also be seen in current build logs of the GitHub Actions such as
https://github.com/godotengine/godot-cpp/actions/runs/12892247119/job/35946077972
When checking the Build test GDExtension library step, a release version should be built, however the build command includes /D DEBUG_ENABLED /D DEBUG_METHODS_ENABLED
I investigated this, as for my extension the build on Windows MSVC was failing, as libgodot-cpp.windows.template_release.x86_64.libwas over 4GB in size. Thankfully #1628 puts it back at around 3.5GB so MSVC is working again.
However even when correcting the aforementioned line of code to set( DEBUG_FEATURES "$<NOT:$<STREQUAL:${TARGET_ALIAS},template_release>>") the line in
godot-cpp/cmake/common_compiler_flags.cmake
Line 149 in 13cd2d9
| $<${DEBUG_FEATURES}:DEBUG_ENABLED DEBUG_METHODS_ENABLED> |
Steps to reproduce
It is possible to use the same commands the CI is currently using:
mkdir cmake-build
cd cmake-build
cmake ../ -DGODOT_ENABLE_TESTING=YES
cmake --build . --verbose -t godot-cpp.test.template_release --config Release
Upon inspection of the generated build commands it will be visible how the debug info is always included.
Minimal reproduction project
/
Activity
CMake: Fix godotengine#1690 - DEBUG_FEATURES generator expression
enetheru commentedon Jan 23, 2025
Thanks for the report, you are indeed correct and it's my bad.
I checked this, and I am not seeing the same result. a template_release Release build evaluates the expression to 0 for me.
I ran exactly the same commands as you to check it. and the resulting compile commands omit the related build flags.
NetroScript commentedon Jan 23, 2025
I just tested it again in the console instead of with my IDE and then it also works for me without the debug switches. The only difference is that the IDE uses Ninja as generator (which in turn then uses MSVC).
However when Ninja is used as generator, it still produces build files which have
-DDEBUG_ENABLED -DDEBUG_METHODS_ENABLEDenabled for some reason.This is also reproducible in the test project when using:
instead as command.
(Here I was using the Developer Powershell for VS 2022, CMake 3.29.0, Ninja 1.11.1)
enetheru commentedon Jan 23, 2025
This is after the fix yes?
I cant re-produce, it generates correct results for me. Is this an accurate reflection of what you have done?
Note: I use the build_profile to cut down on compile times.
NetroScript commentedon Jan 23, 2025
Ok, I have no idea what is happening with my setup 😅. I tried the same commands again (and also still see the console history where it didn't work, and I removed the entire build folder every time) and now I can't reproduce it anymore.
So it seems this additional thing with Ninja was some very strange issue on my end, and it is now (for some reason) solved.
enetheru commentedon Jan 24, 2025
Thanks, I've marked the PR ready to review.
Merge pull request #1691 from enetheru/fix1690
CMake: Fix godotengine#1690 - DEBUG_FEATURES generator expression