From d3dc40229cd88e99e622dd699b868c79e8e7000d Mon Sep 17 00:00:00 2001 From: Quintus Date: Tue, 19 Jul 2016 19:38:53 +0200 Subject: Start work to upgrade to CEGUI 0.8.x. The build fails in the OpenGL parser with "_imp__" errors in GLEW currently. --- src/cegui-find-glew32.patch | 17 ++++++++ src/cegui-test.cpp | 37 +++++++++-------- src/cegui.mk | 97 +++++++++++++++++++++++++-------------------- 3 files changed, 92 insertions(+), 59 deletions(-) create mode 100644 src/cegui-find-glew32.patch diff --git a/src/cegui-find-glew32.patch b/src/cegui-find-glew32.patch new file mode 100644 index 0000000..8f76d2c --- /dev/null +++ b/src/cegui-find-glew32.patch @@ -0,0 +1,17 @@ +--- cmake/FindGLEW.cmake.orig 2016-07-19 14:11:06.255586305 +0200 ++++ cmake/FindGLEW.cmake 2016-07-19 14:11:35.454653035 +0200 +@@ -4,12 +4,12 @@ + include(FindPackageHandleStandardArgs) + + find_path(GLEW_H_PATH NAMES GL/glew.h) +-find_library(GLEW_LIB NAMES GLEW libGLEW glew libglew PATH_SUFFIXES dynamic) ++find_library(GLEW_LIB NAMES glew32 GLEW libGLEW glew libglew PATH_SUFFIXES dynamic) + find_library(GLEW_LIB_DBG NAMES GLEW_d libGLEW_d glew_d libglew_d PATH_SUFFIXES dynamic) + mark_as_advanced(GLEW_H_PATH GLEW_LIB GLEW_LIB_DBG) + + if (WIN32 OR APPLE) +- find_library(GLEW_LIB_STATIC NAMES GLEW libGLEW glew libglew PATH_SUFFIXES static) ++ find_library(GLEW_LIB_STATIC NAMES glew32 GLEW libGLEW glew libglew PATH_SUFFIXES static) + find_library(GLEW_LIB_STATIC_DBG NAMES GLEW_d libGLEW_d glew_d libglew_d PATH_SUFFIXES static) + mark_as_advanced(GLEW_LIB_STATIC GLEW_LIB_STATIC_DBG) + endif() diff --git a/src/cegui-test.cpp b/src/cegui-test.cpp index 88c2cf1..36b5bf3 100644 --- a/src/cegui-test.cpp +++ b/src/cegui-test.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include // We’re lazy using namespace CEGUI; @@ -34,21 +34,21 @@ int main(int argc, char* argv[]) // Tell CEGUI where to find its resources DefaultResourceProvider* p_provider = static_cast(System::getSingleton().getResourceProvider()); - p_provider->setResourceGroupDirectory("schemes", "../share/CEGUI/schemes"); - p_provider->setResourceGroupDirectory("imagesets", "../share/CEGUI/imagesets"); - p_provider->setResourceGroupDirectory("fonts", "../share/CEGUI/fonts"); - p_provider->setResourceGroupDirectory("layouts", "../share/CEGUI/layouts"); - p_provider->setResourceGroupDirectory("looknfeels", "../share/CEGUI/looknfeel"); - p_provider->setResourceGroupDirectory("lua_scripts", "../share/CEGUI/lua_scripts"); - p_provider->setResourceGroupDirectory("schemas", "../share/CEGUI/xml_schemas"); - p_provider->setResourceGroupDirectory("animations", "../share/CEGUI/animations"); + p_provider->setResourceGroupDirectory("schemes", "../share/cegui-0/schemes"); + p_provider->setResourceGroupDirectory("imagesets", "../share/cegui-0/imagesets"); + p_provider->setResourceGroupDirectory("fonts", "../share/cegui-0/fonts"); + p_provider->setResourceGroupDirectory("layouts", "../share/cegui-0/layouts"); + p_provider->setResourceGroupDirectory("looknfeels", "../share/cegui-0/looknfeel"); + p_provider->setResourceGroupDirectory("lua_scripts", "../share/cegui-0/lua_scripts"); + p_provider->setResourceGroupDirectory("schemas", "../share/cegui-0/xml_schemas"); + p_provider->setResourceGroupDirectory("animations", "../share/cegui-0/animations"); // Map the resource request to our provider - Imageset::setDefaultResourceGroup("imagesets"); - Font::setDefaultResourceGroup("fonts"); Scheme::setDefaultResourceGroup("schemes"); - WidgetLookManager::setDefaultResourceGroup("looknfeels"); + ImageManager::setImagesetDefaultResourceGroup("imagesets"); + Font::setDefaultResourceGroup("fonts"); WindowManager::setDefaultResourceGroup("layouts"); + WidgetLookManager::setDefaultResourceGroup("looknfeels"); ScriptModule::setDefaultResourceGroup("lua_scripts"); AnimationManager::setDefaultResourceGroup("animations"); XMLParser* p_parser = System::getSingleton().getXMLParser(); @@ -57,18 +57,21 @@ int main(int argc, char* argv[]) p_parser->setProperty("SchemaDefaultResourceGroup", "schemas"); // Configure the default window layouting - SchemeManager::getSingleton().create("TaharezLook.scheme"); - System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow"); + SchemeManager::getSingleton().createFromFile("TaharezLook.scheme"); + + // Mouse cursor + CEGUI::GUIContext& gui_context = CEGUI::System::getSingleton().getDefaultGUIContext(); + gui_context.getMouseCursor().setDefaultImage("TaharezLook/MouseArrow"); // Create the hypothetical CEGUI root window Window* p_root_window = WindowManager::getSingleton().createWindow("DefaultWindow", "root"); - System::getSingleton().setGUISheet(p_root_window); + gui_context.setRootWindow(p_rootwindow); // Create an actual framed window we can look onto FrameWindow* p_frame_window = static_cast(WindowManager::getSingleton().createWindow("TaharezLook/FrameWindow", "testWindow")); p_root_window->addChildWindow(p_frame_window); p_frame_window->setPosition(UVector2(UDim(0.25f, 0), UDim(0.25f, 0))); - p_frame_window->setSize(UVector2(UDim(0.5f, 0), UDim(0.5f, 0))); + p_frame_window->setSize(USize(UDim(0.5f, 0), UDim(0.5f, 0))); p_frame_window->setText("Hello World!"); // Enter main loop @@ -90,7 +93,7 @@ void main_loop() glutMainLoopEvent(); // Process events glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear the window background to a single color glFlush(); - System::getSingleton().renderGUI(); // Tell CEGUI to render all its stuff + CEGUI::System::getSingleton().renderAllGUIContexts(); // Tell CEGUI to render all its stuff glutSwapBuffers(); // Put the auxiliary rendering buffer onto the screen and make the screen the new auxiliary buffer. } } diff --git a/src/cegui.mk b/src/cegui.mk index a7e22ed..77463b5 100644 --- a/src/cegui.mk +++ b/src/cegui.mk @@ -3,12 +3,15 @@ PKG := cegui $(PKG)_IGNORE := -$(PKG)_VERSION := 0.7.9 -$(PKG)_CHECKSUM := 7c3b264def08b46de749c2acaba363e907479d924612436f3bd09da2e474bb8c -$(PKG)_SUBDIR := CEGUI-$($(PKG)_VERSION) -$(PKG)_FILE := CEGUI-$($(PKG)_VERSION).tar.gz -$(PKG)_URL := http://$(SOURCEFORGE_MIRROR)/project/crayzedsgui/CEGUI%20Mk-2/$($(PKG)_VERSION)/$($(PKG)_FILE)?download -$(PKG)_DEPS := gcc expat freeglut freeimage freetype libxml2 pcre xerces +$(PKG)_VERSION := 0.8.7 +$(PKG)_CHECKSUM := b351e8957716d9c170612c13559e49530ef911ae4bac2feeb2dacd70b430e518 +$(PKG)_SUBDIR := cegui-$($(PKG)_VERSION) +$(PKG)_FILE := cegui-$($(PKG)_VERSION).tar.bz2 +$(PKG)_URL := http://$(SOURCEFORGE_MIRROR)/project/crayzedsgui/CEGUI%20Mk-2/0.8/$($(PKG)_FILE)?download +$(PKG)_DEPS := gcc expat freeglut freeimage freetype libxml2 pcre xerces devil glm glew + +# Does not detect the freetype header directory otherwise +#$(PKG)_CXXFLAGS := -I/home/quintus/repos/privat/projekte/misc/mxe/usr/i686-w64-mingw32.static/include/freetype2 -I/home/quintus/repos/privat/projekte/misc/mxe/usr/i686-w64-mingw32.static/include define $(PKG)_UPDATE $(WGET) -q -O- 'https://bitbucket.org/cegui/cegui/downloads' | \ @@ -18,46 +21,56 @@ define $(PKG)_UPDATE tail -1 endef +# The shell escape is required to make CEGUI find the freetype2 header +# directory, and to define the FREEIMAGE_LIB macro that prevents "_imp__" +# errors when linking to freeimage. The glew one is required to +# define GLEW_STATIC, but this is not completed yet (still gives "_imp__" +# errors on glew). +# cd '$(1)' && $(PATCH) < $(TOP_DIR)/src/cegui-find-glew32.patch define $(PKG)_BUILD - cd '$(1)' && ./configure \ - --host='$(TARGET)' \ - --disable-shared \ - --prefix='$(PREFIX)/$(TARGET)' \ - --enable-freetype \ - --enable-pcre \ - --enable-xerces-c \ - --enable-libxml \ - --enable-expat \ - --disable-corona \ - --disable-devil \ - --enable-freeimage \ - --disable-silly \ - --enable-tga \ - --disable-tinyxml \ - --enable-stb \ - --enable-opengl-renderer \ - --disable-ogre-renderer \ - --disable-irrlicht-renderer \ - --disable-directfb-renderer \ - --enable-null-renderer \ - --disable-samples \ - --disable-lua-module \ - --disable-python-module \ - PKG_CONFIG='$(TARGET)-pkg-config' \ - CFLAGS="`$(TARGET)-pkg-config --cflags glut freeimage`" \ - CXXFLAGS="`$(TARGET)-pkg-config --cflags glut freeimage`" \ - LDFLAGS="`$(TARGET)-pkg-config --libs glut freeimage`" - $(MAKE) -C '$(1)' -j '$(JOBS)' - $(SED) -i 's/Cflags:\(.*\)/Cflags: \1 -DCEGUI_STATIC/' '$(1)/cegui/CEGUI.pc' - $(MAKE) -C '$(1)' -j '$(JOBS)' install + mkdir '$(1)/build' + $(PATCH) '$(1)/cmake/FindGLEW.cmake' '$(TOP_DIR)/src/cegui-find-glew32.patch' + cd '$(1)/build' && cmake .. \ + -DCMAKE_TOOLCHAIN_FILE='$(CMAKE_TOOLCHAIN_FILE)' \ + -DCMAKE_CXX_FLAGS="$($(PKG)_CXXFLAGS) $(shell $(TARGET)-pkg-config --cflags freetype2 glew freeimage)" \ + -DCEGUI_BUILD_STATIC_CONFIGURATION=$(if $(BUILD_STATIC),true,false) \ + -DCEGUI_SAMPLES_ENABLED=OFF \ + -DCEGUI_BUILD_TESTS=OFF \ + -DCEGUI_BUILD_APPLICATION_TEMPLATES=OFF \ + -DCEGUI_BUILD_LUA_MODULE=OFF \ + -DCEGUI_BUILD_PYTHON_MODULES=OFF \ + -DCEGUI_BUILD_XMLPARSER_XERCES=ON \ + -DCEGUI_BUILD_XMLPARSER_LIBXML2=OFF \ + -DCEGUI_BUILD_XMLPARSER_EXPAT=ON \ + -DCEGUI_BUILD_XMLPARSER_TINYXML=OFF \ + -DCEGUI_BUILD_XMLPARSER_RAPIDXML=OFF \ + -DCEGUI_BUILD_IMAGECODEC_CORONA=OFF \ + -DCEGUI_BUILD_IMAGECODEC_DEVIL=OFF \ + -DCEGUI_BUILD_IMAGECODEC_FREEIMAGE=ON \ + -DCEGUI_BUILD_IMAGECODEC_PVR=OFF \ + -DCEGUI_BUILD_IMAGECODEC_SDL2=OFF \ + -DCEGUI_BUILD_IMAGECODEC_SILLY=OFF \ + -DCEGUI_BUILD_IMAGECODEC_STB=ON \ + -DCEGUI_BUILD_IMAGECODEC_TGA=ON \ + -DCEGUI_BUILD_RENDERER_DIRECT3D10=OFF \ + -DCEGUI_BUILD_RENDERER_DIRECT3D11=OFF \ + -DCEGUI_BUILD_RENDERER_DIRECT3D9=OFF \ + -DCEGUI_BUILD_RENDERER_DIRECTFB=OFF \ + -DCEGUI_BUILD_RENDERER_IRRLICHT=OFF \ + -DCEGUI_BUILD_RENDERER_NULL=ON \ + -DCEGUI_BUILD_RENDERER_OGRE=OFF \ + -DCEGUI_BUILD_RENDERER_OPENGL=ON \ + -DCEGUI_BUILD_RENDERER_OPENGL3=OFF \ + -DCEGUI_BUILD_RENDERER_OPENGLES=OFF + + $(MAKE) -C '$(1)/build' -j '$(JOBS)' install VERBOSE=1 '$(TARGET)-g++' \ -W -Wall -ansi -pedantic \ - '$(2).cpp' \ - `'$(TARGET)-pkg-config' --cflags --libs CEGUI-OPENGL glut freetype2 libpcre` \ - -lCEGUIFreeImageImageCodec -lCEGUIXercesParser -lCEGUIFalagardWRBase \ - `'$(TARGET)-pkg-config' --libs --cflags freeimage xerces-c` \ - -o '$(PREFIX)/$(TARGET)/bin/test-cegui.exe' + '$(2).cpp' -o '$(PREFIX)/$(TARGET)/bin/test-cegui.exe' \ + `$(TARGET)-pkg-config --cflags --libs CEGUI-0-OPENGL glut freetype2 libpcre` \ + -lCEGUIFreeImageImageCodec -lCEGUIXercesParser -lCEGUICoreWindowRendererSet \ + `$(TARGET)-pkg-config --libs --cflags freeimage xerces-c` endef $(PKG)_BUILD_x86_64-w64-mingw32 = -- cgit v0.12