native icon indicating copy to clipboard operation
native copied to clipboard

[native_toolchain_c] Generate `compile_commands.json`

Open dcharkes opened this issue 8 months ago • 0 comments

We should consider making this package generate compile_commands.json files.

https://clang.llvm.org/docs/ClangCommandLineReference.html#dependency-file-generation

I think we'd probably want to do this as a side effect of the hook, and only if the sources are not in the pub cache.

We need to do this as a side effect of the hook due to the following:

  1. The compiler can be passed in by the SDK, and
  2. Packages depended on can pass in include directories or libraries to be linked via metadata.

Hence, it is not enough to simply have a CBuilder and run it from a tool/generate_compile_commands_json.dart.

dcharkes avatar Apr 02 '25 12:04 dcharkes