Install for C++

The RDK C++ library is packed into a modern CMake project named flexiv_rdk, which can be configured and installed using CMake on all supported platforms.

Prepare build tools

Linux

  1. Install GCC compiler kit using package manager:

    sudo apt install build-essential
    
  2. Install CMake using package manager:

    sudo apt install cmake
    

macOS

  1. Install Clang compiler kit using xcode tool:

    xcode-select
    

    This will invoke the installation of Xcode Command Line Tools, then follow the prompted window to finish the installation.

  2. Install CMake using package manager:

    brew install cmake
    

Windows

  1. Install compiler kit: Download and install Microsoft Visual Studio 2019 (MSVC v14.2) or above. Choose “Desktop development with C++” under the Workloads tab during installation. You only need to keep the following components for the selected workload:

    • MSVC … C++ x64/x86 build tools (Latest)

    • C++ CMake tools for Windows

    • Windows 10 SDK or Windows 11 SDK, depending on your actual Windows version

  2. Install CMake (with GUI): Download cmake-3.x.x-windows-x86_64.msi from CMake download page and install the msi file. The minimum required version is 3.16.3. Add CMake to system PATH when prompted, so that cmake and cmake-gui command can be used from Command Prompt or a bash emulator.

  3. Install bash emulator: Download and install Git for Windows, which comes with a bash emulator Git Bash. The following steps are to be carried out in this bash emulator.

Install dependencies

  1. Clone or download flexiv_rdk repo following instructions in Download Flexiv RDK.

  2. Choose a directory for installing RDK C++ library and all its dependencies. This directory can be under system path or not, depending on whether you want RDK to be globally discoverable by CMake. For example, a new folder named rdk_install under the home directory.

  3. In a new Terminal, run the provided script to compile and install all C++ dependencies to the installation directory chosen in step 2:

    cd flexiv_rdk/thirdparty
    bash build_and_install_dependencies.sh ~/rdk_install
    

Note

Internet connection is required for this step.

Install RDK library

  1. After all dependencies are installed, open a new Terminal and configure the flexiv_rdk CMake project:

    cd flexiv_rdk
    mkdir build && cd build
    cmake .. -DCMAKE_INSTALL_PREFIX=~/rdk_install
    

Note

-D followed by CMAKE_INSTALL_PREFIX sets the absolute path of the installation directory, which should be the one chosen in step 2 above.

  1. Install flexiv_rdk C++ library to CMAKE_INSTALL_PREFIX path, which may or may not be globally discoverable by CMake:

    cd flexiv_rdk/build
    cmake --build . --target install --config Release
    
  2. If the installation was successful, the following directories should appear in the rdk_install folder:

  • include/flexiv/rdk/

  • lib/cmake/flexiv_rdk/

Use the installed library

After the library is installed as flexiv_rdk CMake target, it can be linked from any other CMake projects. Using the provided flexiv_rdk-examples` project for instance:

cd flexiv_rdk/example
mkdir build && cd build
cmake .. -DCMAKE_PREFIX_PATH=~/rdk_install
cmake --build . --config Release -j 4

Note

-D followed by CMAKE_PREFIX_PATH tells the user project’s CMake where to find the installed C++ library. This argument can be skipped if the RDK library and its dependencies are installed to a globally discoverable location.