C++ compilation database generation script (aka CLion, Vim, etc. support! )

Hello all! I recently wrote a script that is able to generate a compile_commands.json file from frc projects.

What is a compilation database/compile_commands.json?

Many C++ IDEs and editor plugins use clang (as in the compiler) tools to generate autocomplete based on user projects. These tools often take in a compile_commands.json file which is essentially a list of source files in the project and the command to compile these source files. My script takes in the output of gradleRIO builds and generates a compile_commands.json.

What does this mean?

This means that you can use any IDE or editor that has support/a plugin for c++ autocomplete using clangd.

For example:

  • CLion - you have to open the compile_commands.json as a project
  • Vim - using you-complete-me
  • VsCode - you can get better autocompletion in vsocde compared to the frc plugin by using the clangd plugin
  • Any other editor that supports clang completion - see this

What does this do that gradlerio generateCompileCommands doesn’t do?

I didn’t see that! This is a mistake on my part. Closing.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.