OSG编译
参考:
部分依赖库
库名 | 版本 | 下载官网 |
zlib | 1.2.8 | |
libpng | 1.6.21 | |
libjpeg | 9b | |
libtiff | 4.0.6 | http://www.linuxfromscratch.org/blfs/view/svn/general/libtiff.html |
FreeType | 2.6.3 | |
GLUT | 3.7 | |
GIFLIB | 5.1.2 | |
MINIZIP | 最新 | |
cURL | 7.49.1 |
1.下载OSG库
OSG源码
http://www.openscenegraph.org/index.php/download-section/stable-releases
https://github.com/openscenegraph/OpenSceneGraph/releases
第三方依赖:
http://www.openscenegraph.org/index.php/download-section/dependencies
https://download.osgvisual.org/3rdParty_VS2017_v141_x64_V11_full.7z
数据:
http://www.openscenegraph.org/index.php/download-section/data
2.将下载后的文件解压到如下目录
E:\osg\OpenSceneGraph\OpenSceneGraph-3.6.4
E:\osg\OpenSceneGraph\3rdParty
3.更新相关的最新依赖
3.1 FBX
将安装的FBX SDK目录下的内容复制到OSG第三方依赖的对应目录中
FBX SDK\2019.2\include --> E:\osg\OpenSceneGraph\3rdParty\include
FBX SDK\2019.2\lib\vs2017\x64\release --> E:\osg\OpenSceneGraph\3rdParty\lib
FBX SDK\2019.2\lib\vs2017\x64\debug --> E:\osg\OpenSceneGraph\3rdParty\lib\debug
3.2 FFmpeg
ffmpeg-4.2.1-win64-dev.zip
ffmpeg-4.2.1-win64-shared.zip
将下载的FFmpeg目录下的内容复制到OSG第三方依赖的对应目录中
ffmpeg-4.2.1-win64-dev.zip\ffmpeg-4.2.1-win64-dev\include --> E:\osg\OpenSceneGraph\3rdParty\include
ffmpeg-4.2.1-win64-dev.zip\ffmpeg-4.2.1-win64-dev\lib --> E:\osg\OpenSceneGraph\3rdParty\lib
ffmpeg-4.2.1-win64-shared.zip\ffmpeg-4.2.1-win64-shared\bin --> E:\osg\OpenSceneGraph\3rdParty\bin
3.3 opencascade
将编译后的opencascade目录下的内容复制到OSG第三方依赖的对应目录中
OpenCascade\inc --> E:\osg\OpenSceneGraph\3rdParty\include
OpenCascade\win64\vc14\lib --> E:\osg\OpenSceneGraph\3rdParty\lib
OpenCascade\win64\vc14\bin --> E:\osg\OpenSceneGraph\3rdParty\bin
OpenCascade\data --> E:\osg\OpenSceneGraph\3rdParty\data
OpenCascade\src --> E:\osg\OpenSceneGraph\3rdParty\src
OpenCascade\cmake --> E:\osg\OpenSceneGraph\3rdParty\cmake
3.3 SDL和SDL2
SDL-devel-1.2.15-VC.zip\SDL-1.2.15\include --> E:\osg\OpenSceneGraph\3rdParty\include
SDL-devel-1.2.15-VC.zip\SDL-1.2.15\lib\x64 --> E:\osg\OpenSceneGraph\3rdParty\lib
SDL2-devel-2.0.10-VC.zip\SDL2-2.0.10\include --> E:\osg\OpenSceneGraph\3rdParty\include
SDL2-devel-2.0.10-VC.zip\SDL2-2.0.10\lib\x64 --> E:\osg\OpenSceneGraph\3rdParty\lib
4. 应用CMake
CMAKE_INSTALL_PREFIX 这个表示OpenCascade最后生成的链接库的位置,将其修改为: E:/osg/OpenSceneGraph/OpenSceneGraph
----
5.
用VS2019打开
E:\osg\OpenSceneGraph\build\OpenSceneGraph.sln
文件
6. 修改源码
6.1 修改_WIN32_WINDOWS宏定义、_WIN32_WINNT宏定义 与 _WIN32_IE宏定义
E:\osg\OpenSceneGraph\OpenSceneGraph-3.6.4\include\osgViewer\api\Win32\GraphicsHandleWin32 文件
E:\osg\OpenSceneGraph\OpenSceneGraph-3.6.4\examples\osgviewerMFC\stdafx.h 文件
6.2 给cout与endl添加命名空间std::
E:\osg\OpenSceneGraph\OpenSceneGraph-3.6.4\src\osgPlugins\OpenCASCADE\ReaderWriterOpenCASCADE.cpp 文件
将其中的cout 与 endl 没有添加命名空间的加上命名空间 std::
6.3 修改链接的lib库
Plugins opencascade 的 链接的lib库
修改为
..\..\..\lib\osgDB.lib
..\..\..\lib\osgUtil.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKBin.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKBinL.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKBinTObj.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKBinXCAF.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKBO.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKBool.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKBRep.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKCAF.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKCDF.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKDCAF.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKDraw.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKernel.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKFeat.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKFillet.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKG2d.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKG3d.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKGeomAlgo.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKGeomBase.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKHLR.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKIGES.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKIVtk.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKIVtkDraw.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKLCAF.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKMath.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKMesh.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKMeshVS.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKOffset.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKOpenGl.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKPrim.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKQADraw.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKRWMesh.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKService.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKShHealing.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKStd.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKStdL.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKSTEP.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKSTEP209.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKSTEPAttr.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKSTEPBase.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKSTL.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKTObj.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKTObjDRAW.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKTopAlgo.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKTopTest.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKV3d.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKVCAF.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKViewerTest.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKVRML.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKXCAF.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKXDEDRAW.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKXDEIGES.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKXDESTEP.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKXMesh.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKXml.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKXmlL.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKXmlTObj.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKXmlXCAF.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKXSBase.lib
E:\osg\OpenSceneGraph\3rdParty\lib\TKXSDRAW.lib
opengl32.lib
..\..\..\lib\osg.lib
..\..\..\lib\OpenThreads.lib
E:\osg\OpenSceneGraph\3rdParty\lib\zlib.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
comdlg32.lib
advapi32.lib
Examples osgmovie 的 链接的lib库
修改为
..\..\lib\osgViewer.lib
..\..\lib\osgText.lib
opengl32.lib
..\..\lib\osgGA.lib
..\..\lib\osgDB.lib
E:\osg\OpenSceneGraph\3rdParty\lib\zlib.lib
E:\osg\OpenSceneGraph\3rdParty\lib\SDLmain.lib
E:\osg\OpenSceneGraph\3rdParty\lib\SDL.lib
E:\osg\OpenSceneGraph\3rdParty\lib\SDL2main.lib
E:\osg\OpenSceneGraph\3rdParty\lib\SDL2.lib
E:\osg\OpenSceneGraph\3rdParty\lib\SDL2test.lib
..\..\lib\osgUtil.lib
..\..\lib\osg.lib
..\..\lib\OpenThreads.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
comdlg32.lib
advapi32.lib
7. 修改编译类型
8. 编译
9. 安装
10. 结果如下