@@ -267,6 +267,11 @@ opts.Add(
267267)
268268opts .Add (BoolVariable ("use_precise_math_checks" , "Math checks use very precise epsilon (debug option)" , False ))
269269opts .Add (BoolVariable ("strict_checks" , "Enforce stricter checks (debug option)" , False ))
270+ opts .Add (
271+ BoolVariable (
272+ "limit_transitive_includes" , "Attempt to limit the amount of transitive includes in system headers" , True
273+ )
274+ )
270275opts .Add (BoolVariable ("scu_build" , "Use single compilation unit build" , False ))
271276opts .Add ("scu_limit" , "Max includes per SCU file when using scu_build (determines RAM use)" , "0" )
272277opts .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):
778783 if sys .platform == "win32" :
779784 env .AppendUnique (CCFLAGS = ["-fansi-escape-codes" ])
780785
786+ # Attempt to reduce transitive includes.
787+ if env ["limit_transitive_includes" ]:
788+ if not env .msvc :
789+ # FIXME: This define only affects `libcpp`, but lack of guaranteed, granular detection means
790+ # we're better off applying it universally.
791+ env .AppendUnique (CPPDEFINES = ["_LIBCPP_REMOVE_TRANSITIVE_INCLUDES" ])
792+
781793# Set optimize and debug_symbols flags.
782794# "custom" means do nothing and let users set their own optimization flags.
783795# Needs to happen after configure to have `env.msvc` defined.
0 commit comments