From 9d606a0b3be053550486b8f1a00255e340ccf8a8 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 23 Jul 2017 19:16:45 +1000 Subject: [PATCH] Fix MSYS2 issues --- .drone.yml | 8 ++++++++ CMakeLists.txt | 23 ++++++++++++----------- cmake/FindGLIB.cmake | 22 +++++++++++++++++----- cmake/FindGTK2.cmake | 24 ++++++++++++++++++------ cmake/FindGTK3.cmake | 24 ++++++++++++++++++------ cmake/FindGtkGLExt.cmake | 28 ++++++++++++++++++++-------- cmake/FindMinizip.cmake | 22 +++++++++++++++++----- cmake/FindPango.cmake | 23 +++++++++++++++++++++++ libs/gtkutil/CMakeLists.txt | 8 +++++--- libs/uilib/CMakeLists.txt | 12 ++++++++---- radiant/gtkdlgs.cpp | 2 +- radiant/url.cpp | 1 + 12 files changed, 148 insertions(+), 49 deletions(-) create mode 100644 .drone.yml create mode 100644 cmake/FindPango.cmake diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 00000000..d40dd2e3 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,8 @@ +build: + image: teaci/msys32 + shell: mingw32 + pull: true + commands: + - pacman -S --needed --noconfirm --noprogressbar mingw-w64-i686-{toolchain,cmake,gtk2,gtkglext} + - cmake -G "MSYS Makefiles" . + - make diff --git a/CMakeLists.txt b/CMakeLists.txt index d3d230ff..b2b766ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,18 +90,19 @@ if (NOT CMAKE_BUILD_TYPE MATCHES Release) add_definitions(-D_DEBUG=1) endif () -add_definitions( - -DGTK_DISABLE_SINGLE_INCLUDES - -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES - -DGSEAL_ENABLE -) +macro(disable_deprecated name gtk2only) + add_definitions(-D${name}_DISABLE_SINGLE_INCLUDES) + if ((${gtk2only} EQUAL 0) OR (GTK_TARGET EQUAL 2)) + add_definitions(-D${name}_DISABLE_DEPRECATED) + endif () +endmacro() -if (GTK_TARGET EQUAL 2) - add_definitions( - -DGTK_DISABLE_DEPRECATED - -DGDK_DISABLE_DEPRECATED - ) -endif () +disable_deprecated(ATK 0) +disable_deprecated(G 0) +disable_deprecated(GDK 0) +disable_deprecated(GDK_PIXBUF 0) +disable_deprecated(GTK 1) +disable_deprecated(PANGO 0) if (APPLE) option(XWINDOWS "Build against X11" ON) diff --git a/cmake/FindGLIB.cmake b/cmake/FindGLIB.cmake index 092bdc86..4b1b2650 100644 --- a/cmake/FindGLIB.cmake +++ b/cmake/FindGLIB.cmake @@ -1,9 +1,21 @@ -include(FindPkgConfig) +find_package(PkgConfig) if (PKG_CONFIG_FOUND) if (GLIB_FIND_REQUIRED) - set(_PACKAGE_ARGS REQUIRED) - else () - set(_PACKAGE_ARGS "") + set(_pkgconfig_REQUIRED REQUIRED) + endif () + pkg_check_modules(GLIB ${_pkgconfig_REQUIRED} glib-2.0) +else () + find_path(GLIB_INCLUDE_DIRS glib.h) + find_library(GLIB_LIBRARIES glib-2.0) + if (GLIB_INCLUDE_DIRS AND GLIB_LIBRARIES) + set(GLIB_FOUND 1) + if (NOT GLIB_FIND_QUIETLY) + message(STATUS "Found GLIB: ${GLIB_LIBRARIES}") + endif () + elseif (GLIB_FIND_REQUIRED) + message(SEND_ERROR "Could not find GLIB") + elseif (NOT GLIB_FIND_QUIETLY) + message(STATUS "Could not find GLIB") endif () - pkg_check_modules(GLIB glib-2.0 ${_PACKAGE_ARGS}) endif () +mark_as_advanced(GLIB_INCLUDE_DIRS GLIB_LIBRARIES) diff --git a/cmake/FindGTK2.cmake b/cmake/FindGTK2.cmake index d3602bf1..ff205261 100644 --- a/cmake/FindGTK2.cmake +++ b/cmake/FindGTK2.cmake @@ -1,9 +1,21 @@ -include(FindPkgConfig) +find_package(PkgConfig) if (PKG_CONFIG_FOUND) - if (GLIB_FIND_REQUIRED) - set(_PACKAGE_ARGS REQUIRED) - else () - set(_PACKAGE_ARGS "") + if (GTK2_FIND_REQUIRED) + set(_pkgconfig_REQUIRED REQUIRED) + endif () + pkg_check_modules(GTK2 ${_pkgconfig_REQUIRED} gtk+-2.0) +else () + find_path(GTK2_INCLUDE_DIRS gtk.h) + # find_library(GTK2_LIBRARIES) + if (GTK2_INCLUDE_DIRS AND GTK2_LIBRARIES) + set(GTK2_FOUND 1) + if (NOT GTK2_FIND_QUIETLY) + message(STATUS "Found GTK2: ${GTK2_LIBRARIES}") + endif () + elseif (GTK2_FIND_REQUIRED) + message(SEND_ERROR "Could not find GTK2") + elseif (NOT GTK2_FIND_QUIETLY) + message(STATUS "Could not find GTK2") endif () - pkg_check_modules(GTK2 gtk+-2.0 ${_PACKAGE_ARGS}) endif () +mark_as_advanced(GTK2_INCLUDE_DIRS GTK2_LIBRARIES) diff --git a/cmake/FindGTK3.cmake b/cmake/FindGTK3.cmake index 96dd46b0..7bef3b01 100644 --- a/cmake/FindGTK3.cmake +++ b/cmake/FindGTK3.cmake @@ -1,9 +1,21 @@ -include(FindPkgConfig) +find_package(PkgConfig) if (PKG_CONFIG_FOUND) - if (GLIB_FIND_REQUIRED) - set(_PACKAGE_ARGS REQUIRED) - else () - set(_PACKAGE_ARGS "") + if (GTK3_FIND_REQUIRED) + set(_pkgconfig_REQUIRED REQUIRED) + endif () + pkg_check_modules(GTK3 ${_pkgconfig_REQUIRED} gtk+-3.0) +else () + find_path(GTK3_INCLUDE_DIRS gtk.h) + # find_library(GTK3_LIBRARIES) + if (GTK3_INCLUDE_DIRS AND GTK3_LIBRARIES) + set(GTK3_FOUND 1) + if (NOT GTK3_FIND_QUIETLY) + message(STATUS "Found GTK3: ${GTK3_LIBRARIES}") + endif () + elseif (GTK3_FIND_REQUIRED) + message(SEND_ERROR "Could not find GTK3") + elseif (NOT GTK3_FIND_QUIETLY) + message(STATUS "Could not find GTK3") endif () - pkg_check_modules(GTK3 gtk+-3.0 ${_PACKAGE_ARGS}) endif () +mark_as_advanced(GTK3_INCLUDE_DIRS GTK3_LIBRARIES) diff --git a/cmake/FindGtkGLExt.cmake b/cmake/FindGtkGLExt.cmake index db1a2df8..b30a1e11 100644 --- a/cmake/FindGtkGLExt.cmake +++ b/cmake/FindGtkGLExt.cmake @@ -1,15 +1,27 @@ -include(FindPkgConfig) +find_package(PkgConfig) if (PKG_CONFIG_FOUND) - if (GLIB_FIND_REQUIRED) - set(_PACKAGE_ARGS REQUIRED) - else () - set(_PACKAGE_ARGS "") + if (GtkGLExt_FIND_REQUIRED) + set(_pkgconfig_REQUIRED REQUIRED) endif () if (XWINDOWS) - pkg_check_modules(GTKGL gtkglext-x11-1.0 ${_PACKAGE_ARGS}) + pkg_check_modules(GtkGLExt ${_pkgconfig_REQUIRED} gtkglext-x11-1.0) elseif (WIN32) - pkg_check_modules(GTKGL gtkglext-win32-1.0 ${_PACKAGE_ARGS}) + pkg_check_modules(GtkGLExt ${_pkgconfig_REQUIRED} gtkglext-win32-1.0) else () - pkg_check_modules(GTKGL gtkglext-quartz-1.0 ${_PACKAGE_ARGS}) + pkg_check_modules(GtkGLExt ${_pkgconfig_REQUIRED} gtkglext-quartz-1.0) + endif () +else () + find_path(GtkGLExt_INCLUDE_DIRS gtkglwidget.h) + # find_library(GtkGLExt_LIBRARIES) + if (GtkGLExt_INCLUDE_DIRS AND GtkGLExt_LIBRARIES) + set(GtkGLExt_FOUND 1) + if (NOT GtkGLExt_FIND_QUIETLY) + message(STATUS "Found GtkGLExt: ${GtkGLExt_LIBRARIES}") + endif () + elseif (GtkGLExt_FIND_REQUIRED) + message(SEND_ERROR "Could not find GtkGLExt") + elseif (NOT GtkGLExt_FIND_QUIETLY) + message(STATUS "Could not find GtkGLExt") endif () endif () +mark_as_advanced(GtkGLExt_INCLUDE_DIRS GtkGLExt_LIBRARIES) diff --git a/cmake/FindMinizip.cmake b/cmake/FindMinizip.cmake index 10a5fc6f..0de098f4 100644 --- a/cmake/FindMinizip.cmake +++ b/cmake/FindMinizip.cmake @@ -1,9 +1,21 @@ -include(FindPkgConfig) +find_package(PkgConfig) if (PKG_CONFIG_FOUND) if (Minizip_FIND_REQUIRED) - set(_PACKAGE_ARGS REQUIRED) - else () - set(_PACKAGE_ARGS "") + set(_pkgconfig_REQUIRED REQUIRED) + endif () + pkg_check_modules(Minizip ${_pkgconfig_REQUIRED} minizip) +else () + find_path(Minizip_INCLUDE_DIRS unzip.h) + # find_library(Minizip_LIBRARIES) + if (Minizip_INCLUDE_DIRS AND Minizip_LIBRARIES) + set(Minizip_FOUND 1) + if (NOT Minizip_FIND_QUIETLY) + message(STATUS "Found Minizip: ${Minizip_LIBRARIES}") + endif () + elseif (Minizip_FIND_REQUIRED) + message(SEND_ERROR "Could not find Minizip") + elseif (NOT Minizip_FIND_QUIETLY) + message(STATUS "Could not find Minizip") endif () - pkg_check_modules(Minizip minizip ${_PACKAGE_ARGS}) endif () +mark_as_advanced(Minizip_INCLUDE_DIRS Minizip_LIBRARIES) diff --git a/cmake/FindPango.cmake b/cmake/FindPango.cmake new file mode 100644 index 00000000..67359ef0 --- /dev/null +++ b/cmake/FindPango.cmake @@ -0,0 +1,23 @@ +find_package(PkgConfig) +if (PKG_CONFIG_FOUND) + if (Pango_FIND_REQUIRED) + set(_pkgconfig_REQUIRED REQUIRED) + endif () + pkg_search_module(Pango ${_pkgconfig_REQUIRED} pango pangocairo) + pkg_search_module(PangoFT2 ${_pkgconfig_REQUIRED} pangoft2) +else () + # find_path(Pango_INCLUDE_DIRS) + # find_library(Pango_LIBRARIES) + if (Pango_INCLUDE_DIRS AND Pango_LIBRARIES) + set(Pango_FOUND 1) + if (NOT Pango_FIND_QUIETLY) + message(STATUS "Found Pango: ${Pango_LIBRARIES}") + endif () + elseif (Pango_FIND_REQUIRED) + message(SEND_ERROR "Could not find Pango") + elseif (NOT Pango_FIND_QUIETLY) + message(STATUS "Could not find Pango") + endif () +endif () +mark_as_advanced(Pango_INCLUDE_DIRS Pango_LIBRARIES) +mark_as_advanced(PangoFT2_INCLUDE_DIRS PangoFT2_LIBRARIES) diff --git a/libs/gtkutil/CMakeLists.txt b/libs/gtkutil/CMakeLists.txt index 9ccd41b2..b62098c1 100644 --- a/libs/gtkutil/CMakeLists.txt +++ b/libs/gtkutil/CMakeLists.txt @@ -30,6 +30,8 @@ target_link_libraries(gtkutil PRIVATE uilib) target_include_directories(gtkutil PRIVATE ${GTK${GTK_TARGET}_INCLUDE_DIRS}) target_link_libraries(gtkutil PRIVATE ${GTK${GTK_TARGET}_LIBRARIES}) -find_package(GtkGLExt REQUIRED) -target_include_directories(gtkutil PRIVATE ${GTKGL_INCLUDE_DIRS}) -target_link_libraries(gtkutil PRIVATE ${GTKGL_LIBRARIES}) +if (GTK_TARGET EQUAL 2) + find_package(GtkGLExt REQUIRED) + target_include_directories(gtkutil PRIVATE ${GtkGLExt_INCLUDE_DIRS}) + target_link_libraries(gtkutil PRIVATE ${GtkGLExt_LIBRARIES}) +endif () diff --git a/libs/uilib/CMakeLists.txt b/libs/uilib/CMakeLists.txt index cf300e44..080376b1 100644 --- a/libs/uilib/CMakeLists.txt +++ b/libs/uilib/CMakeLists.txt @@ -2,13 +2,17 @@ add_library(uilib uilib.cpp ) +find_package(GLIB REQUIRED) +target_include_directories(uilib PUBLIC ${GLIB_INCLUDE_DIRS}) +target_link_libraries(uilib PUBLIC ${GLIB_LIBRARIES}) + +find_package(Pango REQUIRED) +target_include_directories(uilib PUBLIC ${Pango_INCLUDE_DIRS} ${PangoFT2_INCLUDE_DIRS}) +target_link_libraries(uilib PUBLIC ${Pango_LIBRARIES} ${PangoFT2_LIBRARIES}) + find_package(GTK${GTK_TARGET} REQUIRED) target_include_directories(uilib PUBLIC ${GTK${GTK_TARGET}_INCLUDE_DIRS}) target_link_libraries(uilib PUBLIC ${GTK${GTK_TARGET}_LIBRARIES}) target_include_directories(uilib PUBLIC gtkutil) target_link_libraries(uilib PUBLIC gtkutil) - -find_package(GLIB REQUIRED) -target_include_directories(uilib PUBLIC ${GLIB_INCLUDE_DIRS}) -target_link_libraries(uilib PUBLIC ${GLIB_LIBRARIES}) diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 53def76d..a5e03e31 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -826,7 +826,7 @@ static void DoGtkTextEditor( const char* filename, guint cursorpos ){ text_editor.show(); #ifdef WIN32 - process_gui(); + ui::process(); #endif // only move the cursor if it's not exceeding the size.. diff --git a/radiant/url.cpp b/radiant/url.cpp index ed33cb2f..b1603ecc 100644 --- a/radiant/url.cpp +++ b/radiant/url.cpp @@ -25,6 +25,7 @@ #include "gtkutil/messagebox.h" #ifdef WIN32 +#include #include #include bool open_url( const char* url ){ -- 2.39.2