[RTEMS Tools 1/1] trace/wscript: Improve C++ standard selection
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Jan 19 06:58:52 UTC 2024
Use the latest C++ standard available up to C++20.
Close #4908.
Close #4965.
---
trace/wscript | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/trace/wscript b/trace/wscript
index 0c0e4b4..b632291 100644
--- a/trace/wscript
+++ b/trace/wscript
@@ -45,7 +45,14 @@ def configure(conf):
if conf.check(header_name='zlib.h', features='cxx', mandatory=False):
conf.check_cxx(lib = 'z')
conf.check_cxx(lib = 'ws2_32', mandatory=False)
- conf.check_cxx(cxxflags='-std=c++14', mandatory=False, define_name="HAVE_STD_CXX14")
+ if conf.check_cxx(cxxflags='-std=c++20', mandatory=False, define_name="HAVE_STD_CXX20"):
+ conf.env.append_value('CXXFLAGS', '-std=c++20')
+ elif conf.check_cxx(cxxflags='-std=c++17', mandatory=False, define_name="HAVE_STD_CXX17"):
+ conf.env.append_value('CXXFLAGS', '-std=c++17')
+ elif conf.check_cxx(cxxflags='-std=c++14', mandatory=False, define_name="HAVE_STD_CXX14"):
+ conf.env.append_value('CXXFLAGS', '-std=c++14')
+ else:
+ conf.env.append_value('CXXFLAGS', '-std=c++11')
conf.write_config_header('config.h')
def build(bld):
@@ -62,9 +69,14 @@ def build(bld):
conf['optflags'] = bld.env.C_OPTS
cstd = '-std=c99'
conf['cflags'] = [cstd] + ['-pipe', '-g'] + conf['optflags']
- cxxstd = '-std=c++11'
- if bld.env.HAVE_STD_CXX14:
+ if bld.env.HAVE_STD_CXX20:
+ cxxstd = '-std=c++20'
+ elif bld.env.HAVE_STD_CXX17:
+ cxxstd = '-std=c++17'
+ elif bld.env.HAVE_STD_CXX14:
cxxstd = '-std=c++14'
+ else:
+ cxxstd = '-std=c++11'
conf['cxxflags'] = [cxxstd] + ['-pipe', '-g'] + conf['optflags']
conf['linkflags'] = ['-g']
conf['lib'] = []
--
2.35.3
More information about the devel
mailing list