目錄
編譯環境:
編譯需要的源碼文件:
Fast DDS編譯:
注意事項:
參考文檔:
基于Fast DDS 的源碼來編譯相關的庫,然后可以通過python 來調用庫文件實現dds 數據通信,本文就詳細的介紹編譯過程。
編譯環境:
PC:windows ?11,64 位操作系統, 基于Intel? x64 的處理器
cmake version 3.26.0-rc1
java 11.0.23 2024-04-16 LTS(編譯Fast-DDS-Gen需要)
編譯器:Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe
Gradle 7.5(編譯Fast-DDS-Gen需要)
編譯需要的源碼文件:
- foonathan_memory_vendor :
- Fast CDR:
- Fast DDS:
eProsima Fast dds 在Windows環境中從源安裝時具有以下依賴關系:
-
Asio and TinyXML2 libraries
-
OpenSSL
下載軟件包然后通過指令來安裝:
choco install -y -s <PATH_TO_DOWNLOADS> asio tinyxml2choco install -y openssl
安裝的文件都在下面這個路徑下
C:\ProgramData\chocolatey\lib?
安裝完成之后可以通過指令來檢驗是否安裝成功:
Fast DDS編譯:
先在D:\DDS 下創建一個文件夾Fast-DDS? ,所有的編譯源碼都在Fast-DDS 文件夾下面,install是我們編譯出來的文件的安裝路徑。
- 編譯Foonathan Memory
git clone https://github.com/eProsima/foonathan_memory_vendor.git
cd foonathan_memory_vendor
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=D:/DDS/Fast-DDS/install ..
cmake --build . --config Release --target install
?D:\DDS\Fast-DDS\install\share 下面能看到編譯出來的文件
- ?編譯Fast CDR
git clone --recursive https://github.com/eProsima/Fast-CDR.git
cd Fast-CDR
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=D:/DDS/Fast-DDS/install ..
cmake --build . --config Release --target install
編譯成功如下圖 會把相關的文件寫入到install文件夾中
- 編譯Fast DDS
? ? ? 編譯的時候要注意 老版本的源碼是?RTPS,大家在使用源碼的時候要注意版本。
git clone --recursive https://github.com/eProsima/Fast-DDS.git
cd Fast-DDS
mkdir build
cd buildcmake -DCMAKE_INSTALL_PREFIX=D:/DDS/Fast-DDS/install ..
cmake --build . --target install
編譯完成后所有的dll 和文件都在install 文件下面
編譯完成后可以通過FASTDDS-Python? 來測試dll 編譯后是否可以使用
注意事項:
- 編譯的軟件版本需要保持一致, foonathan_memory_vendor,Fast CDR ,Fast DDS 如果有的是debug ,有的是release ,最后編譯Fast DDS 的時候會出現無法找到lib的錯誤。
- 編譯的dll 后需要設置環境變量最后再編譯Fast DDS
參考文檔:
4. Windows installation from sources — Fast DDS 2.14.2 documentation?