diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-02-08 21:46:47 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-02-09 09:20:53 +0100 |
commit | f94df6fa2b59f688761988362607ee40455e8e3b (patch) | |
tree | 38e90e27b17c3f22543d350a58f4e48a8eeb6005 | |
parent | 3cb9dc78d6001af550f125bb6f8b7da27a291add (diff) |
SCons: Make compilation database generation optional
Saves around 3 s on incremental rebuilds to have it disabled by default.
Can be enabled with `compiledb=yes`.
-rw-r--r-- | SConstruct | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/SConstruct b/SConstruct index 127fefeb27..a27e5490a5 100644 --- a/SConstruct +++ b/SConstruct @@ -181,6 +181,7 @@ opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loade opts.Add(BoolVariable("dev", "If yes, alias for verbose=yes warnings=extra werror=yes", False)) opts.Add(BoolVariable("tests", "Build the unit tests", False)) opts.Add(BoolVariable("fast_unsafe", "Enable unsafe options for faster rebuilds", False)) +opts.Add(BoolVariable("compiledb", "Generate compilation DB (`compile_commands.json`) for external tools", False)) opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False)) opts.Add(BoolVariable("progress", "Show a progress indicator during compilation", True)) opts.Add(EnumVariable("warnings", "Level of compilation warnings", "all", ("extra", "all", "moderate", "no"))) @@ -397,14 +398,15 @@ if selected_platform in platform_list: else: env = env_base.Clone() - # Generating the compilation DB (`compile_commands.json`) requires SCons 4.0.0 or later. - from SCons import __version__ as scons_raw_version + if env["compiledb"]: + # Generating the compilation DB (`compile_commands.json`) requires SCons 4.0.0 or later. + from SCons import __version__ as scons_raw_version - scons_ver = env._get_major_minor_revision(scons_raw_version) + scons_ver = env._get_major_minor_revision(scons_raw_version) - if scons_ver >= (4, 0, 0): - env.Tool("compilation_db") - env.Alias("compiledb", env.CompilationDatabase()) + if scons_ver >= (4, 0, 0): + env.Tool("compilation_db") + env.Alias("compiledb", env.CompilationDatabase()) # 'dev' and 'production' are aliases to set default options if they haven't been set # manually by the user. @@ -829,6 +831,7 @@ elif selected_platform != "": # The following only makes sense when the 'env' is defined, and assumes it is. if "env" in locals(): + # FIXME: This method mixes both cosmetic progress stuff and cache handling... methods.show_progress(env) # TODO: replace this with `env.Dump(format="json")` # once we start requiring SCons 4.0 as min version. |