Merge pull request #40 from pupil1337/clean-compiledb

pull/57/merge
Patrick Exner (FlameLizard) 2024-11-05 00:34:17 +01:00 committed by GitHub
commit 25b371e573
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 33 deletions

View File

@ -5,15 +5,6 @@ import sys
from methods import print_error from methods import print_error
def normalize_path(val, env):
return val if os.path.isabs(val) else os.path.join(env.Dir("#").abspath, val)
def validate_parent_dir(key, val, env):
if not os.path.isdir(normalize_path(os.path.dirname(val), env)):
raise UserError("'%s' is not a directory: %s" % (key, os.path.dirname(val)))
libname = "EXTENSION-NAME" libname = "EXTENSION-NAME"
projectdir = "demo" projectdir = "demo"
@ -23,33 +14,11 @@ customs = ["custom.py"]
customs = [os.path.abspath(path) for path in customs] customs = [os.path.abspath(path) for path in customs]
opts = Variables(customs, ARGUMENTS) opts = Variables(customs, ARGUMENTS)
opts.Add(
BoolVariable(
key="compiledb",
help="Generate compilation DB (`compile_commands.json`) for external tools",
default=localEnv.get("compiledb", False),
)
)
opts.Add(
PathVariable(
key="compiledb_file",
help="Path to a custom `compile_commands.json` file",
default=localEnv.get("compiledb_file", "compile_commands.json"),
validator=validate_parent_dir,
)
)
opts.Update(localEnv) opts.Update(localEnv)
Help(opts.GenerateHelpText(localEnv)) Help(opts.GenerateHelpText(localEnv))
env = localEnv.Clone() env = localEnv.Clone()
env["compiledb"] = False
env.Tool("compilation_db")
compilation_db = env.CompilationDatabase(
normalize_path(localEnv["compiledb_file"], localEnv)
)
env.Alias("compiledb", compilation_db)
submodule_initialized = False submodule_initialized = False
dir_name = 'godot-cpp' dir_name = 'godot-cpp'
@ -92,6 +61,4 @@ library = env.SharedLibrary(
copy = env.InstallAs("{}/bin/{}/{}lib{}".format(projectdir, env["platform"], filepath, file), library) copy = env.InstallAs("{}/bin/{}/{}lib{}".format(projectdir, env["platform"], filepath, file), library)
default_args = [library, copy] default_args = [library, copy]
if localEnv.get("compiledb", False):
default_args += [compilation_db]
Default(*default_args) Default(*default_args)