Compilations

To ensure proper functionality of the program, it is crucial to follow several small yet important steps illustrated in our landing page.

Same host and target

If the compiling machine and the target machine having the same platform, you can just build it without using any toolchain file.

Windows

  1. Install MSVC build tools, or the Visual Studio IDE (requires C++17 support)

  2. Install CMake

Linux

  1. Install gcc7 (requires C++17 support) or newer: sudo apt-get install gcc-7

  2. Install CMake (requires version 3.11 or newer)

  1. Clone the source file: git clone --recurse-submodules https://bitbucket.org/lpresearch/openzen.git

  2. Prepare a build tree:

    cd openzen mkdir build && cd build cmake .. // in case you want to build the optional components (Python, C# support etc.) // please check the optional components in the appendix cmake -DZEN_XXXX ..

3. Build the project: cmake --build .

4. The library built and sample projects are under openzen/build directory.

Different host and target (Cross compilation)

Raspberry Pi

For compilation on your PC, you need to download cross compilation toolchain from either one of the following sites:

  1. https://gnutoolchains.com/raspberry/

  2. https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads

Refer it when generating cmake cache by

cmake ./path/to/openzen/cmake -DCMAKE_TOOLCHAIN_FILE=Toolchain-RaspberryPi.cmake

then you can build an OpenZen library .so by calling

cmake --build ./path/to/your/build/tree -DZEN_PYTHON=ON

Appendix

Available Build Options

These build options can be supplied to the cmake command to customize your OpenZen build. For example

Name

Default

Description

Name

Default

Description

ZEN_USE_STATIC_LIBS

OFF

Compile OpenZen as a static library

ZEN_STATIC_LINK_LIBCXX

OFF

Option to statically link libstdc++ to be portable to older systems (Linux only)

ZEN_BLUETOOTH

ON

Compile with bluetooth support (details)

ZEN_BLUETOOTH_BLE

OFF

Compile with bluetooth low-energy support, needs Qt installed (details)

ZEN_NETWORK

OFF

Compile with support for network streaming of measurement data

ZEN_CSHARP

ON

Compile C# bindings for OpenZen

ZEN_PYTHON

OFF

Compile Python bindings for OpenZen

ZEN_TESTS

ON

Compile with OpenZen tests

ZEN_EXAMPLES

ON

Compile with OpenZen examples