Library of Common Utilities
It's a library that provides common utilities and functions, likely to be used across various components of ostis-systems.
Using Library as a Conan Package
The Common library can be used as a Conan package in other projects. Here's how to integrate it:
-
Add the following to your
conanfile.txt
: -
Run Conan to install the package:
-
In your CMakeLists.txt, add the following to find and link the library:
-
Configure your project:
-
Build your project as usual:
Note
The common::common-utils
target provides all the necessary include directories and linked libraries. You don't need to specify them separately.
If you're using Conan's CMake integration in your project, you might also need to add the following to your conanfile.py
:
This ensures that the necessary CMake files are generated for finding and linking the Common library.
Using Library in Your Code
After you've set up your project to use the Common Utilities library, you can start using its functionality in your code. Here's how to include and use the library:
- Include the necessary headers in your C++ files:
#include <common/utils/logic_utils.hpp>
#include <common/utils/relation_utils.hpp>
#include <common/utils/template_params_utils.hpp>
- Refer to the library's header files for a complete list of available functions and their usage.
Developing Library
Installation Prerequisites
Before you begin, ensure you have the following installed:
- CMake (version 3.24 or higher);
- C++ Compiler with C++17 support;
- Conan package manager;
- ccache (for faster rebuilds).
Note
This project is not supported on Windows OS.
Installation & Build
1. Clone Repository
First, clone the repository containing the Common component:
2. Install Dependencies with Conan
The project uses Conan to manage dependencies. Install the required dependencies:
3. Configure Project
You can configure the project using CMake presets. There are three main configuration options:
- Debug with tests:
- Release:
- Release with tests:
4. Build Project
After configuring, you can build the project:
For debug build:
For release build:
5. Run Tests
If you've configured the project with tests, you can run them using CTest:
Configuration Options
The following options can be set when configuring the project:
SC_BUILD_TESTS
: Set to ON to build unit tests (default is OFF).SC_CLANG_FORMAT_CODE
: Set to ON to add clang-format targets (default is OFF).AUTO_CCACHE
: Set to ON to use ccache for faster rebuilds (default is ON).
Example of setting an option:
Troubleshooting
For any issues or questions about using this package, please refer to the project's GitHub repository or contact the OSTIS-AI team.