zoukankan      html  css  js  c++  java
  • vs2010编译cegui0.7.6+openGL

    本文基于cegui0.7.6、于win7+vc2010、由于与其它版本存在一些差异、比如0.6.0、所以如果是老版本的话请参看那本CEGUI深入解析

    下载:

    1、cegui0.7.6的源码包

    http://sourceforge.net/projects/crayzedsgui/files/CEGUI%20Mk-2/0.7.6/CEGUI-0.7.6.tar.gz/download

    2、cegui0.7.X的vc2010的依赖包

    http://sourceforge.net/projects/crayzedsgui/files/CEGUI%20Mk-2%20MSVC%2B%2B%20Dependencies/0.7.x/CEGUI-DEPS-0.7.x-r3-vc10.zip/download

    3、cegui的演示包

    http://sourceforge.net/projects/crayzedsgui/files/CEGUI%20Mk-2/0.7.5/CEGUI-DEMOS-0.7.5-win32.zip/download

    可能cegui考虑到灵活性、所以并没有提供二进制的现在版给迩、都是需要经过自己编译的、其中的演示包、如果迩不需要自行编译演示程序的话、可以不下载、

    P.S.:建议mirror那里选择日本的镜像、这样会快狠多、如果实在是太慢了、挂代理吧

    预备工作:

    把cegui0.7.6的包解压后、然后再把依赖包放在cegui0.7.6的根目录下、而且必须保持目录名为dependencies、其实就是直接解压的那个文件名、这么做是因为cegui提供的工程项目设置已经把依赖包的位置和名称定成这个了、无它、

    现在就可以进入要目录下的projects\premake了、由于莪们使用的是vc2010、这里没有提供、所以莪们使用最接近的版本、vc2008、理论上迩点击一下build_vs2008.bat就可以生成vc2008的项目文件了、不过在此之前莪们需要配置一下、假设迩没有安装directX 9的SDK的话、莪们就使用vc自带的opengl作为默认的渲染引擎吧、随便使用哪个编辑器打开config.lua、蒽蒽、lua写的小冬冬

     将123行的DIRECT3D9_RENDERER从true改成false

    将196行的SAMPLES_DX9从true改成false

    将208行的SAMPLES_INCLUDED从false改成true

    基本上狠好理解吧、就是把d9的渲染器关闭、另外如果迩不想生成演示程序、可以不管208行的SAMPLES_INCLUDED

      1 --
      2 -- CEGUI premake configuration script
      3 --
      4 
      5 --- These control whether certain build configurations will be available in the
      6 --- generated solutions.  You can set to false (or comment) any build configs
      7 --- you will not be using.
      8 WANT_RELEASE_WITH_SYMBOLS_BUILD = true
      9 WANT_STATIC_BUILD = true
     10 
     11 --- This controls which version of the C/C++ runtime and which version of the
     12 --- dependencies are used when linking the static build configurations.
     13 ---
     14 --- false: use the static c/c++ runtime option and the 'static' dependencies.
     15 --- true: use the DLL c/c++ runtime option and the 'dynamic' dependencies.
     16 STATIC_BUILD_WITH_DYNAMIC_DEPS = false
     17 
     18 -- comment this to disable debug suffixes for dynamic module dlls
     19 -- if you want to use another suffix, just change the string :)
     20 -- all the debug cegui libraries are built with this suffix
     21 DEBUG_DLL_SUFFIX = "_d"
     22 
     23 -- Iterator debugging setting
     24 --
     25 -- This controls the level of debugging and other checks done for STL iterators
     26 -- in the debug build for the MSVC++ compilers.
     27 -- Setting this to false can improve performance of debug builds at the expense
     28 -- of safety / debug checks on iterators.
     29 FULLY_CHECKED_DEBUG_ITERATORS = true
     30 
     31 -- SDK / dependency paths
     32 -- { base, include_suffix, library_suffix }
     33 -- base can be absolute or relative to the root cegui_mk2 dir
     34 IRRLICHT_PATHS = { "irrlicht-1.7.1", "include", "lib/Win32-visualstudio" }
     35 OGRE_PATHS = { "C:/OgreSDK", "include", "lib" }
     36 OIS_PATHS = { "C:/OgreSDK", "include/OIS", "lib" }
     37 -- Set this to where your RapidXML package headers are to be found
     38 RAPIDXML_PATHS = { "rapidxml-1.13", "", "" }
     39 
     40 -- Python / boost::python (required to build python extension modules)
     41 PYTHON_PATHS = { "C:/Python26", "include", "libs" }
     42 BOOST_PYTHON_PATHS = { "C:/Program Files/boost/boost_1_44", "", "lib" }
     43 
     44 
     45 -- Extra SDK / dependency paths.
     46 --
     47 -- Here you can set up any additional paths you require for the various projects
     48 -- in CEGUI.  This is useful if, for example, you are using some SDK that has
     49 -- additional external dependencies of it's own (for example, boost used with
     50 -- Ogre).  All you need to do is add an entry in the following table to indicate
     51 -- the base directory, include sub-directory, library-subdirectory, and optionally
     52 -- the name of the CEGUI project to add the paths to (if no project is given, the
     53 -- paths are added to /all/ projects).
     54 --
     55 -- NB: Each entry should be surrounded by curly braces, with each entry
     56 -- separated with a comma and appearing within the existing braces.
     57 --
     58 -- For example, to add the OgreSDK boost paths to build for the Ogre renderer
     59 -- module and sample helper with Ogre support, you might have:
     60 --
     61 -- CEGUI_EXTRA_PATHS = {
     62 --     { "../OgreSDK/boost_1_42", "", "lib", "CEGUIOgreRenderer" },
     63 --     { "../OgreSDK/boost_1_42", "", "lib", "CEGUISampleHelper" }
     64 -- }
     65 --
     66 CEGUI_EXTRA_PATHS = {
     67 }
     68 
     69 --- Irrlicht SDK Version
     70 --- 14 is means 1.4 or 1.5.x and 16 means 1.6 or 1.7.x (and above?)
     71 CEGUI_IRR_SDK_VERSION = 16
     72 
     73 --- OIS API version to be used in the Ogre samples base app.
     74 --- true: use older numKeyboards / numMice
     75 --- false: use getNumberOfDevices
     76 CEGUI_OLD_OIS_API = false
     77 
     78 --- Lua version
     79 --- 51 is 5.1 (and above?) From 0.7.0 onwards, lua 5.0 is no longer supported.
     80 CEGUI_LUA_VER = 51
     81 
     82 --- Freetype library
     83 --- CEGUI uses the freetype library for some of it's font support.  To disable
     84 --- the use of freetype, set this to false.
     85 CEGUI_USE_FREETYPE = true
     86 
     87 --- PCRE library
     88 --- CEGUI uses the pcre library for it's regular expression based string
     89 --- validation as used in the Editbox (and derived classes, such as Spinner).
     90 --- To disable the use of PCRE (and therefore the validation factilities), set
     91 --- this to false.  (Attempts to set validation string will throw).
     92 CEGUI_USE_PCRE_REGEX = true
     93 
     94 --- CEGUI::DefaultLogger
     95 --- To disable compilation and use of the CEGUI::DefaultLogger, set this to
     96 --- false.
     97 ---
     98 --- Note: If you disable this, you MUST provide an alternative CEGUI::Logger
     99 --- based class and instantiate it before creating the main CEGUI::System object.
    100 CEGUI_USE_DEFAULT_LOGGER = true
    101 
    102 --- BiDirectional text support.
    103 --- To enable support for bi-directional text in CEGUI, set CEGUI_BIDI_SUPPORT
    104 --- to true.
    105 --- With bidirectional support enabled, CEGUI_USE_MINIBIDI then controls whether
    106 --- that support is provided viaan embedded copy of minibidi (true) or an
    107 --- external copy of the fribidi library (false).
    108 CEGUI_BIDI_SUPPORT = false;
    109 CEGUI_USE_MINIBIDI = true;
    110 
    111 --- MinizipResourceProvider
    112 --- To enable compilation and inclusion into CEGUIBase of the MinizipResourceProvider
    113 --- set the following to true.
    114 ---
    115 --- The MinizipResourceProvider enables resources to be loaded from a zip compressed
    116 --- archive.
    117 MINIZIP_RESOURCE_PROVIDER = true
    118 
    119 -------------
    120 -- Renderers
    121 -- this controls which renderer modules are built
    122 OPENGL_RENDERER = true
    123 DIRECT3D9_RENDERER = false
    124 DIRECT3D10_RENDERER = false
    125 DIRECT3D11_RENDERER = false
    126 IRRLICHT_RENDERER = false
    127 OGRE_RENDERER = false
    128 NULL_RENDERER = false
    129 
    130 ----------------
    131 -- Image Codecs
    132 -- this controls which image codecs are built
    133 TGA_IMAGE_CODEC = true
    134 SILLY_IMAGE_CODEC = true
    135 DEVIL_IMAGE_CODEC = true
    136 FREEIMAGE_IMAGE_CODEC = true
    137 CORONA_IMAGE_CODEC = true
    138 STB_IMAGE_CODEC = true
    139 
    140 -- this setting selects the default image codec module
    141 -- can be either "tga", "silly", "devil", "freeimage", "stb" or "corona"
    142 -- SILLY was written for CEGUI
    143 DEFAULT_IMAGE_CODEC = "silly"
    144 
    145 ---------------
    146 -- Window Renderers
    147 -- controls window renderers built
    148 FALAGARD_WR = true
    149 
    150 -- default WR
    151 -- available: falagard
    152 DEFAULT_WINDOW_RENDERER = "falagard"
    153 
    154 
    155 
    156 
    157 ---------------
    158 -- XML parsers
    159 -- this controls which xml parser modules are built
    160 EXPAT_PARSER = true
    161 XERCES_PARSER = false
    162 TINYXML_PARSER = false
    163 RAPIDXML_PARSER = false
    164 LIBXML_PARSER = false
    165 
    166 -- this selects the default XML parser module
    167 -- can be either "expat", "xerces", "tinyxml", "rapidxml" or "libxml"
    168 DEFAULT_XML_PARSER = "expat"
    169 
    170 
    171 -------
    172 -- Lua
    173 -- this controls whether CEGUILua is enabled
    174 LUA_SCRIPT_MODULE = true
    175 
    176 -- disable this for a smaller and faster, but less safe Lua module
    177 -- only affects Release builds. Debug and ReleaseWithSymbols always
    178 -- enable this
    179 LUA_SCRIPT_MODULE_SAFE = false
    180 
    181 -- enable this to build the bundled tolua++ as a static library
    182 TOLUA_STATIC = false
    183 
    184 
    185 -------
    186 -- Python
    187 -- this controls whether building the Python extension modules is enabled
    188 PYTHON_EXTENSION_MODULE = false
    189 
    190 
    191 -----------
    192 -- Samples
    193 -- remember you have to edit CEGUISamplesConfig.h as well this just controls
    194 -- dependencies etc. if the renderer is disabled this has no effect
    195 SAMPLES_GL = true
    196 SAMPLES_DX9 = false
    197 SAMPLES_DX10 = false
    198 SAMPLES_IRRLICHT = false
    199 SAMPLES_OGRE = false
    200 
    201 -- this setting controls if the samples should be included in the same
    202 -- solution as the core libraries. If this setting is disabled you can
    203 -- still generate a seperate solution for the samples
    204 --
    205 -- due to a missing feature in premake enabling this will cause the
    206 -- output files to be placed in cegui_mk2/bin and not cegui_mk2/Samples/bin
    207 --
    208 SAMPLES_INCLUDED = true

    修改完成后就可以点击build_vs2008.bat生成sln文件了、如果遇到问题请参考最后的FAQ

    编译:

    然后就双击CEGUI.sln导入到vc2010吧、现在迩要决定的事情是到底是使用动态库还是静态库、因为到时候又要关系到示例文件的编译、而迩如果有实际项目需要的按实际情况而定、莪这里选择的是Release的动态版、所以首先做的就是把项目设置的编译方式改变、右键“解决方案”(记住是解决方案而不是项目、右键解决方案等同于全选项目文件然后再右键)、点击属性、打开了“解决方案属性页”、然后再点击配置属性、再点击窗口右边的“配置管理器”、将“活动解决方案配置”切换成Release就可以了、这里把Active翻译成活动总觉得怪怪的、是不是翻译成激活比较靠谱?   然后就右键“解决方案” -》 “生成解决方案”、就把所有项目都编译遍了、注意检测是否全部顺利通过、没通过一定是漏了哪些步骤、仔细检查、

    运行:

    然后在要目录下的bin就有许多Demo文件生成了、随便点击几个会出现缺斤短两的问题、所以就是刚刚下载演示包的原因了、把缺少的dll统统从演示包里拷贝到这个目录、然后就可以运行了、

    P.S.:注意Demo程序的上层目录必须有datafiles文件夹、里面有包括了Demo所需要的位置和其它信息、不然Demo程序会报错

    FAQ

    ====================================================================

    问题一:

    编译CEGUI自带的SAMPLE出错时: 

    samples.lua:7: could not load package `helpers' from path `;;C:\Program Files\Lu
    a\5.1\lua\?.luac'

    说明以前安装过了LUA、在环境变量设置了LUA_PATH、可以把电脑的环境变量暂时删除或者在生成sample的bat文件加上一句set LUA_PATH=

     

    问题二:

    运行build_samples_vs2008.bat出错(或者是其它的vs版本)、错误内容如下、

    No such package: Samples/InventoryDemo/premake.lua

    原因是当前目录下的Samples目录下没有InventoryDemo目录、可能是cegui开发人员的一时疏忽、解决方法也狠简单、随便拿其它一个文件夹复制一份、把文件夹名改为InventoryDemo、然后进入目录编辑premake.lua文件、将第四行的sample("xxxxxx")改成sample("InventoryDemo")保存就可以了

    参考资料:

    (CEGUI深入解析)

    http://ishare.iask.sina.com.cn/f/11896853.html?retcode=0

    (手把手教你如何配置和编译ogre 1.7.0 + cegui 0.7.1)

    http://bbs.gameres.com/showthread.asp?threadid=143238

  • 相关阅读:
    前言内容
    hibernate criteria中Restrictions的用法
    数据库默认端口
    MyEcplise2014集成SVN
    Java中的HashMap和HashTable到底哪不同?(原文参考来自码农网)
    MyEclipse控制台报错:java.lang.OutOfMemoryError: PermGen space
    版本管理软件Git 初感
    二分法,冒泡排序
    关于tail, head ,less ,more ,cat 之小介------Linux命令
    java:字符串反转
  • 原文地址:https://www.cnblogs.com/klobohyz/p/2547419.html
Copyright © 2011-2022 走看看