Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2a8d218

Browse files
authoredApr 16, 2025··
Merge pull request #1756 from Repiteo/scons/external-includes
SCons: Add `CPPEXTPATH` for external includes
2 parents 70d8ff0 + 30bfa6f commit 2a8d218

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ def generate(env):
130130
if env["silence_msvc"] and not env.GetOption("clean"):
131131
silence_msvc(env)
132132

133+
if not env["use_llvm"]:
134+
env.AppendUnique(CCFLAGS=["/experimental:external", "/external:anglebrackets"])
135+
env.AppendUnique(CCFLAGS=["/external:W0"])
136+
env["EXTINCPREFIX"] = "/external:I"
137+
133138
elif (sys.platform == "win32" or sys.platform == "msys") and not env["mingw_prefix"]:
134139
env["use_mingw"] = True
135140
mingw.generate(env)

0 commit comments

Comments
 (0)
Please sign in to comment.