2.3.2. Windows installation from sources using CMake

The instructions for installing the AML-IP using CMake from sources and its required dependencies are provided in this page. This section explains how to compile AML-IP with CMake, either locally or globally.

2.3.2.1. Local installation

  1. Open a command prompt, and create a AML-IP directory where to download and build AML-IP and its dependencies:

    mkdir <path\to\user\workspace>\AML-IP
    mkdir <path\to\user\workspace>\AML-IP\src
    mkdir <path\to\user\workspace>\AML-IP\build
    cd <path\to\user\workspace>\AML-IP
    wget https://raw.githubusercontent.com/eProsima/AML-IP/main/amlip.repos
    vcs import src < amlip.repos
    
  2. Compile all dependencies using CMake.

    • Foonathan memory

      cd <path\to\user\workspace>\AML-IP
      mkdir build\foonathan_memory_vendor
      cd build\foonathan_memory_vendor
      cmake <path\to\user\workspace>\AML-IP\src\foonathan_memory_vendor -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\AML-IP\install ^
          -DBUILD_SHARED_LIBS=ON
      cmake --build . --config Release --target install
      
    • Fast CDR

      cd <path\to\user\workspace>\AML-IP
      mkdir build\fastcdr
      cd build\fastcdr
      cmake <path\to\user\workspace>\AML-IP\src\fastcdr -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\AML-IP\install
      cmake --build . --config Release --target install
      
    • Fast DDS

      cd <path\to\user\workspace>\AML-IP
      mkdir build\fastdds
      cd build\fastdds
      cmake <path\to\user\workspace>\AML-IP\src\fastdds -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\AML-IP\install ^
          -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\AML-IP\install
      cmake --build . --config Release --target install
      
    • Dev Utils

      # cmake_utils
      cd <path\to\user\workspace>\AML-IP
      mkdir build\cmake_utils
      cd build\cmake_utils
      cmake <path\to\user\workspace>\AML-IP\src\dev-utils\cmake_utils -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\AML-IP\install ^
          -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\AML-IP\install
      cmake --build . --config Release --target install
      
      # cpp_utils
      cd <path\to\user\workspace>\AML-IP
      mkdir build\cpp_utils
      cd build\cpp_utils
      cmake <path\to\user\workspace>\AML-IP\src\dev-utils\cpp_utils -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\AML-IP\install ^
          -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\AML-IP\install
      cmake --build . --config Release --target install
      
    • DDS Router

      # ddsrouter_core
      cd <path\to\user\workspace>\AML-IP
      mkdir build\ddsrouter_core
      cd build\ddsrouter_core
      cmake <path\to\user\workspace>\AML-IP\src\ddsrouter\ddsrouter_core -DCMAKE_INSTALL_PREFIX=<path\to\user\workspace>\AML-IP\install ^
          -DCMAKE_PREFIX_PATH=<path\to\user\workspace>\AML-IP\install
      cmake --build . --config Release --target install
      
  3. Once all dependencies are installed, install AML-IP:

    # amlip_cpp
    cd ~/AML-IP
    mkdir build/amlip_cpp
    cd build/amlip_cpp
    cmake ~/AML-IP/src/amlip/amlip_cpp -DCMAKE_INSTALL_PREFIX=~/AML-IP/install -DCMAKE_PREFIX_PATH=~/AML-IP/install
    cmake --build . --target install
    
    # amlip_swig
    cd ~/AML-IP
    mkdir build/amlip_swig
    cd build/amlip_swig
    cmake ~/AML-IP/src/amlip/amlip_swig -DCMAKE_INSTALL_PREFIX=~/AML-IP/install -DCMAKE_PREFIX_PATH=~/AML-IP/install
    cmake --build . --target install
    
    # amlip_py
    cd ~/AML-IP
    mkdir install/amlip_py
    pip3 install --editable ~/AML-IP/src/amlip/amlip_py/ --target install/amlip_py
    

Note

By default, AML-IP 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.2. Global installation

To install AML-IP system-wide instead of locally, remove all the flags that appear in the configuration steps of Fast-CDR, Fast-DDS, AML-IP, and AML-IP, and change the first in the configuration step of foonathan_memory_vendor to the following:

-DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED_LIBS=ON