This repository has been archived by the owner on Sep 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 624
Develop and Debug with CLion
Matt Butrovich edited this page Jul 6, 2018
·
4 revisions
- CLion: Use CMU student email to get free, renewable 1-year license for CLion Professional Edition
- In CLion, select Check out from Version Control > Git, clone Peloton repository. Open the project.
- 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: -DUSE_SANITIZER=Address
- For profiling:
Build type: RelWithDebInfo
- For benchmarking:
Build type: Release
- For development:
- If you're on macOS and don't want to set them globally, add the following environment variables for each Profile:
LLVM_DIR=/usr/local/Cellar/llvm@3.7/3.7.1/lib/llvm-3.7
ASAN_OPTIONS=detect_container_overflow=0
- Go to
- 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.
- Go to
File > Settings...
(CLion > Preferences...
on macOS) and thenEditor > Code Style > C/C++
. Go toSet from... > Predefined Style > Google
. You should rely on Peloton's scripts for formatting, but this will make CLion closely adhere to our preferred style while you work. - CLion's indexing and code analysis on Peloton can use a significant amount of memory due to the TBB and Boost libraries. There are numerous guides on the Internet for optimizing CLion's JVM parameters for large projects, but at a minimum we recommend the following:
- Go to
Help > Edit Custom VM Options...
- For systems with 8GB of RAM, set initial heap and maximum heap size respectively:
-Xms1024m
-Xmx4096m
- For systems with >=16GB of RAM, set initial heap and maximum heap size respectively:
-Xms2048m
-Xmx8192m
- Go to
- Use the CLion's built-in debugger to set breakpoints and step through the code.
- CLion caches the CMake project files, so if you add or remove files you'll want to refresh the build settings be going to
Tools > CMake > Reset Cache and Reload Project
.