C++ Camera SDK

The Nabto WebRTC C++ SDK is what is mainly used to implement device applications for IoT cameras. This guide will show how to build the SDK and use it in your own device application. To quickly get an example device running, see our example guide.

Obtaining the source

Clone the Nabto WebRTC C++ repository recursively to ensure submodules are initialized properly:

$ git clone --recursive https://github.com/nabto/nabto-webrtc-sdk-cpp.git

Building the SDK

To build the SDK requires these tools to be installed:

From the root of the repository, go to the sdk directory and build the SDK using the CMake preset:

$ cd sdk/
$ cmake --workflow --preset release

This will use the vcpkg submodule to build and install all other dependencies used by the build. After the dependencies are build, it will build the SDK. When the build is completed, the artifacts will be installed to the directory build/release/install/. Additionally, the SDK header requires headers for the 3rdparty libraries plog and nlohmann/json installed to the directory build/release/vcpkg_installed/<YOUR_PLATFORM>/include/.

Using the SDK

To use the SDK in your own application, first install the needed artifacts in your project. For this guide we will make a small application in a subdirectory of the SDK repository. This will also assume the vcpkg platform x64-linux when copying 3rdparty libraries:

$ mkdir nabto-example
$ mkdir nabto-example/lib
$ cp -r build/release/install/include nabto-example/
$ cp -r build/release/vcpkg_installed/x64-linux/include/nlohmann nabto-example/include/
$ cp -r build/release/vcpkg_installed/x64-linux/include/plog nabto-example/include/
$ cp build/release/install/lib/libnabto_webrtc_signaling_device.a nabto-example/lib

In the nabto-example directory, create a main.cpp file with the following content:

#include <nabto/webrtc/device.hpp>
#include <iostream>

int main() {
  auto version = nabto::webrtc::SignalingDevice::version();
  std::cout << "Using Nabto WebRTC SDK version: " << version << std::endl;
  return 0;
}

Compile and run the example using:

$ g++ main.cpp -Iinclude -Llib -lnabto_webrtc_signaling_device -o nabto-example
$ ./nabto-example

To get started implementing your own device application, see this guide. Also see the full working example application in this section.