Difference between revisions of "Building CEGUI for Ogre / OgreRenderer"

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Jump to: navigation, search
(CEGUI 0.8.x)
(CEGUI 0.8.x)
Line 32: Line 32:
 
* 9 In case CMake didn't found OGRE or other mandatory packages then you neeed to add some entries. For example, if the OGRE package was not found then you need to set the following variables:
 
* 9 In case CMake didn't found OGRE or other mandatory packages then you neeed to add some entries. For example, if the OGRE package was not found then you need to set the following variables:
  
<p>OGRE_H_BUILD_SETTINGS_PATH - variable of type PATH which must be set to Ogre'sbuild settings header file (e.g. C:/soft/OgreSDK/build/include/OgreBuildSettings.h)
+
<p>OGRE_H_BUILD_SETTINGS_PATH - variable of type PATH which must be set to Ogre'sbuild settings header file (e.g. C:/soft/OgreSDK/build/include/OgreBuildSettings.h)</p>
 
<p>OGRE_H_PATH (earlier: OGRE_INCLUDE_DIR) - variable of type PATH which must be set to the directory where the OGRE header files are (e.g. C:/soft/OgreSDK/OgreMain/include)</p>
 
<p>OGRE_H_PATH (earlier: OGRE_INCLUDE_DIR) - variable of type PATH which must be set to the directory where the OGRE header files are (e.g. C:/soft/OgreSDK/OgreMain/include)</p>
 
<p>OGRE_LIBRARIES - variable of type FILEPATH which must be set to the full file path of OgreMain.lib (e.g. OGRE_HOME/lib/release/OgreMain.lib)</p>
 
<p>OGRE_LIBRARIES - variable of type FILEPATH which must be set to the full file path of OgreMain.lib (e.g. OGRE_HOME/lib/release/OgreMain.lib)</p>

Revision as of 23:14, 29 December 2013

Written for CEGUI 0.7


Works with versions 0.7.x (obsolete)

Written for CEGUI 0.8


Works with versions 0.8.x (stable)

Works with latest CEGUI stable!

This article is a work in progress and thus incomplete


General

Since Ogre version 1.7 the CEGUI library has stopped being an Ogre dependency and was replaced with a very simple UI overlay used for the demos. Users now have to compile the CEGUI against Ogre by themselves. This guide was made to help accomplish this.

This means that from now on, you have to build CEGUI for your Ogre project yourself, in case you want to use the latest Ogre or CEGUI versions. Otherwise, you can grab the latest precompiled dependencies from the Ogre download section and the CEGUI download section.


The recommended approach however is to build CEGUI against the Ogre version you want to use.

Here are all the links you will need to build CEGUI and its dependencies - which is the recommended approach:

  • Visit the reference manual for instructions on obtaining the CEGUI source code.

Note: If the branch version's source code seems to be unstable or not working at all, you can try the latest stable release

  • Additionally to the CEGUI source code you will need the source code of the CEGUI dependencies. Download it and build the dependencies on your system (debug & release modes are common and are recommended to be built). You can use this document as guideline for the building process if needed: Building dependencies. Move the "dependencies" folder, which should have been created during the build process and should contain the headers, .lib files and .dll files, into your CEGUI main folder, so that it will co-exist next to the folders "bin", "cegui", "datafiles" etc.

Step-by-step guide

  • 1. Get the appropriate CEGUI version from the CEGUI download page or get the very latest CEGUI version from the SVN repository (see links and info above).
  • 2. Get the latest Ogre version. If you are compiling it yourself, you will need to build it first to get Ogre's .lib and .dll files ready for CEGUI.

Steps for Microsoft Visual Studio

CEGUI 0.8.x

  • 3 Open the CMake GUI Utility
  • 4 Set the source path to the directory where your CEGUI files are located (e.g. C:/soft/cegui/cegui-0.8.3)
  • 5 Set the build path to the directory where you want CMake to generate your build configuration(e.g. C:/soft/cegui/cegui-0.8.3/build)
  • 6 Press the Configure button. At this stage CMake will ask you for a generator for this project(e.g. Visual Studio 10) and then will try to find the required packages needed by CEGUI. Please note that you should have the CEGUI dependencies built and installed in your CEGUI_ROOT directory.
  • 7 Search the CEGUI_BUILD_RENDERER_OGRE boolean variable in the list of CMake GUI Utility and set the value to TRUE by clicking on the checkbox. Optionally, you can set the CEGUI_SAMPLES_USE_OGRE aswell.
  • 8 Check if Boost, OGRE and OIS were found by cmake. Look in the CMake GUI Utility output and if you spot a message like 'Could NOT find OGRE' then you need to set some variables manually, otherwise you can jump to step #10
  • 9 In case CMake didn't found OGRE or other mandatory packages then you neeed to add some entries. For example, if the OGRE package was not found then you need to set the following variables:

OGRE_H_BUILD_SETTINGS_PATH - variable of type PATH which must be set to Ogre'sbuild settings header file (e.g. C:/soft/OgreSDK/build/include/OgreBuildSettings.h)

