Saturday, October 19, 2013

Building CEGUI

Building CEGUI

Building CEGUI requires some of the same steps we've seen when building Ogre. This tutorial is designed for CEGUI version 0.8.2. It might work successfully on other versions as well.

Clone the repository

    Clone the Hg repository found at https://bitbucket.org/cegui/cegui. You can do this by going to a folder of your choice in Windows Explorer, right clicking a window background in Windows Explorer, selecting TortoiseHg from the context menu and then Clone from the sub-menu.

    You should receive a smaller window where you can specify the details of the clone operation. Here you should specify the  source (https://bitbucket.org/cegui/cegui) and the destination (E.g. C:\code\cegui_08). Just make sure you add the name of the sub-folder to use. Mercurial will not create a sub-folder otherwise. You should see that the text box on the bottom side of the window is updated according to the changes you perform. You could run the command provided there in a cmd window to get the same results.

    It might take a few minutes for the repository to be downloaded. After the clone operation is completed, you should be able to see the files in the local directory.



Update the repository to the used branch

    Go to the folder you used as a local clone; you should right click on the window background and bring up the context menu again. Select TortoiseHg from there and then click the Update entry from the sub-menu.

    You should be presented with the Update dialog, where you can select the branch to use for CEGUI. For this tutorial please select the v0-8 branch, then click the Update button. The procedure should be fairly similar for other branch versions.

Copy the build dependency binaries

    The CEGUI package should be able to find most of the files it has and dependencies. In order to be able to easily prepare the CEGUI solution, you should copy the dependencies to their standard location. You can always choose to use a different location, but that would take more time to set-up. Please copy the dependencies sub-folder from the CEGUI dependencies folder to the local CEGUI repository clone (E.g. copy c:\code\cegui-deps-0.8.x-src\dependencies to c:\code\cegui_08\dependencies ).

    Also copy the OGRE dependencies to the same folder. (E.g. copy c:\code\ogre\Dependencies to  c:\code\cegui\dependencies)


Configure and create the solution

    Now it is time to start CMake. Simply copy the destination you used in the repository cloning to the CMake text-box corresponding to the source code ("Where is the source code", E.g. c:\code\cegui_08\). Click the Configure button, select the default compiler and then click the Finish button.
    You can now customize the CEGUI build settings. I tend to leave a single image provider (CEGUI_BUILD_IMAGE_SILLY) and a single XML provider enabled (CEGUI_BUILD_XMLPARSER_EXPAT). I also remove the Direct3D and OpenGL renderers, as I only need the Ogre one.
Unmark the following options:
  • CEGUI_BUILD_RENDERER_DIRECT3D10
  • CEGUI_BUILD_RENDERER_DIRECT3D11
  • CEGUI_BUILD_RENDERER_DIRECT3D9
  • CEGUI_BUILD_RENDERER_OPENGL
  • CEGUI_BUILD_RENDERER_OPENGL3
  • CEGUI_SAMPLES_USE_DIRECT3D10
  • CEGUI_SAMPLES_USE_DIRECT3D11
  • CEGUI_SAMPLES_USE_DIRECT3D9
  • CEGUI_SAMPLES_USE_OPENGL
  • CEGUI_SAMPLES_USE_OPENGL3
 Mark the options:
  • CEGUI_BUILD_RENDERER_OGRE 
  • CEGUI_SAMPLES_USE_OGRE

Optional sub-step

Mark the check-box for Advanced settings. The list of options should be much larger now. Look for the entries related to OGRE and OIS. (E.g. OGRE_LIB, OIS_LIB). If these show up as -NOTFOUND entries, you should download the following files and place them (overwrite local files) in your cegui/cmake folder (E.g. c:\code\cegui\cmake):
    Using the standard files is not guaranteed to set-up the projects correctly. If the build process fails, it will most likely be due to an incorrect configuration.

    Click the Configure button. All lines should turn from red to white as a result. Finally, click the Generate button to create the projects and solution file. Keep an eye out on the log in the bottom side of the screen to identify any potential errors.

Build the solution

    Start the solution (E.g. c:\code\cegui\cegui.sln). Select the Release configuration and build it (F7).
Do the same for the Debug configuration.

    You can almost run the sample applications now. They should be built into the bin folder (E.g. c:\code\cegui\bin) .
You should also copy the dependencies DLLs from the dependencies/bin folder to the bin folder:
  • freetype.dll (freetype_d.dll for Debug)
  • expat.dll (expat_d.dll for Debug)
  • pcre.dll (pcre_d.dll for Debug)

   Also copy the DLLs from the Ogre bin folder [bin\release] or [bin\Debug]
  • OgreMain.dll (OgreMain_d.dll for Debug)
  • RenderSystem_Direct3D11.dll (RenderSystem_Direct3D11_d.dll for Debug)
  • RenderSystem_Direct3D9.dll (RenderSystem_Direct3D9_d.dll for Debug)
  • RenderSystem_GL.dll (RenderSystem_GL_d.dll for Debug)
  • Plugin_BSPSceneManager.dll (Plugin_BSPSceneManager_d.dll for Debug)
  • Plugin_CgProgramManager.dll (Plugin_CgProgramManager_d.dll for Debug)
  • Plugin_OctreeSceneManager.dll (Plugin_OctreeSceneManager_d.dll for Debug)
  • Plugin_OctreeZone.dll (Plugin_OctreeZone_d.dll for Debug)
  • Plugin_ParticleFX.dll (Plugin_ParticleFX_d.dll for Debug)
  • Plugin_PCZSceneManager.dll (Plugin_PCZSceneManager_d.dll for Debug)
  • plugins.cfg (plugins_d.cfg for Debug)
    Also copy the DLLs from the ogre dependencies bin\Release (E.g. c:\code\ogredeps\build\bin\Release\) and Debug (E.g. c:\code\ogredeps\build\bin\Debug)
  • cg.dll (same file for debug)
  • OIS.dll (OIS_d.dll for debug)


    If you run into any issues with the Ogre configuration, just edit (or delete) the ogre.cfg file.
For Ogre 1.9, this should be in the folder [%userprofile%\Documents\Ogre\Ghadamon]

1 comment:

  1. thx a lot. I was missing to copy the dependencies dlls to my Ogre project

    ReplyDelete