Compiling CEGUI under Windows 7 with Ogre support in Visual Studio

You can download the latest version of CEGUI, I used 0.7.7, and its dependencies in the download section of the webpage.

The compilation instructions can be found in the Main docs, section Supported systems and compilation. However, this documentation is not enough detailed to build this library with Ogre support.

Here are some additional steps and tips:

  1. Make sure that you have installed Ogre as an SDK. Unfortunately, CEGUI does not use CMake for generating the project files. As a consequence, an Ogre build with CMake must be installed in order to properly import headers and libraries in CEGUI.
  2. As explained in the documentation, unzip the sources. Then, the dependencies inside the sources folder.
  3. Go to projects/premake and edit the file config.lua. Make the following changes:
    1. WANT_RELEASE_WITH_SYMBOLS_BUILD = true
      WANT_STATIC_BUILD = false
      I need the release with debug symbols configuration, besides release and debug, and I want to generate only dlls.
    2. STATIC_BUILD_WITH_DYNAMIC_DEPS = true
      If you need the static versions of the libraries for using them with Ogre, make sure this is set to true, because Ogre links by default against the dynamic version of the C++ libraries. If you try to link an executable to a library that has C++ dynamic dependencies (/MD) and, at the same time, to another library that has C++ static dependencies (/MT), you will end up with a linking error 2005 in Visual Studio or potential errors passing CRT objects across DLL boundaries. Never mix C/C++ runtime libraries. Everything must be compiled with /MT or /MD (/MTd or /MDd for debugging).
    3. OGRE_PATHS = { “D:/Program Files (x86)/OGRE”, “include/OGRE”, “lib/$(Configuration)” }
      OIS_PATHS = { “D:/Program Files (x86)/OGRE”, “include/OIS”, “lib/$(Configuration)” }
      Make sure that this paths point to the Ogre SDK folder. The $(Configuration) in the linking path will be replaced in Visual Studio by the current configuration when building. Note: the release with debug info build will not work, because Ogre uses the typical RelWithDebInfo CMake name and CEGUI uses a different name, ReleaseWithSymbols. Open the solution file, choose theĀ ReleaseWithSymbols configuration, right click on the CEGUIOgreRenderer project, go to properties, Configuration Properties, Linker, General, Additional Library Directories. Replace D:/Program Files (x86)/OGRE/lib/$(Configuration) by D:/Program Files (x86)/OGRE/lib/RelWithDebInfo.
    4. CEGUI_EXTRA_PATHS = {
      { “D:/Program Files (x86)/boost/boost_1_51”, “”, “lib”, “CEGUIOgreRenderer” },
      { “D:/Program Files (x86)/boost/boost_1_51”, “”, “lib”, “CEGUISampleHelper” },
      { “D:/Program Files (x86)/Microsoft DirectX SDK”, “Include”, “Lib/x86”, “CEGUIDirect3D9Renderer” }
      }
      Add the boost path for building the OgreRenderer and the SampleHelper. Besides, add the path to the DirectX SDK for the Direct3D9Renderer.

     

That’s all. Run the *.bat in the config.lua folder for your Visual Studio version. If your MSVC++ version is missing, use the nearest version. MSVC++ will take care of upgrading the project files.

Advertisements