@@ -165,14 +165,21 @@ if host_platform == "windows" and env["platform"] != "android":
165
165
166
166
opts .Update (env )
167
167
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
+
168
175
if env ["target" ] == "debug" :
169
176
env .Append (CPPDEFINES = ["DEBUG_ENABLED" , "DEBUG_METHODS_ENABLED" ])
170
177
171
178
if env ["platform" ] == "linux" or env ["platform" ] == "freebsd" :
172
179
if env ["use_llvm" ]:
173
180
env ["CXX" ] = "clang++"
174
181
175
- env .Append (CCFLAGS = ["-fPIC" , "-std=c++17" , "- Wwrite-strings" ])
182
+ env .Append (CCFLAGS = ["-fPIC" , "-Wwrite-strings" ])
176
183
env .Append (LINKFLAGS = ["-Wl,-R,'$$ORIGIN'" ])
177
184
178
185
if env ["target" ] == "debug" :
@@ -201,8 +208,6 @@ elif env["platform"] == "osx":
201
208
env .Append (LINKFLAGS = ["-arch" , env ["macos_arch" ]])
202
209
env .Append (CCFLAGS = ["-arch" , env ["macos_arch" ]])
203
210
204
- env .Append (CCFLAGS = ["-std=c++17" ])
205
-
206
211
if env ["macos_deployment_target" ] != "default" :
207
212
env .Append (CCFLAGS = ["-mmacosx-version-min=" + env ["macos_deployment_target" ]])
208
213
env .Append (LINKFLAGS = ["-mmacosx-version-min=" + env ["macos_deployment_target" ]])
@@ -246,7 +251,7 @@ elif env["platform"] == "ios":
246
251
env ["AR" ] = compiler_path + "ar"
247
252
env ["RANLIB" ] = compiler_path + "ranlib"
248
253
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 ])
250
255
env .Append (
251
256
LINKFLAGS = [
252
257
"-arch" ,
@@ -292,14 +297,16 @@ elif env["platform"] == "windows":
292
297
# Don't Clone the environment. Because otherwise, SCons will pick up msvc stuff.
293
298
env = Environment (ENV = os .environ , tools = ["mingw" ])
294
299
opts .Update (env )
295
- # env = env.Clone(tools=['mingw'])
300
+
301
+ # Still need to use C++17.
302
+ env .Append (CCFLAGS = ["-std=c++17" ])
296
303
297
304
env ["SPAWN" ] = mySpawn
298
305
299
306
# Native or cross-compilation using MinGW
300
307
if host_platform == "linux" or host_platform == "freebsd" or host_platform == "osx" or env ["use_mingw" ]:
301
308
# 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" ])
303
310
env .Append (
304
311
LINKFLAGS = [
305
312
"--static" ,
0 commit comments