This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 503
Develop and Debug with CLion
Joseph Koshakow edited this page Aug 29, 2020
·
17 revisions
- CLion: Use CMU .edu email to get free, renewable 1-year license for CLion Professional Edition
- If you are having trouble getting a license with your andrew.cmu.edu email account, try creating an email alias and using that: https://www.cmu.edu/computing/services/comm-collab/email-calendar/how-to/emailalias.html
- 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 2 for developers:- For development:
Build type: Debug
,CMake options: -DTERRIER_USE_ASAN=ON
- For benchmarking:
Build type: Release
,CMake options: -DTERRIER_USE_JEMALLOC=ON
- For development:
- Go to
- After CLion processes the CMake project files, choose your build target and profile from the drop-down menu at the top of the IDE and build.
- All the configurations for build targets should be set up properly by default
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 thenEditor > Inspections > C/C++ > General > Clang-Tidy
. UncheckUse IDE settings
. This will force CLion to use the project's.clang-tidy
file for real-time inspections. Click the link forSpecify Clang-Tidy executable
and point it to the binary installed bypackages.sh
. The default CLion-bundled version may provide different warnings. - Go to
File > Settings...
(CLion > Preferences...
on macOS) and thenEditor > Code Style
. CheckEnable ClangFormat with clangd server
. This will force CLion to use the project's.clang-format
file for formatting operations.
- For all build targets except for "terrier" you should use the Build button at the top of the IDE (Ctrl+F9), it looks like a green hammer.
- To run terrier select the "terrier" build target and use the Run button (Shift+F10), it looks like a green hammer. The executable for this build target should already be set to the terrier executable.
- To run a specific unit test select that unit test from the drop down menu at the top of the IDE and use the Run button.
- Use CLion's built-in debugger to set breakpoints and step through the code.
- To debug terrier select the "terrier" build target and use the Debug button (Shift+F9), it looks like a green bug. The executable for this build target should already be set to the terrier executable.
- To debug a specific unit test select that unit test from the drop down menu at the top of the IDE and use the Debug button.
- 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
orFile > Reload CMake Project
. - If you right click a file then you can use the
Git
option to do the following:-
Annotate
: This will show the git blame of a file -
Show History
: This will the git commit history of a file
-
Carnegie Mellon Database Group Website