Is there any way to generate compile_commands.json for the c++ extensions?

When using python setup.py develop, PyTorch will generate a compile_commands.json file that can be used by many editors to provide command completion and error highlighting for PyTorch’s C++ code. But it seems that this file is not for custom c++ extension. Is there any way to generate a compile_commands.json for the custom extension?

I find just use bear when run python setup.py install to compile the extensions will generate the compile_commands.json. The root setup.py of pytorch write some functions to generate compile_commands.json, but just use bear will work.