VS2005编译PagedGeometry 1.1.0
来源:互联网 发布:独生子女政策 知乎 编辑:程序博客网 时间:2024/06/07 10:02
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()
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。估计可能是某些依赖库的版本问题,尚未解决。
- VS2005编译PagedGeometry 1.1.0
- VS2005编译Openssl-1.1.0f
- VS2005.net编译log4cpp1.0
- wince6.0 vs2005 编译出错
- PagedGeometry使用
- PagedGeometry使用
- PagedGeometry笔记
- PagedGeometry笔记
- VS2005 编译mysql-connector-c++-1.1.3
- vs2005环境下编译CEGUI 0.6.0
- VS2005.net编译log4cpp1.0 (zt)
- opencv2.0 vs2005下的编译
- vs2005环境下编译CEGUI 0.6.0
- vs2005环境下编译CEGUI 0.6.0
- wince6.0 vs2005 编译选项详解
- 【转】wince6.0 vs2005 编译选项详解
- vs2005环境下编译CEGUI 0.6.0
- CxImage6.0在VS2005下编译
- android中使用httpclient提交表单
- 用WPF控件MediaElement创建简易播放器(视频区域、播放控制区域、播放列表、循环播放)
- UINavigationController使用详解
- STL-------------equal_range:返回在特定范围中指定的元素的上下界
- xp补丁导致 vs2008 出现" 尝试读取或写入受保护的内存。这通常指示其他内存已损坏 " 的解决办法
- VS2005编译PagedGeometry 1.1.0
- servlet中get和post区别
- jquery Ajax 返回JSON报错: org.apache.struts2.json.JSONException: java.lang.reflect.InvocationTargetExce
- [Android1.5]TextView跑马灯效果
- 【Java基础 008】 ImageIcon 图标相对路径解析
- 我对linux理解之input一
- 关于android Button按钮变换背景选择器不好用问题
- 【lizhi125】Universal Extractor 万能解包器 - 从安装包解压提取绿色文件的工具
- UITabBarController使用详解