0%

Read Source Code With Sourcetrail

Install Sourcetrail

1
brew update && brew cask install sourcetrail

Project setup

  1. Create a new project;
  2. Add source group and choose source group type C/C++ from Compilation Database*;
  3. Choose source files and include path.

more details can be found here: https://www.sourcetrail.com/documentation/#CreateaC/C++SourceGroupfromCompilationDatabase

Compilation Database

  1. 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.

  2. Non-CMake

    Use Bear, see Language Server Protocol

Reference