Add switch for enabling debug symbols and logs

Enabling the switch on release builds will optimize the binaries as
normal, but will still include debug symbols. This is advantageous for
bugs that do not show up in debug builds without optimizations.
This commit is contained in:
Vasily
2020-01-15 14:01:47 +01:00
committed by username223
parent 5498424889
commit 016e5ebc4a
3 changed files with 20 additions and 1 deletions
+5
View File
@@ -118,3 +118,8 @@ unix {
INSTALLS += application
}
debugSymbolsAndLogs {
message(Debug symbols and logging enabled.)
CONFIG += force_debug_info
DEFINES += ENABLE_DEBUG_LOGGING
}
+1
View File
@@ -334,6 +334,7 @@ The following values can be appended to the `CONFIG` internal variable in order
| ----- | ------- |
| `noX11` | Disables X11 specific features (VR to keyboard input). |
| `noDBUS` | Disables DBUS specific features (control media players). |
| `debugSymbolsAndLogs` | Enables debug symbols and debug logging calls (while still having release optimizations). |
The values are case sensitive.
+14 -1
View File
@@ -1,4 +1,9 @@
#include "setup.h"
#ifdef ENABLE_DEBUG_LOGGING
constexpr auto debugLoggingEnabled = true;
#else
constexpr auto debugLoggingEnabled = false;
#endif
// The default Qt message handler prints to stdout on X11 and to the debugger on
// Windows. That is borderline useless for us, therefore we create our own
@@ -317,7 +322,15 @@ void setUpLogging()
constexpr auto confDisabled = "false";
conf.set( Level::Trace, ConfigurationType::Enabled, confDisabled );
conf.set( Level::Debug, ConfigurationType::Enabled, confDisabled );
if constexpr ( debugLoggingEnabled )
{
conf.set( Level::Debug, ConfigurationType::Enabled, confEnabled );
}
else
{
conf.set( Level::Debug, ConfigurationType::Enabled, confDisabled );
}
const auto appDataLocation
= std::string( "/" ) + application_strings::applicationOrganizationName