Build Library#
The library can be built locally using Cmake (Cmake Installation)
Create a build directory and navigate to it:
mkdir build && cd build
Configure CMake project
cmake .. -DCMAKE_BUILD_TYPE=Debug
Using this command several cache variables can be set:
<variable cache name>: [possible values] (default value) - Description
_7BIT_DI_LIBRARY_TYPE: [“Shared”, “Static”, “HeaderOnly”] (“Static”) - Library build type
_7BIT_DI_BUILD_DOCS: [“ON”, “OFF”] (“OFF”) - Turn on to build documentation (requires Sphinx, Breathe and Doxygen to be installed)
_7BIT_DI_BUILD_TESTS: [“ON”, “OFF”] (“OFF”) - Turn on to build tests (requires Gtest to be installed, see Build Library With Conan)
_7BIT_DI_BUILD_EXAMPLES: [“ON”, “OFF”] (“OFF”) - Turn on to build examples
_7BIT_DI_BUILD_SINGLE_HEADER: [“ON”, “OFF”] (“OFF”) - Turn on to build single header SevenBitDI.hpp (requires Quom to be installed)
_7BIT_DI_INSTALL: [“ON”, “OFF”] (“OFF”) - Turn on to install the library
to set cache variable pass additional option: -D<variable cache name>=[value] for example, this command will set the library type to Static and will force examples built
cmake .. -DCMAKE_BUILD_TYPE=Release -D_7BIT_DI_LIBRARY_TYPE=Static -D_7BIT_DI_BUILD_EXAMPLES=true
Build the library using the command:
cmake --build .
Build Library With Conan#
Gtest library is added to project using Conan package manager (Conan Installation), If Conan was freshly installed run detect command:
conan profile detect
To install Conan packages run this command in the library root folder:
conan install . --output-folder=build --build=missing
Navigate to the build directory:
cd build
Configure the CMake project, and add also toolchain file as a CMAKE_TOOLCHAIN_FILE cache variable:
cmake .. -DCMAKE_TOOLCHAIN_FILE:PATH="./conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release -D_7BIT_DI_BUILD_TESTS=ON
Build the library using the command:
cmake --build .
Install Library#
To install the library set additional cache variables _7BIT_DI_BUILD_TESTS=ON and specify installation dir with CMAKE_INSTALL_PREFIX, then run the command
cmake --build . --config Release --target install