OGRE_H_PATH (earlier: OGRE_INCLUDE_DIR) - variable of type PATH which must be set to the directory where the OGRE header files are (e.g. C:/soft/OgreSDK/OgreMain/include)

OGRE_LIBRARIES - variable of type FILEPATH which must be set to the full file path of OgreMain.lib (e.g. OGRE_HOME/lib/release/OgreMain.lib)

OGRE_LIBRARIES_DBG(optional - if you don't intend to debug or are using CEGUI's "Release with Debug" build) - variable of type FILEPATH which must be set to the full file path of OgreMain_d.lib (e.g. OGRE_HOME/lib/debug/OgreMain_d.lib)

( not in 0.8.3: OGRE_FOUND - variable of type BOOL which must be set to TRUE )

  • 10 Rerun Configure. You need to do this in order to save your additional variables in the CMake cache and in the build configuration.Note that cmake will still say that it didn't found your package even if you set the variables correctly but when you will generate a solution, cmake will take the correct values from its cache.
  • 11 Press the Generate button. At this stage CMake will read your build configuration and then generate a solution using your selected generator.
  • 12 Go to the cegui build directory and open the Visual Studio solution cegui.sln
  • 13 Add boost include directory(BOOST_ROOT) and libraries(BOOST_ROOT/lib or BOOST_ROOT/stage/lib) to the additional include directories and additional library directories for the CEGUIOgreRenderer-0 project. You need to do this because Ogre forwards the boost dependency to CEGUI. If you set the CEGUI_SAMPLES_USE_OGRE then you need to do the same thing for the CEGUISampleFramework-0.8 project.
  • 14 Build the entire cegui solution
  • 15 (Optional) Build the INSTALL project(skipped by default) inside cegui.sln to install cegui and ogre renderer to Program Files/cegui

CEGUI 0.7.x

  • 3. In your CEGUI folder there should be a folder called "projects" with a subfolder called "premake". It is recommended to use the custom premake version of CEGUI. Otherwise you can get version 3.6 or 3.7 of premake. Once you have premake extract the premake.exe file into the said folder.
  • 4. Open config.lua in the premake folder and edit the Ogre and OIS paths accordingly, so that they will point to the dependency files. In my case for example the 2 lines look like this (having the OGRE and CEGUI main folders on the same level):
OGRE_PATHS = { "../OGRE", "include/OGRE", "lib" }
OIS_PATHS = { "../OGRE", "include/OIS", "lib" }

Note: Remember to use forward slashes here! Just copying the paths from the Windows explorer will give you backward slashes. Replace them!

Next, set all Renderers you do not need to "false", in this case we will only need OGRE_RENDERER. You can also set all samples to false, except maybe SAMPLES_OGRE if you want to compile those.

Important: Since Ogre 1.7 the "boost" library is a new dependency of OGRE. If you are unsure if your Ogre version needs boost, you might want to check if there is a boost folder in your Ogre main folder. In case your Ogre version makes use of boost, you will additionally add boost to the extra paths of CEGUIOgreRenderer, in my case it looks like this:

CEGUI_EXTRA_PATHS = { 
{ "../OGRE/boost_1_42", "", "lib", "CEGUIOgreRenderer" }
 }
  • 5. Next, we create our Visual Studio Projects - Execute build_vs2008.bat to create a Visual Studio 2008 project or execute any other .bat file for your respective compiler version.
  • 6. This should create CEGUI.sln in the premake folder. Open it.
  • 7. If you have the Ogre lib files seperated into a Debug and Release folder, you will have to change the path in the Linker settings of the project so they will point to the lib/Debug or lib/Release folder for each configuration respectively.
  • 8. Build the CEGUIOgreRenderer in Debug and Release mode.
  • 9. Now that you have built the .dll files and .lib files for CEGUI by yourself, you only have to change the linker settings of your project so that the needed .lib files and their folder paths are included there. Also you might want to include the dll's into a folder where your executable application will find them (for example just the folder your executable starts from). Finally remember to set the CEGUI include directory (for example "..\..\CEGUI\cegui\include\cegui") inside your C++ project settings.

Steps for GNU and Unix-like environments

CEGUI 0.8.x

TODO

CEGUI 0.7.x

Going to the extracted CEGUI source directory and running the following commands seems to work (noobnote: don't include the dollar-signs at the start of the lines. They represent the prompt.):

$ ./bootstrap && mkdir build && cd build

$ export NUMBER_OF_CORES=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $4}'`

$ ../configure && make -j$NUMBER_OF_CORES

$ sudo make install

$ sudo ldconfig


If everything worked out, you now have CEGUI up and running!

Questions

Feel free to edit this page using your CEGUI forum account login if you want to append something. If you have questions you can ask in the CEGUI forum or join our IRC channel #cegui on irc.freenode.net - In case you need help building Ogre in general, I'd recommend reading for example this short guide (might be outdated though).


For the Ogre-wiki version of this article you can also check this link: http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Building+CEGUI