-
-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake: Handle GODOT_DEV_BUILD flag #1648
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I'm sorry, dont merge this yet, I'm going to start submitting all my PR's as draft because I always find something to change. In this case, the code is not defensive enough, if someone defines DEV in an outer scope, whatever that is will be injected in the name and we dont want that. So I'm going to ammend this for that case. |
I just tested this locally and it doesn't seem to be working for me, although, I could be doing something wrong? I built with:
So, I'm not getting the |
I'll do some re-testing and check back in later |
ea940de
to
7a06374
Compare
dabcddb
to
e235a09
Compare
Thanks! This is working for me when building the However, should I expect this to work when building the test project? I'm still getting |
I figured out why, its a simple change, the ${DEV} flag is not in scope. |
.dev is added to output artifacts Warn users for specifying dev_build and Release build config Update documentation with deviations to SCons Update debug_symbols handling, its rolled into build config Cleanup helper variables and comments
fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! It's working for me now :-)
When SCons has dev_build=yes enabled, there is a "dev" feature flag added to the compile artifact.
it enables debug_symbols unless otherwise specified
It changes the debug symbol generation
it sets the optimisation level to none
It sets DEV_ENABLED mutually exclusive to NDEBUG
Representing how dev_build and debug_symbols interact in CMake was harder than anticipated, I think I have struck a good balance.
debug_symbols will not be an option in CMake.
The generation of debug symbols is controlled by the build configuration. This is how it normally works in CMake and is the closest match to what the option means in SCons. For single configuration generators this is expressed by adding
-DCMAKE_BUILD_TYPE=Debug
orRelWithDebInfo
which will generate debug symbols as expected by all software interacting with a cmake build system. And for multi-config generators adding--config=Debug
orRelWithDebInfo
to the build command. In both cases Debug is the default if not specified.How this interacts with GODOT_DEV_BUILD
GODOT_DEV_BUILD does not enable debug genaration, but it will change the debug level
DEV_ENABLED will not be mutually exclusive with NDEBUG. A warning is presented if single config generator has both
CMAKE_BUILD_TYPE=Release
andGODOT_DEV_BUILD
. For multi-config generators there is no way to warn for this exact mix, but they would both have to be set explicitly by the consumer.Optimisation levels are not yet implemented.
I have updated documentation to descrive the deviations to SCons
Tidied existing debug flag handling that is now redundant
And tidied the helper variables and comments
Before I mark as ready for review I want to go over the documentation and comment strings at least once more. And perform a build option comparison on all three host platforms for all target platforms available to me.
Reminder, that Single-Config generators are Makefiles, Ninja, and Multi-Config generators are VisualStudio, XCode, 'Ninja Multi-Config'
SCons to CMake equivalency
debug_symbols=yes
scons target=template_debug debug_symbols=yes
cmake ../ -DCMAKE_BUILD_TYPE=RelWithDebInfo && cmake --build .
cmake ../ && cmake --build . --config RelWithDebInfo
dev_build=yes (automatically adds debug_symbols=yes)
scons target=template_debug dev_build=yes
cmake ../ -DGODOT_DEV_BUILD=YES -DCMAKE_BUILD_TYPE=Debug && cmake --build .
cmake ../ -DGODOT_DEV_BUILD=YES && cmake --build . --config Debug
dev_build=yes debug_symbols=no
scons target=template_debug dev_build=yes debug_symbols=no
cmake ../ -DGODOT_DEV_BUILD=YES -DCMAKE_BUILD_TYPE=Release && cmake --build .
cmake ../ -DGODOT_DEV_BUILD=YES && cmake --build . --config Release
Comparison Spreadsheet, sub sheets contain so far MSVC, Msys, and MacOS.