Copied from this issue. Generates compile-commands.json
files using catkin
and bash
, used with language servers like clangd
.
jq
build-essentials
on Debian-based,base-devel
on Arch-based, or equivalent.catkin
make install [PREFIX=/installation/directory]
make uninstall [PREFIX=/installation/directory]
nix build .
- Build your packages using the flag
-DCMAKE_EXPORT_COMPILE_COMMANDS=YES
or put the following inCMakeLists.txt
:
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
- Create
.extended_ws
in workspace root - Put catkin workspaces to be
source
'd into.extended_ws
, e.g./opt/ros/noetics
- In catkin root directory, run
catkin-compile-commands
Restart your language server if necessary.