SCons: Remove transitive includes in libc++

This commit is contained in:
Thaddeus Crews 2025-10-17 11:57:28 -05:00
parent 235a32ad11
commit ad02128137
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
17 changed files with 114 additions and 2 deletions

View file

@ -267,6 +267,11 @@ opts.Add(
)
opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise epsilon (debug option)", False))
opts.Add(BoolVariable("strict_checks", "Enforce stricter checks (debug option)", False))
opts.Add(
BoolVariable(
"limit_transitive_includes", "Attempt to limit the amount of transitive includes in system headers", True
)
)
opts.Add(BoolVariable("scu_build", "Use single compilation unit build", False))
opts.Add("scu_limit", "Max includes per SCU file when using scu_build (determines RAM use)", "0")
opts.Add(BoolVariable("engine_update_check", "Enable engine update checks in the Project Manager", True))
@ -778,6 +783,13 @@ elif methods.using_clang(env) or methods.using_emcc(env):
if sys.platform == "win32":
env.AppendUnique(CCFLAGS=["-fansi-escape-codes"])
# Attempt to reduce transitive includes.
if env["limit_transitive_includes"]:
if not env.msvc:
# FIXME: This define only affects `libcpp`, but lack of guaranteed, granular detection means
# we're better off applying it universally.
env.AppendUnique(CPPDEFINES=["_LIBCPP_REMOVE_TRANSITIVE_INCLUDES"])
# Set optimize and debug_symbols flags.
# "custom" means do nothing and let users set their own optimization flags.
# Needs to happen after configure to have `env.msvc` defined.