Fix MSYS2 issues
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 23 Jul 2017 09:16:45 +0000 (19:16 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 31 Jul 2017 12:35:48 +0000 (22:35 +1000)
12 files changed:
.drone.yml [new file with mode: 0644]
CMakeLists.txt
cmake/FindGLIB.cmake
cmake/FindGTK2.cmake
cmake/FindGTK3.cmake
cmake/FindGtkGLExt.cmake
cmake/FindMinizip.cmake
cmake/FindPango.cmake [new file with mode: 0644]
libs/gtkutil/CMakeLists.txt
libs/uilib/CMakeLists.txt
radiant/gtkdlgs.cpp
radiant/url.cpp

diff --git a/.drone.yml b/.drone.yml
new file mode 100644 (file)
index 0000000..d40dd2e
--- /dev/null
@@ -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
index d3d230f..b2b766e 100644 (file)
@@ -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)
index 092bdc8..4b1b265 100644 (file)
@@ -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)
index d3602bf..ff20526 100644 (file)
@@ -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)
index 96dd46b..7bef3b0 100644 (file)
@@ -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)
index db1a2df..b30a1e1 100644 (file)
@@ -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)
index 10a5fc6..0de098f 100644 (file)
@@ -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 (file)
index 0000000..67359ef
--- /dev/null
@@ -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)
index 9ccd41b..b62098c 100644 (file)
@@ -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 ()
index cf300e4..080376b 100644 (file)
@@ -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})
index 53def76..a5e03e3 100644 (file)
@@ -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..
index ed33cb2..b1603ec 100644 (file)
@@ -25,6 +25,7 @@
 #include "gtkutil/messagebox.h"
 
 #ifdef WIN32
+#include <gtk/gtk.h>
 #include <gdk/gdkwin32.h>
 #include <shellapi.h>
 bool open_url( const char* url ){