How to install CEGUI 0.8.4 With MinGW

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

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 a 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 this feature 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 the Line 5, modify 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 the Line 29, change the definition of INLINE from external inline to static inline.
By this change, you can avoid some multiple definition error.

Then, 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 have worked successfully, you can see the Makefile at the target binary directory you choose.
Build it.
You can find the built dependencies at <dependencies_binary_root>/dependencies.

Third, you build the CEGUI.
Move the dependencies directory where you built the 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 the Line 84 and the Line 85, you have to add
if(MINGW)
target_link_libraries(${CEGUI_TARGET_NAME} <mingw_root>/lib/libshlwapi.a)
endif ()
Do not forget to replace <mingw_root> with the path to the root directory of the MinGW on your PC.
This library is needed for the build of MiniZipResourceProvider.

And to solve the C++ mangling problem, you have to remake an import library for the 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 the 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.Edit the temp.txt.
At the Line 6919, modify _ZN11xercesc_3_19XMLString7releaseEPPwPNS_13MemoryManagerE to _ZN11xercesc_3_19XMLString7releaseEPPtPNS_13MemoryManagerE = _ZN11xercesc_3_19XMLString7releaseEPPwPNS_13MemoryManagerE.
At the 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 the old one with the new one.

This problem occurs because the mangling order of User-defined types is not necessarily the same between the CEGUI and its dependencies.

Then, launch cmake-gui, click configure, select the MinGW Makefiles generator, uncheck CEGUI_BUILD_RENDERER_OPENGL3, reconfigure and generate.
You should choose the target binary directory same as the source directory, because the reference to datafiles is fixed to the source directory.
Note that OPENGL3 is not supported for this installation on Windows.
If Cmake have worked successfully, you can see the Makefile at the target binary directory you choose.
Build it.
You can find the 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 demos.
Congratulations!