Skip to content

Commit

Permalink
Allow a specification of the output directory for compiler_commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils-TUD committed Jan 17, 2024
1 parent 38a2a99 commit 1664beb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ninjapie/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def write_to_file(self, defaults: dict[str, str] = None):
for glb in self._globs:
file.write(glb + '\n')

def write_compile_cmds(self):
def write_compile_cmds(self, outdir: str = None):
"""
Writes a `compiler_commands.json` file for `clangd`.
Expand All @@ -379,7 +379,8 @@ def write_compile_cmds(self):
existing. Note that only the rules `cxx` and `cc` are considered.
"""

outdir = self._build_dir
if outdir is None:
outdir = self._build_dir

# generate compile_commands.json for clangd
with open(outdir + '/compile_commands.json', 'w', encoding='utf-8') as cmds:
Expand Down

0 comments on commit 1664beb

Please sign in to comment.