Install Sourcetrail
1 | brew update && brew cask install sourcetrail |
Project setup
- Create a new project;
- Add source group and choose source group type
C/C++ from Compilation Database*
; - Choose source files and include path.
more details can be found here: https://www.sourcetrail.com/documentation/#CreateaC/C++SourceGroupfromCompilationDatabase
Compilation Database
-
CMake
Use the CMAKE_EXPORT_COMPILE_COMMANDS flag. You can run
1
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
or add the following line to your CMakeLists.txt script:
1
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
The compile_commands.json file will be put into the build directory.
-
Non-CMake
Use
Bear
, see Language Server Protocol