Skip to content

Commit 4a748bf

Browse files
committed
SCons: Add CPPEXTPATH for external includes
1 parent f3deed0 commit 4a748bf

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

tools/godotcpp.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import platform
33
import sys
44

5+
from SCons import __version__ as scons_raw_version
56
from SCons.Action import Action
67
from SCons.Builder import Builder
78
from SCons.Errors import UserError
@@ -380,6 +381,8 @@ def options(opts, env):
380381

381382

382383
def generate(env):
384+
env.scons_version = env._get_major_minor_revision(scons_raw_version)
385+
383386
# Default num_jobs to local cpu count if not user specified.
384387
# SCons has a peculiarity where user-specified options won't be overridden
385388
# by SetOption, so we can rely on this to know if we should use our default.
@@ -437,6 +440,17 @@ def generate(env):
437440
else: # Release
438441
opt_level = "speed"
439442

443+
# Allow marking includes as external/system to avoid raising warnings.
444+
if env.scons_version < (4, 2):
445+
env["_CPPEXTINCFLAGS"] = "${_concat(EXTINCPREFIX, CPPEXTPATH, EXTINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}"
446+
else:
447+
env["_CPPEXTINCFLAGS"] = (
448+
"${_concat(EXTINCPREFIX, CPPEXTPATH, EXTINCSUFFIX, __env__, RDirs, TARGET, SOURCE, affect_signature=False)}"
449+
)
450+
env["CPPEXTPATH"] = []
451+
env["EXTINCPREFIX"] = "-isystem "
452+
env["EXTINCSUFFIX"] = ""
453+
440454
env["optimize"] = ARGUMENTS.get("optimize", opt_level)
441455
env["debug_symbols"] = get_cmdline_bool("debug_symbols", env.dev_build)
442456

tools/windows.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ def generate(env):
130130
if env["silence_msvc"] and not env.GetOption("clean"):
131131
silence_msvc(env)
132132

133+
env.AppendUnique(CCFLAGS=["/experimental:external", "/external:anglebrackets", "/external:W0"])
134+
env["EXTINCPREFIX"] = "/external:I"
135+
133136
elif (sys.platform == "win32" or sys.platform == "msys") and not env["mingw_prefix"]:
134137
env["use_mingw"] = True
135138
mingw.generate(env)

0 commit comments

Comments
 (0)