FastDDS 源码安装:
1. 安装 foonathan memory
# ----------------------
# for foonathan_memory
# ----------------------
mkdir ~/Fast-DDS && cd ~/Fast-DDS
git clone https://github.com/eProsima/foonathan_memory_vendor.git
mkdir foonathan_memory_vendor/build && cd foonathan_memory_vendor/build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED_LIBS=ON
sudo cmake --build . --target install
2. 安装 fast CDR
cd ~/Fast-DDS
git clone https://github.com/eProsima/Fast-CDR.git
mkdir Fast-CDR/build && cd Fast-CDR/build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED_LIBS=ON
sudo cmake --build . --target install
3. 安装 eProsima Fast DDS
cd ~/Fast-DDS
git clone https://github.com/eProsima/Fast-DDS.git
mkdir Fast-DDS/build && cd Fast-DDS/build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED_LIBS=ON
sudo cmake --build . --target install
echo 'export LD_LIBRARY_PATH=/usr/local/lib/' >> ~/.bashrc
FastDDS 样例编译运行:
1. 编译
cd <Your DDS Directory>/Fast-DDS/examples/cpp/dds/HelloWorldExample/
mkdir build && cd build
cmake ../ && make
2. 运行
- Terminal 1
./DDSHelloWorldExample publisher
- Terminal 2
./DDSHelloWorldExample subscriber
- 运行结果