查看: 2893|回复: 6

《OpenSceneGraph三维渲染引擎设计与实践》源码用Cmake编译时遇到的问题

[复制链接]

该用户从未签到

发表于 2012-12-13 11:10:44 | 显示全部楼层 |阅读模式
最经正在看王锐先生写的《OpenSceneGraph三维渲染引擎设计与实践》,然后通过SVN提取出源代码,但是用Cmake进行编译时,出现如下提示:
The C compiler identification is MSVC 16.0.40219.1
The CXX compiler identification is MSVC 16.0.40219.1
Check for working C compiler using: Visual Studio 10
Check for working C compiler using: Visual Studio 10 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 10
Check for working CXX compiler using: Visual Studio 10 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Could NOT find OpenThreads (missing:  OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR)
Could NOT find osg (missing:  OSG_LIBRARY OSG_INCLUDE_DIR)
Could NOT find osgAnimation (missing:  OSGANIMATION_LIBRARY OSGANIMATION_INCLUDE_DIR)
Could NOT find osgDB (missing:  OSGDB_LIBRARY OSGDB_INCLUDE_DIR)
Could NOT find osgFX (missing:  OSGFX_LIBRARY OSGFX_INCLUDE_DIR)
Could NOT find osgGA (missing:  OSGGA_LIBRARY OSGGA_INCLUDE_DIR)
Could NOT find osgIntrospection (missing:  OSGINTROSPECTION_LIBRARY OSGINTROSPECTION_INCLUDE_DIR)
Could NOT find osgManipulator (missing:  OSGMANIPULATOR_LIBRARY OSGMANIPULATOR_INCLUDE_DIR)
Could NOT find osgParticle (missing:  OSGPARTICLE_LIBRARY OSGPARTICLE_INCLUDE_DIR)
Could NOT find osgShadow (missing:  OSGSHADOW_LIBRARY OSGSHADOW_INCLUDE_DIR)
Could NOT find osgSim (missing:  OSGSIM_LIBRARY OSGSIM_INCLUDE_DIR)
Could NOT find osgTerrain (missing:  OSGTERRAIN_LIBRARY OSGTERRAIN_INCLUDE_DIR)
Could NOT find osgText (missing:  OSGTEXT_LIBRARY OSGTEXT_INCLUDE_DIR)
Could NOT find osgUtil (missing:  OSGUTIL_LIBRARY OSGUTIL_INCLUDE_DIR)
Could NOT find osgViewer (missing:  OSGVIEWER_LIBRARY OSGVIEWER_INCLUDE_DIR)
Could NOT find osgVolume (missing:  OSGVOLUME_LIBRARY OSGVOLUME_INCLUDE_DIR)
Could NOT find osgWidget (missing:  OSGWIDGET_LIBRARY OSGWIDGET_INCLUDE_DIR)
Configuring done
应该如何设置才能让她们自动寻找对应的位置,我的OSG存放路径为C:\OSG
感觉要是自己一个个的设置路径的话就太麻烦了!
小弟在此先提前感谢各位大侠指点

Cmake.jpg

该用户从未签到

发表于 2012-12-13 13:58:36 | 显示全部楼层
看看它的CMakeModel中查找OSG的find文件是怎么写的吧,看看是不是需要指定什么环境变量

该用户从未签到

 楼主| 发表于 2012-12-13 14:26:13 | 显示全部楼层
liuzhiyu123 发表于 2012-12-13 13:58
看看它的CMakeModel中查找OSG的find文件是怎么写的吧,看看是不是需要指定什么环境变量

非常感谢版主的回答,我看了一下CmakeModel中的Findosg.cmake 。它里面的内容如下:
#
# NOTE: It is highly recommended that you use the new FindOpenSceneGraph.cmake
# introduced in CMake 2.6.3 and not use this Find module directly.
#
# This is part of the Findosg* suite used to find OpenSceneGraph components.
# Each component is separate and you must opt in to each module. You must
# also opt into OpenGL and OpenThreads (and Producer if needed) as these
# modules won't do it for you. This is to allow you control over your own
# system piece by piece in case you need to opt out of certain components
# or change the Find behavior for a particular module (perhaps because the
# default FindOpenGL.cmake module doesn't work with your system as an
# example).
# If you want to use a more convenient module that includes everything,
# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules.
#
# Locate osg
# This module defines
#
# OSG_FOUND - Was the Osg found?
# OSG_INCLUDE_DIR - Where to find the headers
# OSG_LIBRARIES - The libraries to link against for the OSG (use this)
#
# OSG_LIBRARY - The OSG library
# OSG_LIBRARY_DEBUG - The OSG debug library
#
# $OSGDIR is an environment variable that would
# correspond to the ./configure --prefix=$OSGDIR
# used in building osg.
#
# Created by Eric Wing.

# Header files are presumed to be included like
# #include <osg/PositionAttitudeTransform>
# #include <osgUtil/SceneView>

include(Findosg_functions)
OSG_FIND_PATH   (OSG osg/PositionAttitudeTransform)
OSG_FIND_LIBRARY(OSG osg)

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(osg DEFAULT_MSG OSG_LIBRARY OSG_INCLUDE_DIR)


是否应该在其基础上进行修改?
CmakeModel文件家中还有FindosgText.cmake  FindosgDB.cmake等.cmake文件,是否也都应该进行修改?
谢谢!

该用户从未签到

发表于 2012-12-17 09:49:16 | 显示全部楼层
设置一个环境变量名为OSGDIR并且设置为您的OSG安装路径就可以自动查找了

该用户从未签到

 楼主| 发表于 2012-12-17 10:09:01 | 显示全部楼层
array 发表于 2012-12-17 09:49
设置一个环境变量名为OSGDIR并且设置为您的OSG安装路径就可以自动查找了

非常感谢

该用户从未签到

 楼主| 发表于 2012-12-17 10:18:02 | 显示全部楼层
array 发表于 2012-12-17 09:49
设置一个环境变量名为OSGDIR并且设置为您的OSG安装路径就可以自动查找了

之后是否只要用VS打开生成的“osgEngineBook.sln”然后选择生成_批生成,选择ALL_BUILD的Debug和Release进行生成,之后再对INSTALL的Debug和Release进行生成?

该用户从未签到

发表于 2012-12-17 10:23:58 | 显示全部楼层
实验就可以了,基本上就是这个意思
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表