VS2005编译PagedGeometry 1.1.0

http://www.cnitblog.com/buf/archive/2011/04/20/73380.html

http://code.google.com/p/ogre-paged/downloads/list下载源码包,解压后发现没有.sln和.vcproj,需要用cmake进行配置来生成这些文件。

按照机器上OGRE相关include和lib目录的实际位置,修改CMakeDependenciesConfig.txt文件中Ogre_INCLUDE_DIRS、Ogre_LIBRARY_DIRS等变量的定义,我的设置是这样:

IF (WIN32)
    
set (Ogre_INCLUDE_DIRS  " E:/Ogre/project/OGRE_1.7.2/include/OGRE "  CACHE PATH  " The ogre include path to use " )
    
set (Ogre_LIBRARY_DIRS  " E:/Ogre/project/OGRE_1.7.2/lib "  CACHE PATH  " The ogre lib path to use " )
    
set (Ogre_LIBRARIES     " OgreMain "  CACHE  STRING   " The ogre lib to link against " )
    
set (Ois_INCLUDE_DIRS  " E:/Ogre/project/OGRE_1.7.2/include/ois "  CACHE PATH  " The OIS include path to use " )
    
set (Ois_LIBRARY_DIRS  " E:/Ogre/project/OGRE_1.7.2/lib "  CACHE PATH  " The OIS lib path to use " )
    
set (Ois_LIBRARIES     " ois "  CACHE  STRING   " The ogre lib to link against " )
    # add includes 
to  check directories
    
set (CMAKE_REQUIRED_INCLUDES ${Ogre_INCLUDE_DIRS} ${Ois_INCLUDE_DIRS})

    # check 
for  libs  and  include files we want  to  use
    CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_INCLUDES)
    
if ( NOT  HAVE_WINDOWS_INCLUDES)
        message(FATAL_ERROR 
" could not find the windows platform includes. Please install them. " )
    endif()

    
set (BOOST_PATH  " E:/Ogre/project/OGRE_1.7.2/boost_1_42 "  CACHE PATH  " The BOOST root path to use " )
    include_directories(${BOOST_PATH})
    link_directories   (${BOOST_PATH}
/ lib)
ELSEIF (UNIX)
    find_package(PkgConfig)
    PKG_CHECK_MODULES  (Ogre OGRE REQUIRED)
    PKG_CHECK_MODULES  (Ois  OIS  REQUIRED)
    # add includes 
to  check directories
    
set (CMAKE_REQUIRED_INCLUDES ${Ogre_INCLUDE_DIRS} ${Ois_INCLUDE_DIRS})
    # check 
for  libs  and  include files we want  to  use
    # check below 
not  working!?
    #CHECK_LIBRARY_EXISTS(libOgreMain.so loadPlugins 
""  HAVE_OGRE_LIBS)
    #
if ( NOT  HAVE_OGRE_LIBS)
    #    message(FATAL_ERROR 
" could not link against Ogre, please check of you have the required libraries installed " )
    #endif()
ENDIF(WIN32)


IF ( NOT  WIN32)
    # XXX TODO: 
fix  the checks  for  windows!
    # add this so the checks work
    
set (CMAKE_REQUIRED_INCLUDES ${Ogre_INCLUDE_DIRS} ${Ois_INCLUDE_DIRS})

    # cross platform checks
    # check 
for  libs  and  include files we want  to  use
    CHECK_INCLUDE_FILE_CXX(OgrePrerequisites.h HAVE_OGRE_INCLUDES)
    
if ( NOT  HAVE_OGRE_INCLUDES)
        message(
" could not find the Ogre includes. Please install them. " )
    endif()

    CHECK_INCLUDE_FILE_CXX(OIS
/ OIS.h HAVE_OIS_DIR_INCLUDES)
    
if (HAVE_OIS_DIR_INCLUDES)
        
set (OIS_INCLUDE  " OIS/OIS.h " )
    endif()

    CHECK_INCLUDE_FILE_CXX(OIS.h HAVE_OIS_INCLUDES)
    
if (HAVE_OIS_INCLUDES)
        
set (OIS_INCLUDE  " OIS.h " )
    endif()

    
if ( NOT  HAVE_OIS_DIR_INCLUDES  AND   NOT  HAVE_OIS_INCLUDES)
        message(
" could not find the OIS includes. Please install them. " )
    endif()

    
if (HAVE_OIS_DIR_INCLUDES  AND   NOT  HAVE_OIS_INCLUDES)
      
set (OIS_USING_DIR  TRUE )
    
else ()
      
set (OIS_USING_DIR  FALSE )
    endif()
endif()

需要注意的是要把路径名中的'\'替换为'/',否则会被cmake作为转义符处理。
改完以后用VS2005打开.sln就可以编译了。一个小小的问题是Ogre_LIBRARIES和Ois_LIBRARIES没有按照Debug和Release分别定义,因此编译Debug版本的时候还需要改一下Example工程的link选项。

效果还不错,速度很快。
不过,我的机器(Windows XP SP3 / Ogre 1.7.2 / Galaxy GTS450)上启动不了Example9/10,会出现runtime error。估计可能是某些依赖库的版本问题,尚未解决。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值