build: decrease level of debug information produced by default
Refs: #5279
Change-Id: I537ff2a0a2e411279922823ae46cb7fee6586670
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 8c71871..25aa974 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -3,10 +3,12 @@
import platform
from waflib import Configure, Logs, Utils
+
def options(opt):
opt.add_option('--debug', '--with-debug', action='store_true', default=False,
help='Compile in debugging mode with minimal optimizations (-Og)')
+
def configure(conf):
conf.start_msg('Checking C++ compiler version')
@@ -48,7 +50,7 @@
else:
conf.end_msg(ccverstr)
- conf.areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
+ conf.areCustomCxxflagsPresent = len(conf.env.CXXFLAGS) > 0
# General flags are always applied (e.g., selecting C++ language standard)
generalFlags = conf.flags.getGeneralFlags(conf)
@@ -56,6 +58,7 @@
conf.add_supported_linkflags(generalFlags['LINKFLAGS'])
conf.env.DEFINES += generalFlags['DEFINES']
+
@Configure.conf
def check_compiler_flags(conf):
# Debug or optimized CXXFLAGS and LINKFLAGS are applied only if the
@@ -78,10 +81,11 @@
conf.env.DEFINES += extraFlags['DEFINES']
+
@Configure.conf
def add_supported_cxxflags(self, cxxflags):
"""
- Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
+ Check which cxxflags are supported by the active compiler and add them to env.CXXFLAGS variable.
"""
if len(cxxflags) == 0:
return
@@ -97,10 +101,11 @@
self.end_msg(' '.join(supportedFlags))
self.env.prepend_value('CXXFLAGS', supportedFlags)
+
@Configure.conf
def add_supported_linkflags(self, linkflags):
"""
- Check which linkflags are supported by compiler and add them to env.LINKFLAGS variable
+ Check which linkflags are supported by the active compiler and add them to env.LINKFLAGS variable.
"""
if len(linkflags) == 0:
return
@@ -133,10 +138,12 @@
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in optimized mode"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['NDEBUG']}
+
class GccBasicFlags(CompilerFlags):
"""
- This class defines basic flags that work for both gcc and clang compilers
+ This class defines common flags that work for both gcc and clang compilers.
"""
+
def getGeneralFlags(self, conf):
flags = super(GccBasicFlags, self).getGeneralFlags(conf)
flags['CXXFLAGS'] += ['-std=c++17']
@@ -147,7 +154,7 @@
def getDebugFlags(self, conf):
flags = super(GccBasicFlags, self).getDebugFlags(conf)
flags['CXXFLAGS'] += ['-Og',
- '-g3',
+ '-g',
'-Wall',
'-Wextra',
'-Wpedantic',
@@ -165,7 +172,7 @@
def getOptimizedFlags(self, conf):
flags = super(GccBasicFlags, self).getOptimizedFlags(conf)
flags['CXXFLAGS'] += ['-O2',
- '-g',
+ '-g1',
'-Wall',
'-Wextra',
'-Wpedantic',
@@ -177,6 +184,7 @@
flags['LINKFLAGS'] += ['-Wl,-O1']
return flags
+
class GccFlags(GccBasicFlags):
def getDebugFlags(self, conf):
flags = super(GccFlags, self).getDebugFlags(conf)
@@ -196,6 +204,7 @@
flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106
return flags
+
class ClangFlags(GccBasicFlags):
def getGeneralFlags(self, conf):
flags = super(ClangFlags, self).getGeneralFlags(conf)