Skip to content

Commit

Permalink
Clean up unnecessary compiledb parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
pupil1337 committed Sep 28, 2024
1 parent 0536d63 commit 6f1902d
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
import os


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"
projectdir = "demo"

Expand All @@ -20,33 +11,11 @@ customs = ["custom.py"]
customs = [os.path.abspath(path) for path in customs]

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)

Help(opts.GenerateHelpText(localEnv))

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)

env = SConscript("godot-cpp/SConstruct", {"env": env, "customs": customs})

Expand Down Expand Up @@ -75,6 +44,4 @@ library = env.SharedLibrary(
copy = env.InstallAs("{}/bin/{}/lib{}".format(projectdir, env["platform"], file), library)

default_args = [library, copy]
if localEnv.get("compiledb", False):
default_args += [compilation_db]
Default(*default_args)

0 comments on commit 6f1902d

Please sign in to comment.