From 16938adfc00b3c56a7b08a9eb97160b68902bae6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lo=C3=AFc=20Blot?= Date: Tue, 20 Jun 2017 17:18:34 +0200 Subject: [PATCH] Merge cguittfont lib in irrlicht change folder. (#6016) * Merge cguittfont lib in irrlicht change folder. This remove hack and static lib for FreeType --- src/CMakeLists.txt | 12 +------- src/cguittfont/CMakeLists.txt | 30 ------------------- src/cguittfont/xCGUITTFont.cpp | 5 ---- src/cguittfont/xCGUITTFont.h | 7 ----- src/fontengine.cpp | 2 +- src/guiChatConsole.cpp | 2 +- .../CGUITTFont.cpp | 0 .../CGUITTFont.h | 3 +- src/irrlicht_changes/CMakeLists.txt | 11 ++++++- .../irrUString.h | 2 ++ src/irrlicht_changes/static_text.cpp | 7 +---- util/travis/clang-format-whitelist.txt | 7 ++--- 12 files changed, 21 insertions(+), 67 deletions(-) delete mode 100644 src/cguittfont/CMakeLists.txt delete mode 100644 src/cguittfont/xCGUITTFont.cpp delete mode 100644 src/cguittfont/xCGUITTFont.h rename src/{cguittfont => irrlicht_changes}/CGUITTFont.cpp (100%) rename src/{cguittfont => irrlicht_changes}/CGUITTFont.h (99%) rename src/{cguittfont => irrlicht_changes}/irrUString.h (99%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ad5639a48..9e53b0e2c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -151,8 +151,6 @@ if(ENABLE_FREETYPE) if(FREETYPE_FOUND) message(STATUS "Freetype enabled.") set(USE_FREETYPE TRUE) - set(CGUITTFONT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cguittfont") - set(CGUITTFONT_LIBRARY cguittfont) endif() endif(ENABLE_FREETYPE) @@ -560,7 +558,7 @@ include_directories( if(USE_FREETYPE) - include_directories(${FREETYPE_INCLUDE_DIRS} ${CGUITTFONT_INCLUDE_DIR}) + include_directories(${FREETYPE_INCLUDE_DIRS}) endif() if(USE_CURL) @@ -619,7 +617,6 @@ if(BUILD_CLIENT) target_link_libraries( ${PROJECT_NAME} ${FREETYPE_LIBRARY} - ${CGUITTFONT_LIBRARY} ) endif() if (USE_CURSES) @@ -878,10 +875,3 @@ if (USE_GETTEXT) add_custom_target(translations ALL COMMENT "mo update" DEPENDS ${MO_FILES}) endif() - - -# Subdirectories - -if (BUILD_CLIENT AND USE_FREETYPE) - add_subdirectory(cguittfont) -endif() diff --git a/src/cguittfont/CMakeLists.txt b/src/cguittfont/CMakeLists.txt deleted file mode 100644 index 6cd35f310..000000000 --- a/src/cguittfont/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# CGUITTFont authors, y u no include headers you use? -# Do not add CGUITTFont.cpp to the line below. -# xCGUITTFont.cpp is a wrapper file that includes -# additional required headers. -add_library(cguittfont STATIC xCGUITTFont.cpp) - -if(FREETYPE_PKGCONFIG_FOUND) - set_target_properties(cguittfont - PROPERTIES - COMPILE_FLAGS "${FREETYPE_CFLAGS_STR}" - LINK_FLAGS "${FREETYPE_LDFLAGS_STR}" - ) - - include_directories( - ${IRRLICHT_INCLUDE_DIR} - ) -else(FREETYPE_PKGCONFIG_FOUND) - include_directories( - ${IRRLICHT_INCLUDE_DIR} - ${FREETYPE_INCLUDE_DIRS} - ) -endif(FREETYPE_PKGCONFIG_FOUND) - -target_link_libraries( - cguittfont - ${IRRLICHT_LIBRARY} - ${FREETYPE_LIBRARY} - ${ZLIB_LIBRARIES} # needed by freetype, repeated here for safety - ) - diff --git a/src/cguittfont/xCGUITTFont.cpp b/src/cguittfont/xCGUITTFont.cpp deleted file mode 100644 index c51922e4c..000000000 --- a/src/cguittfont/xCGUITTFont.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// A wrapper source file to avoid hack with gcc and modifying -// the CGUITTFont files. - -#include "xCGUITTFont.h" -#include "CGUITTFont.cpp" diff --git a/src/cguittfont/xCGUITTFont.h b/src/cguittfont/xCGUITTFont.h deleted file mode 100644 index c3efe7f6f..000000000 --- a/src/cguittfont/xCGUITTFont.h +++ /dev/null @@ -1,7 +0,0 @@ -// A wrapper header to avoid hack with gcc and modifying -// the CGUITTFont files. - -#include -#include -#include "irrUString.h" -#include "CGUITTFont.h" diff --git a/src/fontengine.cpp b/src/fontengine.cpp index 2c277a04e..536828ede 100644 --- a/src/fontengine.cpp +++ b/src/fontengine.cpp @@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #if USE_FREETYPE #include "gettext.h" -#include "xCGUITTFont.h" +#include "irrlicht_changes/CGUITTFont.h" #endif /** maximum size distance for getting a "similar" font size */ diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp index ecd280f5e..7e90bf43a 100644 --- a/src/guiChatConsole.cpp +++ b/src/guiChatConsole.cpp @@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #if USE_FREETYPE - #include "xCGUITTFont.h" + #include "irrlicht_changes/CGUITTFont.h" #endif inline u32 clamp_u8(s32 value) diff --git a/src/cguittfont/CGUITTFont.cpp b/src/irrlicht_changes/CGUITTFont.cpp similarity index 100% rename from src/cguittfont/CGUITTFont.cpp rename to src/irrlicht_changes/CGUITTFont.cpp diff --git a/src/cguittfont/CGUITTFont.h b/src/irrlicht_changes/CGUITTFont.h similarity index 99% rename from src/cguittfont/CGUITTFont.h rename to src/irrlicht_changes/CGUITTFont.h index 77c9e34f8..7ce898369 100644 --- a/src/cguittfont/CGUITTFont.h +++ b/src/irrlicht_changes/CGUITTFont.h @@ -35,6 +35,7 @@ #include #include #include +#include "irrUString.h" #include "util/enriched_string.h" #include FT_FREETYPE_H @@ -268,7 +269,7 @@ namespace gui virtual void draw(const core::stringw& text, const core::rect& position, video::SColor color, bool hcenter=false, bool vcenter=false, const core::rect* clip=0); - + virtual void draw(const EnrichedString& text, const core::rect& position, video::SColor color, bool hcenter=false, bool vcenter=false, const core::rect* clip=0); diff --git a/src/irrlicht_changes/CMakeLists.txt b/src/irrlicht_changes/CMakeLists.txt index 3a265c99d..d2f66ab77 100644 --- a/src/irrlicht_changes/CMakeLists.txt +++ b/src/irrlicht_changes/CMakeLists.txt @@ -1,7 +1,16 @@ if (BUILD_CLIENT) set(client_irrlicht_changes_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/static_text.cpp - PARENT_SCOPE ) + + if (ENABLE_FREETYPE) + set(client_irrlicht_changes_SRCS ${client_irrlicht_changes_SRCS} + ${CMAKE_CURRENT_SOURCE_DIR}/CGUITTFont.cpp + ) + endif() + + # CMake require us to set a local scope and then parent scope + # Else the last set win in parent scope + set(client_irrlicht_changes_SRCS ${client_irrlicht_changes_SRCS} PARENT_SCOPE) endif() diff --git a/src/cguittfont/irrUString.h b/src/irrlicht_changes/irrUString.h similarity index 99% rename from src/cguittfont/irrUString.h rename to src/irrlicht_changes/irrUString.h index eb7abe5a1..2472eda4d 100644 --- a/src/cguittfont/irrUString.h +++ b/src/irrlicht_changes/irrUString.h @@ -41,6 +41,8 @@ #include #include #include +#include + #ifdef _WIN32 #define __BYTE_ORDER 0 #define __LITTLE_ENDIAN 0 diff --git a/src/irrlicht_changes/static_text.cpp b/src/irrlicht_changes/static_text.cpp index 50c6c6a68..455dbf437 100644 --- a/src/irrlicht_changes/static_text.cpp +++ b/src/irrlicht_changes/static_text.cpp @@ -7,18 +7,13 @@ #include "static_text.h" #ifdef _IRR_COMPILE_WITH_GUI_ -#include -#include -#include -#include -#include #include #include #include #include #if USE_FREETYPE - #include "cguittfont/xCGUITTFont.h" + #include "CGUITTFont.h" #endif #ifndef _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX // newer Irrlicht versions no longer have this diff --git a/util/travis/clang-format-whitelist.txt b/util/travis/clang-format-whitelist.txt index 66e312cdb..f276af282 100644 --- a/util/travis/clang-format-whitelist.txt +++ b/util/travis/clang-format-whitelist.txt @@ -3,10 +3,6 @@ src/ban.cpp src/camera.cpp src/camera.h src/cavegen.cpp -src/cguittfont/CGUITTFont.cpp -src/cguittfont/CGUITTFont.h -src/cguittfont/irrUString.h -src/cguittfont/xCGUITTFont.h src/chat.cpp src/chat.h src/chat_interface.h @@ -113,6 +109,9 @@ src/inventory.cpp src/inventory.h src/inventorymanager.cpp src/inventorymanager.h +src/irrlicht_changes/CGUITTFont.cpp +src/irrlicht_changes/CGUITTFont.h +src/irrlicht_changes/irrUString.h src/irrlicht_changes/static_text.cpp src/irrlicht_changes/static_text.h src/irrlichttypes.h -- 2.25.1