More thorough compile_commands.json generation
This commit is contained in:
22
build.py
22
build.py
@@ -86,6 +86,25 @@ def expand_json_file(sourcefile, outputfile, config):
|
|||||||
expanded = expand_json(data, vars(config))
|
expanded = expand_json(data, vars(config))
|
||||||
Path(outputfile).write_text(json.dumps(expanded, indent=4))
|
Path(outputfile).write_text(json.dumps(expanded, indent=4))
|
||||||
|
|
||||||
|
#
|
||||||
|
# Extracting a generated module file.
|
||||||
|
#
|
||||||
|
|
||||||
|
def cpp_files_included_by(module):
|
||||||
|
"""
|
||||||
|
Given the name of a Module.XYZ.cpp file generated by unreal
|
||||||
|
build tool, scan the module for include directives that include
|
||||||
|
another C++ file. Produce a list of these C++ files.
|
||||||
|
"""
|
||||||
|
result = []
|
||||||
|
for line in Path(module).read_text().splitlines():
|
||||||
|
if line.startswith("#include "):
|
||||||
|
file = line[9:].strip().strip('"')
|
||||||
|
if file.endswith(".cpp"):
|
||||||
|
result.append(file)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Applying patches to files with DOS line endings.
|
# Applying patches to files with DOS line endings.
|
||||||
#
|
#
|
||||||
@@ -293,6 +312,9 @@ def build_intellisense_database_for_clangd():
|
|||||||
cpp = rsp.removesuffix(".o.rsp")
|
cpp = rsp.removesuffix(".o.rsp")
|
||||||
args = [clang, "@"+rsp]
|
args = [clang, "@"+rsp]
|
||||||
ccjson.append({ "file" : cpp, "arguments":args, "directory":ccdir })
|
ccjson.append({ "file" : cpp, "arguments":args, "directory":ccdir })
|
||||||
|
for subfile in cpp_files_included_by(cpp):
|
||||||
|
abs = os.path.join(f"{UNREALENGINE}/Engine", subfile)
|
||||||
|
ccjson.append({ "file" : abs, "arguments":args, "directory":ccdir })
|
||||||
Path(f"{INTEGRATION}/.vscode/compile_commands.json").write_text(json.dumps(ccjson, indent=2))
|
Path(f"{INTEGRATION}/.vscode/compile_commands.json").write_text(json.dumps(ccjson, indent=2))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user