Fork me on GitHub
<< back to documentation

Building and Developing Apache Celix with CLion

Apache Celix can be build for development in CLion with use of the Conan package manager. Conan will arrange the building of the Apache Celix dependencies and generate Find files for these dependencies.

Conan will also generate a active_run.sh and deactivate_run.sh script that does the environment (de)setup for the binary locations of the build dependencies (i.e. configures PATH and LD_LIBRARY_PATH/DYLD_LIBRARY_PATH).

Setting up the build directory

#clone git repo
git clone https://github.com/apache/celix.git
cd celix

#if needed setup conan default and debug profile
conan profile new default --detect
conan profile new debug --detect
conan profile update settings.build_type=Debug debug

#generate and configure cmake-build-debug directory
conan install . celix/2.3.0 -pr:b default -pr:h debug -if cmake-build-debug/ -o celix:enable_testing=True -o celix:enable_address_sanitizer=True -o celix:build_all=True -b missing
conan build . -bf cmake-build-debug/ --configure

#optional build
cd cmake-build-debug
make -j

#optional setup run env and run tests
source activate_run.sh 
ctest --verbose
source deactivate_run.sh 

Configuring CLion

To ensure that all Conan build dependencies can be found the Run/Debug configurations of CLion needs te be updated.

This can be done under the menu “Run->Edit Configurations…”, then select “Edit configuration templates…” and then update the “Google Test” template so that the active_run.sh Conan generated script is sourced in the “Environment variables” entry.

If the Apache Celix CMake build directory is home/joe/workspace/celix/cmake-build-debug then the value for “Environment variables” should be: source /home/joe/workspace/celix/cmake-build-debug/activate_run.sh

Configure CLion