Replies: 1 comment
-
Now, I can get the compile_commands.json with: def create_compile_commands(path='build'):
import os
path=os.path.realpath(path)
os.makedirs(path, exist_ok=True)
ninja_files=[]
for root, dirs, files in os.walk('./'):
for file in files:
if file=="build.ninja":
ninja_files.append(os.path.join(root, file))
assert len(ninja_files)==1, "The number of 'build.ninja' file must be 1."
real_path=os.path.realpath(ninja_files[0])
dir_name=os.path.dirname(real_path)
output_path=os.path.join(path,"compile_commands.json")
os.system(f"cd {dir_name} && ninja -t compdb > {output_path}")
print(f"Generate {os.path.relpath(output_path)}") This method seems to be only available on linux, is there a better way? Looking forward to your answers! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to write a python extension in c++ and use setuptools to build it. I code in vscode and it can't give me intellisense when writing the c++ part. When I write pure c++ code, I use cmake to build and it can generate a compile_commands.json with:
so that clangd can give me intellisense. Can the setuptools generate a compile_commands.json when building a c++ extension?
Beta Was this translation helpful? Give feedback.
All reactions