1.3.2. Linux 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.

1.3.2.1. Local installation

  1. Create a AML-IP directory where to download and build AML-IP and its dependencies:

    mkdir -p ~/AML-IP/src
    mkdir -p ~/AML-IP/build
    cd ~/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 ~/AML-IP
      mkdir build/foonathan_memory_vendor
      cd build/foonathan_memory_vendor
      cmake ~/AML-IP/src/foonathan_memory_vendor -DCMAKE_INSTALL_PREFIX=~/AML-IP/install -DBUILD_SHARED_LIBS=ON
      cmake --build . --target install
      
    • Fast CDR

      cd ~/AML-IP
      mkdir build/fastcdr
      cd build/fastcdr
      cmake ~/AML-IP/src/fastcdr -DCMAKE_INSTALL_PREFIX=~/AML-IP/install
      cmake --build . --target install
      
    • Fast DDS

      cd ~/AML-IP
      mkdir build/fastdds
      cd build/fastdds
      cmake ~/AML-IP/src/fastdds -DCMAKE_INSTALL_PREFIX=~/AML-IP/install -DCMAKE_PREFIX_PATH=~/AML-IP/install
      cmake --build . --target install
      
    • Dev Utils

      # cmake_utils
      cd ~/AML-IP
      mkdir build/cmake_utils
      cd build/cmake_utils
      cmake ~/AML-IP/src/dev-utils/cmake_utils -DCMAKE_INSTALL_PREFIX=~/AML-IP/install -DCMAKE_PREFIX_PATH=~/AML-IP/install
      cmake --build . --target install
      
      # cpp_utils
      cd ~/AML-IP
      mkdir build/cpp_utils
      cd build/cpp_utils
      cmake ~/AML-IP/src/dev-utils/cpp_utils -DCMAKE_INSTALL_PREFIX=~/AML-IP/install -DCMAKE_PREFIX_PATH=~/AML-IP/install
      cmake --build . --target install
      
    • DDS Router

      # ddsrouter_core
      cd ~/AML-IP
      mkdir build/ddsrouter_core
      cd build/ddsrouter_core
      cmake ~/AML-IP/src/ddsrouter/ddsrouter_core -DCMAKE_INSTALL_PREFIX=~/AML-IP/install -DCMAKE_PREFIX_PATH=~/AML-IP/install
      cmake --build . --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.

1.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, DDS-Router, 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