@brief How to build and integrate Condy in your project.
Condy is a header-only library. You can use it by simply including the header file in your project.
Make sure liburing (≥2.3) is installed on your system.
#include <condy.hpp>Compile your code:
c++ main.cpp -std=c++20 -luring -I/path/to/condy You can add Condy to your project via Git submodule:
git submodule add https://github.com/wokron/condy.git third_party/condyIn your CMakeLists.txt:
add_subdirectory(third_party/condy)
add_executable(my_app src/main.cpp)
target_link_libraries(my_app PRIVATE condy)Note
- C++20 is required for coroutine support.
- Condy depends on liburing ≥ 2.3.
- Both GCC and Clang compilers are supported.
- By default, Condy downloads and links liburing via FetchContent (
CONDY_LINK_LIBURING=ON). SetCONDY_LINK_LIBURING_VERSIONto use a specific liburing version, e.g.-DCONDY_LINK_LIBURING_VERSION=2.15. - To link against the system liburing, set
CONDY_LINK_LIBURING=OFFand install liburing manually.
Alternatively, you can add Condy with FetchContent:
include(FetchContent)
FetchContent_Declare(
condy
GIT_REPOSITORY https://github.com/wokron/condy.git
GIT_TAG v1.9 # Change to the tag you want
)
FetchContent_MakeAvailable(condy)
add_executable(my_app src/main.cpp)
target_link_libraries(my_app PRIVATE condy)Condy provides CMake options to build examples, benchmarks, and tests:
cmake -B build -S . \
-DCONDY_BUILD_EXAMPLES=ON \
-DCONDY_BUILD_BENCHMARKS=ON \
-DCONDY_BUILD_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)After building:
- Run all tests:
ctest --test-dir build- Run example programs:
./build/examples/link-cp from.bin to.binCondy provides an optional C++20 module interface as an alternative to #include <condy.hpp>.
import condy;- CMake 3.28+ with Ninja generator
- GCC 14+ or Clang 16+
cmake -B build -S . -G Ninja \
-DCONDY_BUILD_MODULE=ON \
-DCONDY_BUILD_EXAMPLES=ON
ninja -C build module-hello
./build/examples/module-hello
# Hello, Condy (via module)!The module target is condy_module:
set(CONDY_BUILD_MODULE ON)
add_subdirectory(third_party/condy)
add_executable(my_app src/main.cpp)
target_link_libraries(my_app PRIVATE condy_module)Condy supports liburing ≥ 2.3. When building with a specific version of liburing, Condy assumes that all related interfaces provided by that version are already supported by your Linux kernel.
Note
If your kernel version is older than the liburing version you are using, some features may not be available at runtime, even if compilation succeeds.
For best compatibility and feature support, it is recommended to use a Linux kernel version that matches or exceeds the requirements of your chosen liburing version.