OSG系列文章目录
前言
1.git(不是必须)使用git得到的[源码下载]
2.osg3.5.1源码(osg3.5.1源码下载地址)是3.5.1版本的
3.osg依赖的三方库3rdParty
上面一个是full,一个是small,随便选一个,我这里选的full
small和full最大区别:感觉full多了boost库
4.osg依赖的数据:OpenSceneGraph-Data-3.4.0.zip
5.CMake下载,我这里用的3.21.4版本
6.vs2019(VS017也可以)
我这里用的vs2019
一、使用cmake 编译osg3.5.1
cmake报错:
CMake Deprecation Warning at CMakeLists.txt:7 (CMAKE_MINIMUM_REQUIRED):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument value or use a … suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Deprecation Warning at CMakeLists.txt:38 (cmake_policy):
The OLD behavior for policy CMP0008 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at CMakeLists.txt:45 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
大概意思:
1.cmake最小版本需要2.8.12,否则有些特性将忽略
解决:打开OpenSceneGraph-OpenSceneGraph-3.5.1文件夹下的CMakeLists.txt
加入:cmake_minimum_required (VERSION 3.21.4)
2.缺少gdal_i.lib、gif.lib、libxml2.lib
下载OpenSceneGraph-Data-3.4.0.zip并解压到OpenSceneGraph-OpenSceneGraph-3.5.1同级目录
2.编译OpenSceneGraph.sln
3. 生成lib和dll
4.注意
在生成debug版本的时候,没有出错,但是在生成release版本的时候报错了:
解决方法
1.找到Plugins osg deprecated osgviewer工程