CLion
Compilation
- Install
direnv
. Make sure you follow the procedure until the end, including the “install hooks” part. - Build with aliBuild as you would do normally.
- Go to the directory from where you would usually run CLion.
- Create a new file “.envrc” which loads all the build environments of the projects that you will run on CLion. Use
/alice/sw/BUILD/O2-latest/O2/.envrc as a starting point. [See below](#.envrc) for an example. - Run
direnv allow
. - Run
clion
. - If you haven’t opened your project, go to File->Open. Choose your project’s directory. It should compile out of the box.
Notes
- Options - By default, no CMake options are needed in “File->Settings->Build, Execution, Deployment->CMake->CMake options”. However, when “install” is added to the “Build options”, a valid CMAKE_INSTALL_PREFIX has to be added in “CMake options”, for example “-DCMAKE_INSTALL_PREFIX=/home/
/alice/sw/slc7_x86-64/O2/latest". - Mac clion exe - On Mac the path to the clion executable can either be
/Applications/CLion.app/Contents/MacOS
or~/Library/Application\ Support/JetBrains/Toolbox/apps/CLion/ch-0/201.5616.31/CLion\ 2020.1\ EAP.app/Contents/MacOS/clion
(adapt the version numbers) if installed with Jetbrains Toolbox. - Pre-existing projects - For projects that already existed, it is better to remove them by deleting the folder
.idea
in the source directory.
.envrc
# Source the build environment which was used for this package
WORK_DIR=<your_path_to>/alice/sw
source $WORK_DIR/slc7_x86-64/O2/latest/etc/profile.d/init.sh
source $WORK_DIR/slc7_x86-64/QualityControl/latest/etc/profile.d/init.sh
source_up
# On mac we build with the proper installation relative RPATH,
# so this is not actually used and it's actually harmful since
# startup time is reduced a lot by the extra overhead from the
# dynamic loader
unset DYLD_LIBRARY_PATH
Full Remote Mode
- Setup the remote host for alibuild
- Run aliBuild on the remote host as usual
- Append the following in ~/.bashrc
export ALIBUILD_WORK_DIR="/home/$USER/alice/sw" WORK_DIR=$ALIBUILD_WORK_DIR source /home/$USER/alice/sw/slc8_x86-64/QualityControl/latest/etc/profile.d/init.sh # Replace with your package
- Follow the instructions from here to start a full remote project on CLion running on your local host, with the options outlined below.
Toolchain (Addresses on remote host)
- ssh://clion@$HOSTNAME:22
- gcc:
/home/$USER/alice/sw/slc8_x86-64/GCC-Toolchain/latest/bin/gcc
- g++:
/home/$USER/alice/sw/slc8_x86-64/GCC-Toolchain/latest/bin/g++
- gdb:
/home/$USER/alice/sw/slc8_x86-64/GCC-Toolchain/latest/bin/gdb
CMake
- Toolchain: the name of the toolchain just created
- CMake options:
-DLLVM_ROOT=/home/$USER/alice/sw/slc8_x86-64/Clang/latest -DLIBJALIENO2=/home/$USER/alice/sw/slc8_x86-64/libjalienO2/latest
- Load CMake Project
- Build / Run
Editor
Coding guidelines can be applied by using a special settings file. See here.