From 1cfd40fa50ef4e6a80850af9a8ced8f1ed178c20 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 3 Nov 2017 12:48:38 -0700 Subject: [PATCH] Turn on C++11 mode for non-Darwin unix builds (assumes gcc) --- build.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build.py b/build.py index 36c1587e..1baf4768 100755 --- a/build.py +++ b/build.py @@ -770,6 +770,20 @@ def checkCompiler(quiet=False): os.environ['LIB'] = _b(env['lib']) os.environ['LIBPATH'] = _b(env['libpath']) + # NOTE: SIP is now generating code with scoped-enums. Older linux + # platforms like what we're using for builds, and also TravisCI for + # example, are using GCC versions that are still defaulting to C++98, + # so this flag is needed to turn on the C++11 mode. If this flag + # causes problems with other non-Windows, non-Darwin compilers then + # we'll need to make this a little smarter about what flag (if any) + # needs to be used. + if not isWindows and not isDarwin: + stdflag = '-std=c++11' + curflags = os.environ.get('CXXFLAGS', '') + if stdflag not in curflags: + os.environ['CXXFLAGS'] = '{} {}'.format(stdflag, curflags) + #print('**** Using CXXFLAGS:', os.environ.get('CXXFLAGS', '')) + def getWafBuildBase(): base = posixjoin('build', 'waf', PYVER)