SConstruct - require c++14
This commit is contained in:
parent
fe7e9a7dc5
commit
1372ca48ef
1 changed files with 13 additions and 13 deletions
26
SConstruct
26
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']:
|
||||
|
|
Loading…
Reference in a new issue