eclipse-uprotocol / up-cpp

uProtocol Language Specific Library for C++
Apache License 2.0
18 stars 26 forks source link
core cpp uprotocol

uProtocol C++ Interface Library (up-cpp)

CI

Welcome!

This library provides the primary interface to uProtocol for uEntity applications. The primary point of interaction for most applications will be the layer 2 "communications" objects.

In addition to up-cpp, a uEntity will also need at least on transport implementation, such as up-transport-zenoh-cpp.

IMPORTANT NOTE: This project is under active development

Getting Started

Requirements:

Conan packages

Using the recipes found in up-conan-recipes, build these Conan packages:

  1. up-core-api: conan create --version 1.6.0-alpha3 --build=missing up-core-api/release

NOTE: all conan commands in this document use Conan 2.x syntax. Please adjust accordingly when using Conan 1.x.

How to Use the Library

To add up-cpp to your conan build dependencies, place following in your conanfile.txt:

[requires]
up-cpp/[~1.0]

[generators]
CMakeDeps
CMakeToolchain

[layout]
cmake_layout

NOTE: If using conan version 1.59 Ensure that the conan profile is configured to use ABI 11 (libstdc++11: New ABI) standards according to the Conan documentation for managing gcc ABIs.

Building locally

The following steps are only required for developers to locally build and test up-cpp, If you are making a project that uses up-cpp, follow the steps in the How to Use the Library section above.

With Conan for dependencies

From the root of this repo, run:

conan install --build=missing .
cmake --preset conan-release
cd build/Release
cmake --build . -- -j

Once the build completes, tests can be run with ctest.

Debug builds can be generated by changing those steps to:

conan install --build=missing --settings=build_type=Debug .
cmake --preset conan-debug
cd build/Debug
cmake --build . -- -j

Generate UT Coverage

To get code coverage, perform the steps above, but replace cmake --preset... with

cd build/Release
cmake ../../ -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Coverage

Once the tests complete, the Unit Test Coverage report can be generated from the base up-cpp folder with: ./Coverage.sh

./coverage.sh

With dependencies installed as system libraries

TODO Verify steps for pure cmake build without Conan.

Creating the Conan package

See: up-conan-recipes

Show your support

Give a ⭐️ if this project helped you!