Always require C++17. Shuold fix other platforms.

pull/636/head
Fabio Alessandrelli 2021-09-29 23:00:24 +02:00
parent 75b180d2cd
commit cf3fcab6b4
1 changed files with 13 additions and 6 deletions

View File

@ -165,6 +165,13 @@ if host_platform == "windows" and env["platform"] != "android":
opts.Update(env) opts.Update(env)
# Require C++17
if host_platform == "windows" and env["platform"] == "windows" and not env["use_mingw"]:
# MSVC
env.Append(CCFLAGS=["/std:c++17"])
else:
env.Append(CCFLAGS=["-std=c++17"])
if env["target"] == "debug": if env["target"] == "debug":
env.Append(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_METHODS_ENABLED"]) env.Append(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_METHODS_ENABLED"])
@ -172,7 +179,7 @@ if env["platform"] == "linux" or env["platform"] == "freebsd":
if env["use_llvm"]: if env["use_llvm"]:
env["CXX"] = "clang++" env["CXX"] = "clang++"
env.Append(CCFLAGS=["-fPIC", "-std=c++17", "-Wwrite-strings"]) env.Append(CCFLAGS=["-fPIC", "-Wwrite-strings"])
env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"]) env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"])
if env["target"] == "debug": if env["target"] == "debug":
@ -201,8 +208,6 @@ elif env["platform"] == "osx":
env.Append(LINKFLAGS=["-arch", env["macos_arch"]]) env.Append(LINKFLAGS=["-arch", env["macos_arch"]])
env.Append(CCFLAGS=["-arch", env["macos_arch"]]) env.Append(CCFLAGS=["-arch", env["macos_arch"]])
env.Append(CCFLAGS=["-std=c++17"])
if env["macos_deployment_target"] != "default": if env["macos_deployment_target"] != "default":
env.Append(CCFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]]) env.Append(CCFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]])
env.Append(LINKFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]]) env.Append(LINKFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]])
@ -246,7 +251,7 @@ elif env["platform"] == "ios":
env["AR"] = compiler_path + "ar" env["AR"] = compiler_path + "ar"
env["RANLIB"] = compiler_path + "ranlib" env["RANLIB"] = compiler_path + "ranlib"
env.Append(CCFLAGS=["-std=c++17", "-arch", env["ios_arch"], "-isysroot", sdk_path]) env.Append(CCFLAGS=["-arch", env["ios_arch"], "-isysroot", sdk_path])
env.Append( env.Append(
LINKFLAGS=[ LINKFLAGS=[
"-arch", "-arch",
@ -292,14 +297,16 @@ elif env["platform"] == "windows":
# Don't Clone the environment. Because otherwise, SCons will pick up msvc stuff. # Don't Clone the environment. Because otherwise, SCons will pick up msvc stuff.
env = Environment(ENV=os.environ, tools=["mingw"]) env = Environment(ENV=os.environ, tools=["mingw"])
opts.Update(env) opts.Update(env)
# env = env.Clone(tools=['mingw'])
# Still need to use C++17.
env.Append(CCFLAGS=["-std=c++17"])
env["SPAWN"] = mySpawn env["SPAWN"] = mySpawn
# Native or cross-compilation using MinGW # Native or cross-compilation using MinGW
if host_platform == "linux" or host_platform == "freebsd" or host_platform == "osx" or env["use_mingw"]: if host_platform == "linux" or host_platform == "freebsd" or host_platform == "osx" or env["use_mingw"]:
# These options are for a release build even using target=debug # These options are for a release build even using target=debug
env.Append(CCFLAGS=["-O3", "-std=c++17", "-Wwrite-strings"]) env.Append(CCFLAGS=["-O3", "-Wwrite-strings"])
env.Append( env.Append(
LINKFLAGS=[ LINKFLAGS=[
"--static", "--static",