Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Develop and Debug with CLion

Matt Butrovich edited this page Oct 30, 2019 · 17 revisions

Licensing

Setup

  • In CLion, select Check out from Version Control > Git, clone the repository. Alternatively, if you've already cloned the repository, choose Open and select the top level project directory.
  • Go to File > Settings... (CLion > Preferences... on macOS)
    • Go to Build, Execution, Deployment > CMake. Create as many build profiles as you need. We recommend at least the following 3 for developers:
      • For development: Build type: Debug, CMake options: -DTERRIER_USE_ASAN=ON
      • For benchmarking: Build type: Release, CMake options: -DTERRIER_USE_JEMALLOC=ON
  • After CLion processes the CMake project files, choose your build target and profile from the drop-down menu at the top-right of the IDE and build.

Customization

These are optional changes but will make CLion's behavior more consistent with our CI process.

  • Go to File > Settings... (CLion > Preferences... on macOS) and then Editor > Inspections > C/C++ > General > Clang-Tidy. Uncheck Use IDE settings. This will force CLion to use the project's .clang-tidy file for real-time inspections. Click the link for Specify Clang-Tidy executable and point it to the binary installed by packages.sh. The default CLion-bundled version which may provide different warnings.
  • Go to File > Settings... (CLion > Preferences... on macOS) and then Editor > Code Style. Check "Enable ClangFormat with clangd server. This will force CLion to use the project's .clang-format` file for formatting operations.

Debug

Tips

  • CLion caches the CMake project files, so if you add or remove files you'll want to refresh the build settings by going to Tools > CMake > Reset Cache and Reload Project.