Linux-X86 Fast-DDS-编译-部署-试运行

必要工具安装和依赖库

# 安装工具
sudo apt install cmake g++ python3-pip wget git

# 依赖库安装
sudo apt install libasio-dev libtinyxml2-dev
sudo apt install libssl-dev
sudo apt install libp11-dev libengine-pkcs11-openssl
sudo apt install softhsm2

# 安装ros2开发工具,非必要
pip3 install -U colcon-common-extensions vcstool

编译安装

# 设置FAST-DDS根目录,我们的代码和安装路径都在该路径下,根据实际
export FAST_DDS_ROOT=/home/V01/uidq8207/work/code/third_party/Fast-DDS-GIT/
mkdir ${FAST_DDS_ROOT}


# 编译并安装 foonathan_memory_vendor 到${FAST_DDS_ROOT}/install目录
cd ${FAST_DDS_ROOT}
git clone https://github.com/eProsima/foonathan_memory_vendor.git
mkdir foonathan_memory_vendor/build
cd foonathan_memory_vendor/build
cmake .. -DCMAKE_INSTALL_PREFIX=${FAST_DDS_ROOT}/install -DBUILD_SHARED_LIBS=ON
cmake --build . --target install

# 编译并安装 Fast-CDR 到${FAST_DDS_ROOT}/install目录
cd ${FAST_DDS_ROOT}
git clone https://github.com/eProsima/Fast-CDR.git
mkdir Fast-CDR/build
cd Fast-CDR/build
cmake .. -DCMAKE_INSTALL_PREFIX=${FAST_DDS_ROOT}/install
cmake --build . --target install


# 编译并安装 Fast-DDS 到${FAST_DDS_ROOT}/install目录
# 注意,Fast-DDS 依赖 foonathan_memory_vendor ,可以在 FAST-DDS 的 CMAKELISTS.TXT 中添加以下语句
# set(foonathan_memory_DIR $ENV{FAST_DDS_ROOT}/install/lib/foonathan_memory/cmake)
cd ${FAST_DDS_ROOT}
git clone https://github.com/eProsima/Fast-DDS.git
mkdir Fast-DDS/build
cd Fast-DDS/build
cmake ..  -DCMAKE_INSTALL_PREFIX=${FAST_DDS_ROOT}/install
cmake --build . --target install