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