diff options
author | fiaxh <git@lightrise.org> | 2022-02-14 14:55:59 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2022-07-27 20:34:20 +0200 |
commit | 7e7dcedaf31ee35499875491c9f569c575d28435 (patch) | |
tree | 0c5fee2b28baf320775fbc92b3c252e97d9d054f /cmake | |
parent | f25bfb00969a7e09996da2d5500e6718f4cc0148 (diff) | |
download | dino-7e7dcedaf31ee35499875491c9f569c575d28435.tar.gz dino-7e7dcedaf31ee35499875491c9f569c575d28435.zip |
Port from GTK3 to GTK4
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindGDK4.cmake | 38 | ||||
-rw-r--r-- | cmake/FindGTK4.cmake | 30 | ||||
-rw-r--r-- | cmake/FindGspell.cmake | 2 |
3 files changed, 69 insertions, 1 deletions
diff --git a/cmake/FindGDK4.cmake b/cmake/FindGDK4.cmake new file mode 100644 index 00000000..74ef583e --- /dev/null +++ b/cmake/FindGDK4.cmake @@ -0,0 +1,38 @@ +include(PkgConfigWithFallback) +find_pkg_config_with_fallback(GDK4 + PKG_CONFIG_NAME gdk-4.0 + LIB_NAMES gdk-4 + INCLUDE_NAMES gdk/gdk.h + INCLUDE_DIR_SUFFIXES gtk-4.0 gtk-4.0/include gtk+-4.0 gtk+-4.0/include + DEPENDS Pango Cairo GDKPixbuf2 +) + +if(GDK4_FOUND AND NOT GDK4_VERSION) + find_file(GDK4_VERSION_HEADER "gdk/gdkversionmacros.h" HINTS ${GDK4_INCLUDE_DIRS}) + mark_as_advanced(GDK4_VERSION_HEADER) + + if(GDK4_VERSION_HEADER) + file(STRINGS "${GDK4_VERSION_HEADER}" GDK4_MAJOR_VERSION REGEX "^#define GDK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") + string(REGEX REPLACE "^#define GDK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK4_MAJOR_VERSION "${GDK4_MAJOR_VERSION}") + file(STRINGS "${GDK4_VERSION_HEADER}" GDK4_MINOR_VERSION REGEX "^#define GDK_MINOR_VERSION +\\(?([0-9]+)\\)?$") + string(REGEX REPLACE "^#define GDK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK4_MINOR_VERSION "${GDK4_MINOR_VERSION}") + file(STRINGS "${GDK4_VERSION_HEADER}" GDK4_MICRO_VERSION REGEX "^#define GDK_MICRO_VERSION +\\(?([0-9]+)\\)?$") + string(REGEX REPLACE "^#define GDK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK4_MICRO_VERSION "${GDK4_MICRO_VERSION}") + set(GDK4_VERSION "${GDK4_MAJOR_VERSION}.${GDK4_MINOR_VERSION}.${GDK4_MICRO_VERSION}") + unset(GDK4_MAJOR_VERSION) + unset(GDK4_MINOR_VERSION) + unset(GDK4_MICRO_VERSION) + endif() +endif() + +if (GDK4_FOUND) + find_file(GDK4_WITH_X11 "gdk/gdkx.h" HINTS ${GDK4_INCLUDE_DIRS}) + if (GDK4_WITH_X11) + set(GDK4_WITH_X11 yes CACHE INTERNAL "Does GDK4 support X11") + endif (GDK4_WITH_X11) +endif () + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GDK4 + REQUIRED_VARS GDK4_LIBRARY + VERSION_VAR GDK4_VERSION)
\ No newline at end of file diff --git a/cmake/FindGTK4.cmake b/cmake/FindGTK4.cmake new file mode 100644 index 00000000..23819bca --- /dev/null +++ b/cmake/FindGTK4.cmake @@ -0,0 +1,30 @@ +include(PkgConfigWithFallback) +find_pkg_config_with_fallback(GTK4 + PKG_CONFIG_NAME gtk4 + LIB_NAMES gtk-4 + INCLUDE_NAMES gtk/gtk.h + INCLUDE_DIR_SUFFIXES gtk-4.0 gtk-4.0/include gtk+-4.0 gtk+-4.0/include gtk4 gtk4/include +) + +if(GTK4_FOUND AND NOT GTK4_VERSION) + find_file(GTK4_VERSION_HEADER "gtk/gtkversion.h" HINTS ${GTK4_INCLUDE_DIRS}) + mark_as_advanced(GTK4_VERSION_HEADER) + + if(GTK4_VERSION_HEADER) + file(STRINGS "${GTK4_VERSION_HEADER}" GTK4_MAJOR_VERSION REGEX "^#define GTK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") + string(REGEX REPLACE "^#define GTK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK4_MAJOR_VERSION "${GTK4_MAJOR_VERSION}") + file(STRINGS "${GTK4_VERSION_HEADER}" GTK4_MINOR_VERSION REGEX "^#define GTK_MINOR_VERSION +\\(?([0-9]+)\\)?$") + string(REGEX REPLACE "^#define GTK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK4_MINOR_VERSION "${GTK4_MINOR_VERSION}") + file(STRINGS "${GTK4_VERSION_HEADER}" GTK4_MICRO_VERSION REGEX "^#define GTK_MICRO_VERSION +\\(?([0-9]+)\\)?$") + string(REGEX REPLACE "^#define GTK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK4_MICRO_VERSION "${GTK4_MICRO_VERSION}") + set(GTK4_VERSION "${GTK4_MAJOR_VERSION}.${GTK4_MINOR_VERSION}.${GTK4_MICRO_VERSION}") + unset(GTK4_MAJOR_VERSION) + unset(GTK4_MINOR_VERSION) + unset(GTK4_MICRO_VERSION) + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GTK4 + REQUIRED_VARS GTK4_LIBRARY + VERSION_VAR GTK4_VERSION) diff --git a/cmake/FindGspell.cmake b/cmake/FindGspell.cmake index 51c33c7e..de29ed1d 100644 --- a/cmake/FindGspell.cmake +++ b/cmake/FindGspell.cmake @@ -4,7 +4,7 @@ find_pkg_config_with_fallback(Gspell LIB_NAMES gspell-1 INCLUDE_NAMES gspell.h INCLUDE_DIR_SUFFIXES gspell-1 gspell-1/gspell - DEPENDS Gtk + DEPENDS GTK3 ) include(FindPackageHandleStandardArgs) |