Ogre源码在VS2005(VC8)中的配置方式
(参照 Ogre源码在VS2008(VC9)中的配置方式 此文所写,其实配置方式都差不多,就是有些小的地方有些许不同而已。
呃,今天终于开始Ogre之旅了。
不过配置还是花了不少的时间才搞定,就是需要些耐心。
准备工作:
首先安装
1.         Microsoft Visual Studio 2005(此处使用的VS2005中文版)(开发工具,不用介绍了)注意这里必须要安装#sp1,官方网站特别强调,否则会出现未知的错误。不过大家一般使用vs2005的都会安装sp1补丁的哈。
2.         DXSDK_Aug09最新 (此处我安装在D:\Program Files\Microsoft DirectX SDK (August 2009)目录下) (完全安装大约需要1G空间)
3.         ×××地址 http://www.ogre3d.org/download/source

OGRE 1.6.4 Source For Windows27 September 200949.5Mb


Visual C++.Net 2005 (8.0) SP1 Precompiled Dependencies
28 December 200715.7MbPlease note – you must have installedVS2005 Service Pack 1. You may also be interested in the debug symbols.
正确操作步骤:
1.         解压 ogre-v1-6-4.zip(源码包)(请确保磁盘空间足够:正确编译后的文件总和大约是3.3G。好大哦)
2.         解压 OgreDependencies_VC8SP1_Eihort_20071227.zip
3.         将 OgreDependencies_VC8SP1_Eihort_20071227.zip解压后的两个文件夹Samples和Dependencies拷贝到 ogre目录(ogre-v1-6-4.zip(源码包)解压后的目录)下,如果提示文件或目录已存在, 则直接覆盖. 注意这个非常重要,但是很容易被忽略,我就是这样。否则编译不通过的,因为这个里面有ogre需要链接的第三方库。要注意的是,ogre3D.cn貌似好久都没更新了,所以建议上ogre3D.org,也就是官网非中文网.cn寻求解决方法。
4.         双击Ogre目录下的Ogre_vc8.sln文件,即:打开Ogre源码解决方案
这里遗忘了一个步骤:
4.5.         打开 Ogre_vc9解决方案下的工程的属性页
a.         将工程属性页中的    配置属性 -> C/C++     ->    常规       ->    附加包含目录 添加:Microsoft DirectX SDK (August 2008)目录下的Include目录(Microsoft DirectX SDK (August 2008)为刚刚安装的Direct3Dsdk默认目录)
b.         将工程属性页中的    配置属性 -> 连接器    ->    常规       ->    附加库目录 添加:Microsoft DirectX SDK (August 2008)\Lib 目录下的x86目录(32位机 x64为64位机)
5.         编译整个解决方案。
6.         经过30分钟编译,整个解决方案编译成功
《========== 生成: 成功50 个,失败0 个,最新0 个,跳过0 个==========》
7.       测试下,启动ogremain实例,弹出个对话框。看看其他的实例,基本ok。但是有两三个示例貌似是有问题的。哇,可爱的食人魔。
         但是貌似vs2008的还需要改些东东才能成功启动实例。vs2008可以参考: http://blog.csdn.net/zeroboundary/archive/2008/11/30/3414086.aspx)
以上就是我在vs2005下关于Ogre源码的配置方式。
接下来就是要创建第一个Ogre程序了。这个就没上面的那么顺利了,要麻烦些。
参考官网教程SettingUpAnApplication:
http: //www.ogre3d.org/wiki/index.php/SettingUpAnApplication#Microsoft_Visual_C.2B.2B_.NET
其实可以简单点用:Also see The Complete Blanks Guide To Using The OGRE SDK AppWizard. 这个可以这样,但是是需建立在ogre3D SDK的。
忽略,选择手动建立Ogre程序:
1.创建一个普通'Win32空项目,创建一个新项 'Project -> Add New Item...'. 为main.cpp,从普通教程中copy个最简单的代码过来,保存,ok。
看网站教程:
To clarify where the DLL files should be, an easy way is to copy the \bin folder (containing \debug and \release) and the \media folder from the OGRE installation directory to your Testproject folder (note: in this case you might be copying DLLs that won't be needed, but it's the hassle-free way). If you follow the convention presented above and you created folders for the header, scripts and source files, you have the following folders under \Testproject (excluding subfolders): 'bin', 'include', 'media', 'testsolution', 'scripts', and 'src'. However, if you don't want to copy them while running your Testproject from Visual Studio just add the path to OGRE's DLL files to the %PATH% global environment variable like this:
Debugging : Environment                             = PATH=%PATH%;%OGRE_HOME%\bin\debug
and for the release version
Debugging : Environment                             = PATH=%PATH%;%OGRE_HOME%\bin\release
This will not modify the %PATH% environment variable permanently, just for the given run, so its safer. You could modify it globally for all windows applications like this:
 
   
or
 
   
 
   
 
   
 
   
 
   
对应我的项目属性配置
Debugging : Command                                 = $(OutDir)\$(ProjectName).exe
Debugging : Working Directory                       = $(OutDir)
这两个都一样。
C/C++ : Preprocessor : Preprocessor Definitions += _STLP_DEBUG (only in Debug mode, not needed for .Net 2003 and 2005)
这个忽略掉note:only in Debug mode, not needed for .Net 2003 and 2005
Linker : General : Output File                            = $(OutDir)\$(ProjectName).exe 一般项目生成后默认就可以
Linker : Input : Additional Dependencies                += OgreMain_d.lib OIS_d.lib (OgreMain.lib OIS.lib in Release)
这个也一样。
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
  

关于ogre 1.7.1的下载、配置和编译指南

OGRE从1.7开始使用Cmake生成工程文件,这很方便的实现跨平台项目的移植,今天来说说生成过程中的小细节。
1、ogre_src_v1-7-1.exe:https://sourceforge.net/projects/ogre/files/ogre/1.7/ogre_src_v1-7-1.exe/download

2、Microsoft Visual C++ Dependencies Package:http://sourceforge.net/projects/ogre/files/ogre-dependencies-vc%2B%2B/1.7/OgreDependencies_MSVC_20100501.zip/download

3、cmake-2.8.1-win32-x86.exe:http://www.cmake.org/cmake/resources/software.html

下载完后,解压ogre到你的目录(例如:E:/GAME_SDK/ogre_src_v1-7-1),解压Dependencies到Ogre目录下(即,E:/GAME_SDK/ogre_src_v1-7-1/Dependencies),安装CMake2.8.1;

打开CMake,在Where is the source code处填入E:/GAME_SDK/ogre_src_v1-7-1,在Where to build the binaries处填入要生成的工程目录,方便区分我新建文件夹E:/GAME_SDK/Ogre_SDK

点击“Configure”按钮,弹出的窗口选择开发环境,我选择VS2008(VC9),CMake开始检测并生成工程文件,满以为一路顺利的,呵呵,出错了吧!


分析日志:
CMake Error at CMake/Utils/MacroLogFeature.cmake:100 (MESSAGE):
-----------------------------------------------------------------------------
-- The following REQUIRED packages could NOT be located on your system.
   -- Please install them before continuing this software installation.
   -- If you are in Windows, try passing -DOGRE_DEPENDENCIES_DIR=<path to
dependencies>
-----------------------------------------------------------------------------
+ freetype: Portable font engine <http://www.freetype.org>  
-----------------------------------------------------------------------------
Call Stack (most recent call first):
CMake/Dependencies.cmake:203 (MACRO_DISPLAY_FEATURE_LOG)
CMakeLists.txt:157 (include)

好,按照指示手动指定DOGRE_DEPENDENCIES_DIR的路径,再Configure,错误依然,百度一下,原来是没有预先编译/Dependencies里的工程,导致Cmake找不到freetype相应的库文件;那好先用VS把Dependencies目录下的各种依赖包编译好,再CMale生成~~~呵呵,项目顺利生成~~~


上面的红色表示第一次生成,确认配置更改好后,再点击"Config",倘若输出窗口没有报错,最后点击"Generate"即可,到底如何,看看目录下有没有: