diff options
author | lawnjelly <lawnjelly@gmail.com> | 2023-05-17 16:22:26 +0100 |
---|---|---|
committer | lawnjelly <lawnjelly@gmail.com> | 2023-06-06 15:36:51 +0100 |
commit | b69c8b47916e4b3511c1aeff254ebfa6deef37ba (patch) | |
tree | 121f1601353f788375749abd834bfb5515afa843 /SConstruct | |
parent | 543750a1b3f5696f9ba8e91cb49dc7db05d2ae62 (diff) | |
download | redot-engine-b69c8b47916e4b3511c1aeff254ebfa6deef37ba.tar.gz |
Single Compilation Unit build.
Adds support for simple SCU build (DEV_ENABLED only).
This speeds up compilation by compiling multiple cpp files within a single translation unit.
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct index 4e67fb7117..c383029eff 100644 --- a/SConstruct +++ b/SConstruct @@ -55,6 +55,7 @@ _helper_module("modules.modules_builders", "modules/modules_builders.py") import methods import glsl_builders import gles3_builders +import scu_builders from platform_methods import architectures, architecture_aliases if ARGUMENTS.get("target", "editor") == "editor": @@ -223,6 +224,7 @@ opts.Add( "", ) opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise epsilon (debug option)", False)) +opts.Add(EnumVariable("scu_build", "Use single compilation unit build", "none", ("none", "dev", "all"))) # Thirdparty libraries opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", True)) @@ -428,14 +430,20 @@ if env_base.debug_features: # to give *users* extra debugging information for their game development. env_base.Append(CPPDEFINES=["DEBUG_ENABLED"]) + if env_base.dev_build: # DEV_ENABLED enables *engine developer* code which should only be compiled for those # working on the engine itself. env_base.Append(CPPDEFINES=["DEV_ENABLED"]) + env_base["use_scu"] = env_base["scu_build"] in ("dev", "all") else: # Disable assert() for production targets (only used in thirdparty code). env_base.Append(CPPDEFINES=["NDEBUG"]) + # SCU builds currently use a lot of compiler memory + # in release builds, so disallow outside of DEV builds unless "all" is set. + env_base["use_scu"] = env_base["scu_build"] == "all" + # SCons speed optimization controlled by the `fast_unsafe` option, which provide # more than 10 s speed up for incremental rebuilds. # Unsafe as they reduce the certainty of rebuilding all changed files, so it's @@ -550,6 +558,10 @@ if selected_platform in platform_list: # LTO "auto" means we handle the preferred option in each platform detect.py. env["lto"] = ARGUMENTS.get("lto", "auto") + # Run SCU file generation script if in a SCU build. + if env["use_scu"]: + methods.set_scu_folders(scu_builders.generate_scu_files(env["verbose"], env_base.dev_build == False)) + # Must happen after the flags' definition, as configure is when most flags # are actually handled to change compile options, etc. detect.configure(env) |