Skip to content

stevenhartley/up-cpp-michael

 
 

Repository files navigation

Uprotocol C++ SDK

Welcome!

The main object of this module is to enable constructing and deconstructing uProtocol CloudEvents.

IMPORTANT NOTE: This project is under active development

The core module contains functional factory methods for creating CloudEvents as well as functional factory methods that make it more intuitive to create URIs that are used to configure source and sink (destination) elements in the uProtocol CloudEvents.

This module contains the data model structures as well as core functionality for building uProtocol CloudEvents and URIs for sink and source attributes.

The SDKs are then used by the code generators to auto-populate service stubs with generated code that builds CloudEvents. For more information on auto-generating service stubs, please refer to uProtocol Main Project

Getting Started

Requirements:

  • Compiler: GCC/G++ 11 or Clang 13
  • vcpkg
  • Ubuntu 22.04
  • cgreen testing library

Ubuntu dependencies

At first to make it working, you have to install some linux libraries as dependencies

$ sudo apt-get install build-essential \
      libbsd-dev \
      make \
      ninja-build \
      pkg-config \
      clang-format \
      cmake \
      uuid \
      gcc-11 \
      g++-11 \
      lcov \
      uuid-dev \
      openssl \ 
      libssl-dev

Install cgreen testing library

In this package we're using the cgreen testing library.

 $ git clone https://github.com/cgreen-devs/cgreen.git
 $ cd cgreen
 $ make
 $ sudo make install

It should appear in /usr/local/lib and in /usr/local/include

installing dependencies

$ sudo apt-get install libgtest-dev
$ sudo apt-get install openssl-devel
$ sudo apt-get install libuuid-devel
$ sudo apt-get install rapidjson-devel
$ install spdlog : https://github.com/gabime/spdlog
$ install cgreen : https://github.com/cgreen-devs/cgreen/blob/master/INSTALL.md 
$ install protobuf : git clone --progress -b v3.21.12 https://github.com/protocolbuffers/protobuf
      mkdir build & cd build\
      cmake ../cmake \
      -DCMAKE_BUILD_TYPE=Release \
      -Dprotobuf_BUILD_SHARED_LIBS=ON \
      -Dprotobuf_BUILD_TESTS=OFF; \
      sudo -E make -j4 install

Setup SDK local repository, build and test

$ git clone --branch uprotocol-core-api-1.5.5 https://github.com/eclipse-uprotocol/up-core-api.git
$ git clone https://github.com/eclipse-uprotocol/uprotocol-sdk-cpp.git
$ cd uprotocol-sdk-cpp
$ code .

Using VSCode with the CMake & CMake Tools plugins, following steps will be done automatically when the project is opened in VSCode. Build and test can be triggered using the extension.

Please refer the following link for the CMake Tools extension: https://code.visualstudio.com/docs/cpp/CMake-linux

If the CMake Tools plugin is not configured to auto generate, then manually run cmake and build using the following commands.

$ mkdir build
$ cd build
$ /usr/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -S .. -B build -G Ninja
$ ninja
$ ninja test

Now you should see formatting the code with clang-format, building and running the unit tests.

Show your support

Give a ⭐️ if this project helped you!

Releases

No releases published

Packages

No packages published

Languages

  • C++ 96.7%
  • CMake 2.9%
  • Python 0.4%