Enable C++17.

This commit is contained in:
David Anderson 2023-10-13 15:21:54 -07:00 committed by Nick Hastings
parent 1ba7024a3a
commit ae4e043c3e
2 changed files with 13 additions and 12 deletions

View File

@ -251,14 +251,14 @@ class SMConfig(object):
def configure_cxx(self, cxx): def configure_cxx(self, cxx):
if cxx.family == 'msvc': if cxx.family == 'msvc':
if cxx.version < 1900: if cxx.version < 1914:
raise Exception('Only MSVC 2015 and later are supported, c++14 support is required.') raise Exception('Only MSVC 2017 15.7 and later are supported, full C++17 support is required.')
if cxx.family == 'gcc': elif cxx.family == 'gcc':
if cxx.version < 'gcc-4.9': if cxx.version < 'gcc-9':
raise Exception('Only GCC versions 4.9 or greater are supported, c++14 support is required.') raise Exception('Only GCC versions 9 or later are supported, full C++17 support is required.')
if cxx.family == 'clang': elif cxx.family == 'clang':
if cxx.version < 'clang-3.4': if cxx.version < 'clang-5':
raise Exception('Only clang versions 3.4 or greater are supported, c++14 support is required.') raise Exception('Only clang versions 5 or later are supported, full C++17 support is required.')
if cxx.like('gcc'): if cxx.like('gcc'):
self.configure_gcc(cxx) self.configure_gcc(cxx)
@ -317,15 +317,13 @@ class SMConfig(object):
'-fvisibility=hidden', '-fvisibility=hidden',
] ]
if cxx.version == 'apple-clang-6.0' or cxx.version == 'clang-3.4': cxx.cxxflags += ['-std=c++17']
cxx.cxxflags += ['-std=c++1y']
else:
cxx.cxxflags += ['-std=c++14']
cxx.cxxflags += [ cxx.cxxflags += [
'-fno-threadsafe-statics', '-fno-threadsafe-statics',
'-Wno-non-virtual-dtor', '-Wno-non-virtual-dtor',
'-Wno-overloaded-virtual', '-Wno-overloaded-virtual',
'-Wno-register',
'-fvisibility-inlines-hidden', '-fvisibility-inlines-hidden',
] ]
@ -402,6 +400,7 @@ class SMConfig(object):
'/EHsc', '/EHsc',
'/GR-', '/GR-',
'/TP', '/TP',
'/std:c++17',
] ]
cxx.linkflags += [ cxx.linkflags += [
'kernel32.lib', 'kernel32.lib',

View File

@ -37,6 +37,8 @@ project.sources += [
for sdk_name in SM.sdks: for sdk_name in SM.sdks:
sdk = SM.sdks[sdk_name] sdk = SM.sdks[sdk_name]
if sdk.name in ['mock']:
continue
for cxx in builder.targets: for cxx in builder.targets:
if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]: if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]: