Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to create compile_commands.json, lifted from godot-cpp. #25

Merged
merged 1 commit into from
Feb 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
gdextension_interface.h
extension_api.json

# Build tools
/docs/*build/


compile_commands.json
20 changes: 20 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,23 @@ opts.Add(
)


opts.Add(
BoolVariable(
key="compiledb",
help="Generate compilation DB (`compile_commands.json`) for external tools",
default=env.get("compiledb", False),
)
)

opts.Add(
PathVariable(
key="compiledb_file",
help="Path to a custom `compile_commands.json` file",
default=env.get("compiledb_file", "compile_commands.json"),
validator=build_utils.validate_parent_dir,
)
)

# for now there's no distinction between build targets, so always use template_release
env['target'] = 'template_release'

Expand Down Expand Up @@ -267,6 +284,9 @@ env.Alias("archive_importer_r_string", [
)
])

env.Tool("compilation_db")
env.Alias("compiledb", env.CompilationDatabase(build_utils.normalize_path(env["compiledb_file"], env)))

if not env.get('skip_module_embed', False):
# pkg_files = Install('src', files)
godot_zip = Zip(
Expand Down