Skip to content

Commit

Permalink
SCons: Improve registration of compilation_db tool, check version
Browse files Browse the repository at this point in the history
There's a builtin `toolpath` option we can use for that, so no need to hack
around a custom `scons_site` path.

The script requires SCons 3.1.1 or later, so we enable it conditionally.

Follow-up to godotengine#32848.

(cherry picked from commit 22c718a)
  • Loading branch information
akien-mga authored and h committed Nov 10, 2020
1 parent e516b08 commit 2ba5e04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,13 @@ if selected_platform in platform_list:
else:
env = env_base.Clone()

# Custom tools are loaded automatically by SCons from site_scons/site_tools,
# but we want to use a different folder, so we register it manually.
from SCons.Script.Main import _load_site_scons_dir
# Compilation DB requires SCons 3.1.1+.
from SCons import __version__ as scons_raw_version

_load_site_scons_dir(".", "misc/scons")

env.Tool("compilation_db")
env.Alias("compiledb", env.CompilationDatabase("compile_commands.json"))
scons_ver = env._get_major_minor_revision(scons_raw_version)
if scons_ver >= (3, 1, 1):
env.Tool("compilation_db", toolpath=["misc/scons"])
env.Alias("compiledb", env.CompilationDatabase("compile_commands.json"))

if env['dev']:
env['verbose'] = True
Expand Down
File renamed without changes.

0 comments on commit 2ba5e04

Please sign in to comment.