The Snowplow C++ Tracker has been built and tested using C++ 11 as a minimum.
Supported operating systems:
Installing in your project
There are three ways to install the tracker in your app:
- By adding the project into your
CMakeLists.txtas a subdirectory.
- By installing the project and importing it into your app using CMake's
- By copying source files inside the
includefolder into your codebase.
As an imported target in your CMake project
First, build and install the project. Make sure the project uses the external JSON libraries (
SNOWPLOW_USE_EXTERNAL_JSON=ON). If you're building a static library (
SNOWPLOW_USE_EXTERNAL_SQLITE=ON) you also need to use SQLite3 as an external library (
If you have
LibUUID available as system libraries but you need to use them from a different package (e.g. from Conan) you need to set
CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON to prevent linking to the system libraries.
cmake [...] -DCMAKE_INSTALL_PREFIX=[...]
-DSNOWPLOW_USE_EXTERNAL_JSON=ON -DSNOWPLOW_USE_EXTERNAL_SQLITE=ON \
-DSNOWPLOW_BUILD_TESTS=0 -DSNOWPLOW_BUILD_EXAMPLE=0 -DSNOWPLOW_BUILD_PERFORMANCE=0
After building and installing the project you can use
find_package to import it into your
find_package(snowplow REQUIRED CONFIG)
Make sure your project finds the same dependencies what was visible for Snowplow when you were building and installing it. For example, if you have both system and local SQlite3 installations and
ON for Snowplow but
OFF for your project, Snowplow will be built with the local SQLite3 while during
find_package(snowplow) in your project it will find the system one.
As a subdirectory in your CMake project
Cmake version 3.15 or greater is required. You may add the library to your project target (
FetchContent like so:
Copying files to your project
Download the most recent release from the releases section. Everything in the
include folder will need to be included in your application.
The project has two dependencies that need to be included in your project: nlohmann/json and the amalgamated version of sqlite3. You will need to update the include paths in headers
Additional requirements under Linux
Additionally, under Linux, the following libraries need to be installed:
- curl (using
apt install libcurl4-openssl-devon Ubuntu)
- uuid (using
apt install uuid-devon Ubuntu)