2. Windows installation from sources¶
The instructions for installing the DDS Router application from sources and its required dependencies are provided in this page. It is organized as follows:
2.1. Dependencies installation¶
DDS Router depends on eProsima Fast DDS library and certain Debian packages. This section describes the instructions for installing DDS Router dependencies and requirements in a Windows environment from sources. The following packages will be installed:
foonathan_memory_vendor
, an STL compatible C++ memory allocation library.fastcdr
, a C++ library that serializes according to the standard CDR serialization mechanism.fastdds
, the core library of eProsima Fast DDS library.cmake_utils
, an eProsima utils library for CMake.cpp_utils
, an eProsima utils library for C++.
First of all, the Requirements and Dependencies detailed below need to be met. Afterwards, the user can choose whether to follow either the colcon or the CMake installation instructions.
2.1.1. Requirements¶
The installation of eProsima Fast DDS in a Windows environment from sources requires the following tools to be installed in the system:
Colcon [optional]
Gtest [for test only]
PyYAML [for YAML Validator only]
jsonschema [for YAML Validator only]
2.1.1.1. Visual Studio¶
Visual Studio is required to
have a C++ compiler in the system. For this purpose, make sure to check the
Desktop development with C++
option during the Visual Studio installation process.
If Visual Studio is already installed but the Visual C++ Redistributable packages are not,
open Visual Studio and go to Tools
-> Get Tools and Features
and in the Workloads
tab enable
Desktop development with C++
. Finally, click Modify
at the bottom right.
2.1.1.2. Chocolatey¶
Chocolatey is a Windows package manager. It is needed to install some of eProsima Fast DDS’s dependencies. Download and install it directly from the website.
2.1.1.3. CMake, pip3, wget and git¶
These packages provide the tools required to install eProsima Fast DDS and its dependencies from command line.
Download and install CMake, pip3, wget and git by following the instructions detailed in the respective
websites.
Once installed, add the path to the executables to the PATH
from the
Edit the system environment variables control panel.
2.1.1.4. Colcon¶
colcon is a command line tool based on CMake aimed at building sets of software packages. Install the ROS 2 development tools (colcon and vcstool) by executing the following command:
pip3 install -U colcon-common-extensions vcstool
Note
If this fails due to an Environment Error, add the --user
flag to the pip3
installation command.
2.1.1.5. Gtest¶
Gtest is a unit testing library for C++. By default, DDS Router does not compile tests. It is possible to activate them with the opportune CMake options when calling colcon or CMake. For more details, please refer to the CMake options section.
Run the following commands on your workspace to install Gtest.
git clone https://github.com/google/googletest.git
cmake -DCMAKE_INSTALL_PREFIX='C:\Program Files\gtest' -Dgtest_force_shared_crt=ON -DBUILD_GMOCK=ON ^
-B build\gtest -A x64 -T host=x64 googletest
cmake --build build\gtest --config Release --target install
or refer to the Gtest Installation Guide for a detailed description of the Gtest installation process.
2.1.1.6. PyYAML¶
PyYAML is a YAML parser and emitter for Python.
It is used by the DDS-Router YAML Validator for loading the content of configuration files.
Install pyyaml
by executing the following command:
pip3 install -U pyyaml
2.1.1.7. jsonschema¶
jsonschema is an implementation of the JSON Schema specification for Python.
It is used by the DDS-Router YAML Validator for performing validation of configuration files against a given JSON schema.
Install jsonschema
by executing the following command:
pip3 install -U jsonschema
2.1.2. Dependencies¶
DDS Router has the following dependencies, when installed from sources in a Windows environment:
2.1.2.1. Asio and TinyXML2 libraries¶
Asio is a cross-platform C++ library for network and low-level I/O programming, which provides a consistent asynchronous model. TinyXML2 is a simple, small and efficient C++ XML parser. They can be downloaded directly from the links below:
After downloading these packages, open an administrative shell with PowerShell and execute the following command:
choco install -y -s <PATH_TO_DOWNLOADS> asio tinyxml2
where <PATH_TO_DOWNLOADS>
is the folder into which the packages have been downloaded.
2.1.2.2. OpenSSL¶
OpenSSL is a robust toolkit for the TLS and SSL protocols and a general-purpose cryptography library.
Download and install the latest OpenSSL version for Windows at this
link.
After installing, add the environment variable OPENSSL_ROOT_DIR
pointing to the installation root directory.
For example:
OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL-Win64
2.1.2.3. yaml-cpp¶
yaml-cpp is a YAML parser and emitter in C++ matching the YAML 1.2 spec, and is used by DDS Router application to parse the provided configuration files. From an administrative shell with PowerShell, execute the following commands in order to download and install yaml-cpp for Windows:
git clone --branch yaml-cpp-0.7.0 https://github.com/jbeder/yaml-cpp
cmake -DCMAKE_INSTALL_PREFIX='C:\Program Files\yamlcpp' -B build\yamlcpp yaml-cpp
cmake --build build\yamlcpp --target install # If building in Debug mode, add --config Debug
2.1.2.4. eProsima dependencies¶
If it already exists in the system an installation of Fast DDS library with version greater than 2.4.0, just source this library when building the DDS Router application by using the command:
source <fastdds-installation-path>/install/setup.bash
In other case, just download Fast DDS project from sources and build it together with DDS Router using colcon as it is explained in section Colcon installation.
2.2. Colcon installation¶
Important
Run colcon within a Visual Studio prompt. To do so, launch a Developer Command Prompt from the search engine.
Create a
DDS-Router
directory and download the.repos
file that will be used to install DDS Router and its dependencies:mkdir <path\to\user\workspace>\DDS-Router cd <path\to\user\workspace>\DDS-Router mkdir src wget https://raw.githubusercontent.com/eProsima/DDS-Router/main/ddsrouter.repos vcs import src < ddsrouter.repos
Note
In case there is already a Fast DDS installation in the system it is not required to download and build every dependency in the
.repos
file. It is just needed to download and build the DDS Router project having sourced its dependencies. Refer to section eProsima dependencies in order to check how to source Fast DDS library.Build the packages:
colcon build
Note
Being based on CMake, it is possible to pass the CMake configuration options to the colcon build
command. For more information on the specific syntax, please refer to the
CMake specific arguments
page of the colcon manual.
2.3. CMake installation¶
This section explains how to compile DDS Router with CMake, either locally or globally.
2.3.1. Local installation¶
Open a command prompt, and create a
DDS-Router
directory where to download and build DDS Router and its dependencies:mkdir <path\to\user\workspace>\DDS-Router mkdir <path\to\user\workspace>\DDS-Router\src mkdir <path\to\user\workspace>\DDS-Router\build cd <path\to\user\workspace>\DDS-Router wget https://raw.githubusercontent.com/eProsima/DDS-Router/main/ddsrouter.repos vcs import src < ddsrouter.repos
Compile all dependencies using CMake.
-
cd <path\to\user\workspace>\DDS-Router mkdir build\foonathan_memory_vendor cd build\foonathan_memory_vendor cmake <path\to\user\workspace>\DDS-Router\src\foonathan_memory_vendor -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\DDS-Router\install ^ -DBUILD_SHARED_LIBS=ON cmake --build . --config Release --target install
-
cd <path\to\user\workspace>\DDS-Router mkdir build\fastcdr cd build\fastcdr cmake <path\to\user\workspace>\DDS-Router\src\fastcdr -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\DDS-Router\install cmake --build . --config Release --target install
-
cd <path\to\user\workspace>\DDS-Router mkdir build\fastdds cd build\fastdds cmake <path\to\user\workspace>\DDS-Router\src\fastdds -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\DDS-Router\install ^ -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\DDS-Router\install cmake --build . --config Release --target install
-
# CMake Utils cd <path\to\user\workspace>\DDS-Router mkdir build\cmake_utils cd build\cmake_utils cmake <path\to\user\workspace>\DDS-Router\src\dev-utils\cmake_utils -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\DDS-Router\install ^ -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\DDS-Router\install cmake --build . --config Release --target install # C++ Utils cd <path\to\user\workspace>\DDS-Router mkdir build\cpp_utils cd build\cpp_utils cmake <path\to\user\workspace>\DDS-Router\src\dev-utils\cpp_utils -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\DDS-Router\install ^ -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\DDS-Router\install cmake --build . --config Release --target install
-
# ddspipe_core cd <path\to\user\workspace>\DDS-Router mkdir build\ddspipe_core cd build\ddspipe_core cmake <path\to\user\workspace>\DDS-Router\src\ddspipe\ddspipe_core -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\DDS-Router\install ^ -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\DDS-Router\install cmake --build . --config Release --target install # ddspipe_participants cd <path\to\user\workspace>\DDS-Router mkdir build\ddspipe_participants cd build\ddspipe_participants cmake <path\to\user\workspace>\DDS-Router\src\ddspipe\ddspipe_participants -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\DDS-Router\install ^ -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\DDS-Router\install cmake --build . --config Release --target install # ddspipe_yaml cd <path\to\user\workspace>\DDS-Router mkdir build\ddspipe_yaml cd build\ddspipe_yaml cmake <path\to\user\workspace>\DDS-Router\src\ddspipe\ddspipe_yaml -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\DDS-Router\install ^ -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\DDS-Router\install cmake --build . --config Release --target install
-
Once all dependencies are installed, install DDS Router:
# ddsrouter_core cd <path\to\user\workspace>\DDS-Router mkdir build\ddsrouter_core cd build\ddsrouter_core cmake <path\to\user\workspace>\DDS-Router\src\ddsrouter\ddsrouter_core ^ -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\DDS-Router\install -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\DDS-Router\install cmake --build . --config Release --target install # ddsrouter_yaml cd <path\to\user\workspace>\DDS-Router mkdir build\ddsrouter_yaml cd build\ddsrouter_yaml cmake <path\to\user\workspace>\DDS-Router\src\ddsrouter\ddsrouter_yaml -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\DDS-Router\install ^ -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\DDS-Router\install cmake --build . --config Release --target install # ddsrouter_tool cd <path\to\user\workspace>\DDS-Router mkdir build\ddsrouter_tool cd build\ddsrouter_tool cmake <path\to\user\workspace>\DDS-Router\src\ddsrouter\tools\ddsrouter_tool -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\DDS-Router\install ^ -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\DDS-Router\install cmake --build . --config Release --target install
Note
By default, DDS Router does not compile tests.
However, they can be activated by downloading and installing Gtest
and building with CMake option -DBUILD_TESTS=ON
.
2.3.2. Global installation¶
To install DDS Router system-wide instead of locally, remove all the flags that
appear in the configuration steps of foonathan_memory_vendor
, Fast-CDR
, Fast-DDS
, and
DDS-Router
2.4. Run an application¶
If the DDS Router was compiled using colcon, when running an instance of a DDS Router, the colcon overlay built in the
dedicated DDS-Router
directory must be sourced.
There are two possibilities:
Every time a new shell is opened, prepare the environment locally by typing the command:
setup.bat
Add the sourcing of the colcon overlay permanently, by opening the Edit the system environment variables control panel, and adding
~/Fast-DDS/install/setup.bat
to thePATH
.
However, when running an instance of a DDS Router compiled using CMake, it must be linked with its dependencies where
the packages have been installed. This can be done by opening the Edit system environment variables control panel and
adding to the PATH
the DDS Router, Fast DDS and Fast CDR installation directories:
Fast DDS: C:\Program Files\fastdds
Fast CDR: C:\Program Files\fastcdr
DDS Router: C:\Program Files\ddsrouter