From 1372ca48ef841e548241552671831ac1736e91e6 Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 8 Dec 2016 10:43:25 +0100 Subject: [PATCH] SConstruct - require c++14 --- SConstruct | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/SConstruct b/SConstruct index e88e0b373..1498ee4b1 100644 --- a/SConstruct +++ b/SConstruct @@ -41,8 +41,8 @@ ICU_LIBS_DEFAULT='/usr/' DEFAULT_CC = "cc" DEFAULT_CXX = "c++" -DEFAULT_CXX11_CXXFLAGS = " -std=c++14" -DEFAULT_CXX11_LINKFLAGS = "" +DEFAULT_CXX14_CXXFLAGS = " -std=c++14" +DEFAULT_CXX14_LINKFLAGS = "" if sys.platform == 'darwin': # homebrew default ICU_INCLUDES_DEFAULT='/usr/local/opt/icu4c/include/' @@ -1037,12 +1037,12 @@ int main() return True return False -def supports_cxx11(context,silent=False): +def supports_cxx14(context,silent=False): ret = context.TryRun(""" int main() { -#if __cplusplus >= 201103 +#if __cplusplus >= 201402L return 0; #else return -1; @@ -1051,7 +1051,7 @@ int main() """, '.cpp') if not silent: - context.Message('Checking if compiler (%s) supports -std=c++11 flag... ' % context.env.get('CXX','CXX')) + context.Message('Checking if compiler (%s) supports -std=c++14 flag... ' % context.env.get('CXX','CXX')) if silent: context.did_show_result=1 context.Result(ret[0]) @@ -1080,7 +1080,7 @@ conf_tests = { 'prioritize_paths' : prioritize_paths, 'harfbuzz_with_freetype_support': harfbuzz_with_freetype_support, 'boost_regex_has_icu' : boost_regex_has_icu, 'sqlite_has_rtree' : sqlite_has_rtree, - 'supports_cxx11' : supports_cxx11, + 'supports_cxx14' : supports_cxx14, 'CheckBoostScopedEnum' : CheckBoostScopedEnum, } @@ -1213,13 +1213,13 @@ if not preconfigured: # set any custom cxxflags and ldflags to come first if sys.platform == 'darwin' and not env['HOST']: - DEFAULT_CXX11_CXXFLAGS += ' -stdlib=libc++' - DEFAULT_CXX11_LINKFLAGS = ' -stdlib=libc++' + DEFAULT_CXX14_CXXFLAGS += ' -stdlib=libc++' + DEFAULT_CXX14_LINKFLAGS = ' -stdlib=libc++' env.Append(CPPDEFINES = env['CUSTOM_DEFINES']) - env.Append(CXXFLAGS = DEFAULT_CXX11_CXXFLAGS) + env.Append(CXXFLAGS = DEFAULT_CXX14_CXXFLAGS) env.Append(CXXFLAGS = env['CUSTOM_CXXFLAGS']) env.Append(CFLAGS = env['CUSTOM_CFLAGS']) - env.Append(LINKFLAGS = DEFAULT_CXX11_LINKFLAGS) + env.Append(LINKFLAGS = DEFAULT_CXX14_LINKFLAGS) env.Append(LINKFLAGS = env['CUSTOM_LDFLAGS']) ### platform specific bits @@ -1353,9 +1353,9 @@ if not preconfigured: if env['PRIORITIZE_LINKING']: conf.prioritize_paths(silent=True) - # test for C++11 support, which is required - if not env['HOST'] and not conf.supports_cxx11(): - color_print(1,"C++ compiler does not support C++11 standard (-std=c++11), which is required. Please upgrade your compiler") + # test for C++14 support, which is required + if not env['HOST'] and not conf.supports_cxx14(): + color_print(1,"C++ compiler does not support C++14 standard (-std=c++14), which is required. Please upgrade your compiler") Exit(1) if not env['HOST']: