linux環境編譯OpenSceneGraph和osgEarth
一、編譯OpenSceneGraph
1、使用cmake開啟OSG原始碼下的CMakeLists.txt並選擇構建路徑
2、安裝第三方依賴庫
$sudo dnf install zlib-devel
$sudo dnf install libpng-devel
$sudo dnf install libcurl-devel
$sudo dnf install freetype-devel
$sudo dnf install proj-devel
$sudo dnf install geos-devel
$sudo dnf install gdal-devel
$sudo dnf install libjpeg-devel $sudo dnf install libtiff-devel
3、使用cmake配置OSG編譯環境 檢查配置curl、freetype、gdal、jpeg、png、tiff、zlib和配置QT下所有項為Qt5
4、OSG環境配置成功後執行Configure和Generate
5、終端進入OSG構建目錄下執行:
$make -j8
6、編譯成功後進行安裝
$sudo make install
7、配置環境變數
$vim ~/.bashrc
在末尾處新增:
export OSG_FILE_PATH=OSG_Data(OSG資料路徑)
完成後執行命令:
$source ~/.bashrc
同樣編輯/etc/profile
8、將動態連結庫載入到記憶體
$sudo touch /etc/ld.so.conf.d/libc.conf
$sudo echo "/usr/local/lib64" >> /etc/ld.so.conf.d/libc.conf
$sudo echo "/usr/local/lib" >> /etc/ld.so.conf.d/libc.conf
$sudo ldconfig
9、測試OSG是否安裝成功
$osgviewer cow.osg
二、編譯osgEarth原始碼
1、使用cmake開啟osgEarth原始碼下的CMakeLists.txt並選擇構建路徑
2、檢查配置curl、gdal、geos、zlib以及所有Qt庫和所有osg庫
3、osgEarth環境配置成功後執行Configure和Generate
4、終端進入osgEarth構建目錄下執行:
$make -j8
5、編譯成功後進行安裝
$sudo make install
6、將動態連結庫載入到記憶體
$sudo ldconfig
7、測試osgEarth是否安裝成功
$osgearth_viewer feature_geom.earth