How to install CEGUI 0.8.4 With MinGW

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Revision as of 01:54, 25 October 2014 by Laputan (Talk | contribs)

Jump to: navigation, search

First, you need to download the CEGUI source package and its dependencies from The Official Site.
You also need to download and install CMake binary from here.

Second, you build the dependencies.
Build of the D3DX11 package is currently not supported. Moreover, this version of DirectX is deprecated.
You had better avoid using these features if possible.
Patch a few to build all packages successfully except for D3DX11.

In the pngwin.def at <dependencies_source_root>/src/libpng-1.4.7/scripts,
At Line 5, edit LIBRARY to LIBRARY libpng. libpng is the missing library name.

In the devil_internal_exports.h at <dependencies_source_root>/src/devil-1.7.8/include/IL,
At Line 29, change the definition of INLINE from external inline to static inline.
By this change, you can avoid some multiple definition error.

Then, you launch cmake-gui, click configure, select the MinGW Makefiles generator,
check all options except for CEGUI_BUILD_EFFECTS11 and CEGUI_GNUtoMS, configure again and generate.
If Cmake works successfully, you can see the Makefile at the target binary directory you choose.
Build it.
You could find built dependencies at <dependencies_binary_root>/dependencies.

Third, you build the CEGUI.
Move the dependencies directory where you built dependencies from <dependencies_binary_root> to <cegui_source_root>.

You also need to modify some files.

In the CMakeLists.txt at <cegui_source_root>/cegui/src,
Between Line 84 and Line 85, you have to add
if(MINGW)
target_link_libraries(${CEGUI_TARGET_NAME} <mingw_root>/lib/libshlwapi.a)
endif ()
This library is needed for the build of MiniZipResourceProvider.

And to solve the C++ mangling problem, you have to remake an import library to libxerces-c_3.dll.
To do this,
1.Export the .def file from libxerces-c_3.dll at <cegui_source_root>/dependencies/bin.
2.Modify the exported .def file.
3.Remake an import library from modified .def file.
4.Replace the libxerces-c_3.dll.a at <cegui_source_root>/dependencies/lib/dynamic/ with the new import library.

For example, with the built-in MinGW dlltool,
1.Run dlltool --export-all-symbols libxerces-c_3.dll -z temp.txt
2.At Line 6919, modify _ZN11xercesc_3_19XMLString7releaseEPPwPNS_13MemoryManagerE to _ZN11xercesc_3_19XMLString7releaseEPPtPNS_13MemoryManagerE = _ZN11xercesc_3_19XMLString7releaseEPPwPNS_13MemoryManagerE,
At Line 6977, modify _ZN11xercesc_3_19XMLString9transcodeEPKwPNS_13MemoryManagerE to _ZN11xercesc_3_19XMLString9transcodeEPKtPNS_13MemoryManagerE = _ZN11xercesc_3_19XMLString9transcodeEPKwPNS_13MemoryManagerE.
3.Run dlltool -d temp.txt -l libxerces-c_3.dll.a.
4.Replace.

This problem occurs because the number of User-defined types is different between CEGUI and its dependencies.

Then, you launch cmake-gui, click configure, select the MinGW Makefiles generator, uncheck CEGUI_BUILD_RENDERER_OPENGL3 and generate.
You should choose the target binary directory same as the source directory, because the reference to datafiles are fixed to the source directory.
If Cmake works successfully, you can see the Makefile at the target binary directory you choose.
Build it.
You could find built cegui-libraries at <cegui_binary_root>/bin.
Copy the dll files at <cegui_source_root>/dependencies/bin to this directory.

Finally, launch CEGUISampleFramework-0.8.
If you have successfully built all the things, you may enjoy a bunch of cegui demo.
Congratulations!