Skip to content

Commit 5b151d4

Browse files
committed
SCons: Add CPPEXTPATH for external includes
1 parent f3deed0 commit 5b151d4

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tools/godotcpp.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
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
89
from SCons.Script import ARGUMENTS
910
from SCons.Tool import Tool
11+
from SCons.Util import CLVar
1012
from SCons.Variables import BoolVariable, EnumVariable, PathVariable
1113
from SCons.Variables.BoolVariable import _text2bool
1214

@@ -380,6 +382,8 @@ def options(opts, env):
380382

381383

382384
def generate(env):
385+
env.scons_version = env._get_major_minor_revision(scons_raw_version)
386+
383387
# Default num_jobs to local cpu count if not user specified.
384388
# SCons has a peculiarity where user-specified options won't be overridden
385389
# by SetOption, so we can rely on this to know if we should use our default.
@@ -437,6 +441,17 @@ def generate(env):
437441
else: # Release
438442
opt_level = "speed"
439443

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

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: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)