Skip to content

Commit cf3fcab

Browse files
committed
Always require C++17. Shuold fix other platforms.
1 parent 75b180d commit cf3fcab

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

SConstruct

+13-6
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,21 @@ if host_platform == "windows" and env["platform"] != "android":
165165

166166
opts.Update(env)
167167

168+
# Require C++17
169+
if host_platform == "windows" and env["platform"] == "windows" and not env["use_mingw"]:
170+
# MSVC
171+
env.Append(CCFLAGS=["/std:c++17"])
172+
else:
173+
env.Append(CCFLAGS=["-std=c++17"])
174+
168175
if env["target"] == "debug":
169176
env.Append(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_METHODS_ENABLED"])
170177

171178
if env["platform"] == "linux" or env["platform"] == "freebsd":
172179
if env["use_llvm"]:
173180
env["CXX"] = "clang++"
174181

175-
env.Append(CCFLAGS=["-fPIC", "-std=c++17", "-Wwrite-strings"])
182+
env.Append(CCFLAGS=["-fPIC", "-Wwrite-strings"])
176183
env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"])
177184

178185
if env["target"] == "debug":
@@ -201,8 +208,6 @@ elif env["platform"] == "osx":
201208
env.Append(LINKFLAGS=["-arch", env["macos_arch"]])
202209
env.Append(CCFLAGS=["-arch", env["macos_arch"]])
203210

204-
env.Append(CCFLAGS=["-std=c++17"])
205-
206211
if env["macos_deployment_target"] != "default":
207212
env.Append(CCFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]])
208213
env.Append(LINKFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]])
@@ -246,7 +251,7 @@ elif env["platform"] == "ios":
246251
env["AR"] = compiler_path + "ar"
247252
env["RANLIB"] = compiler_path + "ranlib"
248253

249-
env.Append(CCFLAGS=["-std=c++17", "-arch", env["ios_arch"], "-isysroot", sdk_path])
254+
env.Append(CCFLAGS=["-arch", env["ios_arch"], "-isysroot", sdk_path])
250255
env.Append(
251256
LINKFLAGS=[
252257
"-arch",
@@ -292,14 +297,16 @@ elif env["platform"] == "windows":
292297
# Don't Clone the environment. Because otherwise, SCons will pick up msvc stuff.
293298
env = Environment(ENV=os.environ, tools=["mingw"])
294299
opts.Update(env)
295-
# env = env.Clone(tools=['mingw'])
300+
301+
# Still need to use C++17.
302+
env.Append(CCFLAGS=["-std=c++17"])
296303

297304
env["SPAWN"] = mySpawn
298305

299306
# Native or cross-compilation using MinGW
300307
if host_platform == "linux" or host_platform == "freebsd" or host_platform == "osx" or env["use_mingw"]:
301308
# These options are for a release build even using target=debug
302-
env.Append(CCFLAGS=["-O3", "-std=c++17", "-Wwrite-strings"])
309+
env.Append(CCFLAGS=["-O3", "-Wwrite-strings"])
303310
env.Append(
304311
LINKFLAGS=[
305312
"--static",

0 commit comments

Comments
 (0)