Skip to content

Commit f97b1a0

Browse files
authored
Merge pull request #98 from fgyanz/extract-fix
Fix paths read from compiler_commands.json
2 parents ef80d6e + f81e337 commit f97b1a0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

klpbuild/plugins/extractor.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,12 @@ def get_cmd_from_json(self, cs, fname):
347347
for d in data:
348348
if fname in d["file"]:
349349
output = d["command"]
350-
# The arguments found on the file point to .., since they are generated
351-
# when the kernel is compiled. Replace the .. by the codestream kernel source
352-
# directory since klp-ccp needs to reach the files
353-
return Extractor.process_make_output(output).replace("..", str(cs.get_src_dir()))
350+
# The arguments found on the file point to '..', since they are generated
351+
# when the kernel is compiled. Replace the first '..' on each file
352+
# path by the codestream kernel source directory since klp-ccp needs to
353+
# reach the files.
354+
cmd = Extractor.process_make_output(output)
355+
return cmd.replace(" ..", f" {str(cs.get_src_dir())}").replace("-I..", f"-I{str(cs.get_src_dir())}")
354356

355357
raise RuntimeError(f"Couldn't find cmdline for {fname} on {str(cc_file)}. Aborting")
356358

0 commit comments

Comments
 (0)