EduArt Sensor Ring Library 3.0.1
Loading...
Searching...
No Matches
Installation

💡 You can either include the EduArt Sensor Ring library in your own CMake project via the FetchContent feature or build the library from source.

1 Using the Library in CMake Projects

The Sensor Ring library is easy to integrate in your own CMake projects. Simply add these lines to your CMakeLists.txt:

include(FetchContent)
FetchContent_Declare(
sensorring
URL https://github.com/EduArt-Robotik/edu_lib_sensorring/archive/refs/heads/master.zip
DOWNLOAD_EXTRACT_TIMESTAMP OFF
)
FetchContent_MakeAvailable(sensorring)
add_library(sensorring::sensorring ALIAS sensorring)

Here is an absolute minimum example of a CMakeLists.txt that includes the Sensor Ring library.

cmake_minimum_required(VERSION 3.10)
project(minimal_example)
include(FetchContent)
FetchContent_Declare(
sensorring
URL https://github.com/EduArt-Robotik/edu_lib_sensorring/archive/refs/heads/master.zip
DOWNLOAD_EXTRACT_TIMESTAMP OFF
)
FetchContent_MakeAvailable(sensorring)
add_library(sensorring::sensorring ALIAS sensorring)
add_executable(minimal_example
src/main.cpp
)
target_link_libraries(minimal_example
sensorring::sensorring
)

You can then simply include the Sensor Ring headers into your C++ program and compile the project.

// Example of a C++ program using the library
using namespace eduart;
int main(int, char*[]) {
// Populate the parameters
auto manager = std::make_unique<manager::MeasurementManager>(params);
// Do something useful here
return 0;
}
The MeasurementManager is the main interface of the sensorring library.
Parameter structure of the MeasurementManager. The MeasurementManager handles the timing and communic...
Definition Parameter.hpp:163

2 Building the Library from Source

2.1 Building the library

The library is built with a standard CMake workflow which is almost identical for Windows and Linux. Use the following commands to build the library.

  • Linux

    git clone https://github.com/EduArt-Robotik/edu_lib_sensorring
    mkdir -p edu_lib_sensorring/build
    cd edu_lib_sensorring/build
    cmake .. -DCMAKE_BUILD_TYPE=Release -DSENSORRING_BUILD_EXAMPLES=ON
    cmake --build . -j4
    Linux Build Options:
    Build OptionDefault ValueDescription
    SENSORRING_BUILD_DOCUMENTATIONONBuild the documentation
    SENSORRING_BUILD_EXAMPLESONBuild the example programs
    SENSORRING_BUILD_PYTHON_BINDINGSONBuild python bindings
    SENSORRING_BUILD_SHARED_LIBSONBuild as shared library
    SENSORRING_USE_SOCKETCANONCompile with support for Linux SocketCAN
    SENSORRING_USE_USBTINGOONCompile with support for the USBtingo USB adapter
    CMAKE_BUILD_TYPEReleaseChoose the type of build (Debug/Release/RelWithDebInfo)
    CMAKE_INSTALL_PREFIX/usr/localInstall path prefix, prepended onto install directories
  • Windows

    git clone https://github.com/EduArt-Robotik/edu_lib_sensorring
    mkdir edu_lib_sensorring/build
    cd edu_lib_sensorring/build
    cmake .. -DCMAKE_BUILD_TYPE=Release -DSENSORRING_BUILD_EXAMPLES=ON
    cmake --build . --config=Release --parallel
    Windows build options:
    Build OptionDefault ValueDescription
    SENSORRING_BUILD_DOCUMENTATIONONBuild the documentation
    SENSORRING_BUILD_EXAMPLESONBuild the example programs
    SENSORRING_BUILD_PYTHON_BINDINGSONBuild python bindings
    SENSORRING_BUILD_SHARED_LIBSONBuild as shared library
    SENSORRING_USE_USBTINGOONCompile with support for the USBtingo USB adapter
    CMAKE_BUILD_TYPEReleaseChoose the type of build (Debug/Release/RelWithDebInfo)
    CMAKE_INSTALL_PREFIXC:\Program FilesInstall path prefix, prepended onto install directories

2.2 Installing the Library

After building the library you can install it to make it available to all projects on your computer.

  • Linux

    sudo cmake --install .

    ⚠️ The default installation directory of the library is /usr/local. If another location is chosen, add your custom install path to the CMAKE_PREFIX_PATH environment variable for other CMake packages to find the library. Alternatively you can set sensorring_DIR if you don't want to manipulate CMAKE_PREFIX_PATH.

    export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:<install-path>
  • Windows

    cmake --install . # requires terminal with admin privileges

    ⚠️ The default installation directory of the library is C:\Program Files. If another location is chosen, add your custom install path to the CMAKE_PREFIX_PATH environment variable for other CMake packages to find the library. Alternatively you can set sensorring_DIR if you don't want to manipulate CMAKE_PREFIX_PATH.

    $env:CMAKE_PREFIX_PATH = "$($env:CMAKE_PREFIX_PATH);<install-path>"

2.3 Generating Installable Packages

Instead of installing the library directly, you can generate installable packages to distribute it to other computers. However, distributing the installable package requires that the computer on which you build the library and the computers on which you install it have matching systems.

  • Linux

    The installable Linux packages of the library can be generated with the following command:
    cpack .

    ℹ️ Running the command on Linux generates a .tar.gz archive and a .deb package. Generated packages are located in the directories edu_lib_sensorring/release or edu_lib_sensorring/debug depending on the build type.

    The .tar.gz archive can be extracted anywhere on the system with the following command:
    tar -xvzf ../release/sensorring-<version>-<arch>.tar.gz -C /path/to/directory
    The .deb package can be installed with the following command which will install the library in the CMAKE_INSTALL_PREFIX directory:
    sudo dpkg -i ../release/sensorring-<version>-<arch>.deb

    ⚠️ The default installation directory of the library is /usr/local. If another location is chosen, add your custom install path to the CMAKE_PREFIX_PATH environment variable for other CMake packages to find the library. Alternatively you can set sensorring_DIR if you don't want to manipulate CMAKE_PREFIX_PATH.

    export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:<install-path>
  • Windows

    The installable Windows packages of the library can be generated with the following command:
    cpack .

    ℹ️ Running the command on Windows generates .zip archive. Generated packages are located in the directories edu_lib_sensorring/release or edu_lib_sensorring/debug depending on the build type.

    The archive can be be extracted anywhere on the system using the Windows File Explorer.

    ⚠️ The default installation directory of the library is C:\Program Files. If another location is chosen, add your custom install path to the CMAKE_PREFIX_PATH environment variable for other CMake packages to find the library. Alternatively you can set sensorring_DIR if you don't want to manipulate CMAKE_PREFIX_PATH.

    $env:CMAKE_PREFIX_PATH = "$($env:CMAKE_PREFIX_PATH);<install-path>"
Read Previous Read Next
Hardware Software