[GTK] CMake find module for GTK4
authoraperez@igalia.com <aperez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Apr 2020 16:25:17 +0000 (16:25 +0000)
committeraperez@igalia.com <aperez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Apr 2020 16:25:17 +0000 (16:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=210110

Reviewed by Don Olmstead.

.:

Rename FindGTK3.cmake as FindGTK.cmake, make it provide a GTK::GTK imported target,
and rewrite the logic to detect which targets (backends) have been built into GTK
to use the "targets" pkg-config variable instead of checking for multiple pkg-config
modules.

* Source/cmake/FindGDK3.cmake: Removed.
* Source/cmake/FindGTK.cmake: Added.
* Source/cmake/FindGTK3.cmake: Removed. This is now unused because the GTK::GTK target
will transitively depend on GDK3 when using GTK3 and bring in the compiler and linker
options automatically without needing to use a separate find module for GDK.
* Source/cmake/OptionsGTK.cmake: Use the GTK::GTK imported target, change variables
prefixed with GTK3_ to use the GTK_ prefix, and remove variables which are not needed
anymore when using the target (GTK_LIBRARIES, GTK_INCLUDE_DIRS, GDK_LIBRARIES and
GDK_INCLUDE_DIRS).

Source/WebCore:

No new tests needed.

* PlatformGTK.cmake: Use the GTK::GTK imported target.

Source/WebCore/PAL:

* pal/PlatformGTK.cmake: Use the GTK::GTK imported target.

Tools:

* MiniBrowser/gtk/CMakeLists.txt: Use the GTK::GTK imported target.
* TestWebKitAPI/PlatformGTK.cmake: Ditto.
* TestWebKitAPI/glib/PlatformGTK.cmake: Ditto.
* WebKitTestRunner/PlatformGTK.cmake: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259641 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/PlatformGTK.cmake
Source/WebCore/PlatformGTK.cmake
Source/cmake/FindGDK3.cmake [deleted file]
Source/cmake/FindGTK.cmake [new file with mode: 0644]
Source/cmake/FindGTK3.cmake [deleted file]
Source/cmake/OptionsGTK.cmake
Tools/ChangeLog
Tools/MiniBrowser/gtk/CMakeLists.txt
Tools/TestWebKitAPI/PlatformGTK.cmake
Tools/TestWebKitAPI/glib/PlatformGTK.cmake
Tools/WebKitTestRunner/PlatformGTK.cmake

index 5446e76..9d94bd8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2020-04-07  Adrian Perez de Castro  <aperez@igalia.com>
+
+        [GTK] CMake find module for GTK4
+        https://bugs.webkit.org/show_bug.cgi?id=210110
+
+        Reviewed by Don Olmstead.
+
+        Rename FindGTK3.cmake as FindGTK.cmake, make it provide a GTK::GTK imported target,
+        and rewrite the logic to detect which targets (backends) have been built into GTK
+        to use the "targets" pkg-config variable instead of checking for multiple pkg-config
+        modules.
+
+        * Source/cmake/FindGDK3.cmake: Removed.
+        * Source/cmake/FindGTK.cmake: Added.
+        * Source/cmake/FindGTK3.cmake: Removed. This is now unused because the GTK::GTK target
+        will transitively depend on GDK3 when using GTK3 and bring in the compiler and linker
+        options automatically without needing to use a separate find module for GDK.
+        * Source/cmake/OptionsGTK.cmake: Use the GTK::GTK imported target, change variables
+        prefixed with GTK3_ to use the GTK_ prefix, and remove variables which are not needed
+        anymore when using the target (GTK_LIBRARIES, GTK_INCLUDE_DIRS, GDK_LIBRARIES and
+        GDK_INCLUDE_DIRS).
+
 2020-04-06  Don Olmstead  <don.olmstead@sony.com>
 
         [CMake] Use WEBKIT_EXECUTABLE in DumpRenderTree
index 98f7b4d..896d903 100644 (file)
@@ -1,3 +1,14 @@
+2020-04-07  Adrian Perez de Castro  <aperez@igalia.com>
+
+        [GTK] CMake find module for GTK4
+        https://bugs.webkit.org/show_bug.cgi?id=210110
+
+        Reviewed by Don Olmstead.
+
+        No new tests needed.
+
+        * PlatformGTK.cmake: Use the GTK::GTK imported target.
+
 2020-04-07  Andres Gonzalez  <andresg_22@apple.com>
 
         Initialization of modal nodes should happen lazily, not in the AXObjectCache constructor.
index fa5433c..902238c 100644 (file)
@@ -1,3 +1,12 @@
+2020-04-07  Adrian Perez de Castro  <aperez@igalia.com>
+
+        [GTK] CMake find module for GTK4
+        https://bugs.webkit.org/show_bug.cgi?id=210110
+
+        Reviewed by Don Olmstead.
+
+        * pal/PlatformGTK.cmake: Use the GTK::GTK imported target.
+
 2020-04-05  Peng Liu  <peng.liu6@apple.com>
 
         The value of [AVPlayerViewController isPictureInPicturePossible] is NO in the first attempt to enter PiP
index 41e6b9a..39c58b2 100644 (file)
@@ -30,6 +30,6 @@ if (ENABLE_WEB_CRYPTO)
     )
 endif ()
 
-list(APPEND PAL_SYSTEM_INCLUDE_DIRECTORIES
-    ${GDK_INCLUDE_DIRS}
+list(APPEND PAL_LIBRARIES
+    GTK::GTK
 )
index a1f000e..047ae12 100644 (file)
@@ -78,12 +78,10 @@ set(WebCore_USER_AGENT_SCRIPTS_DEPENDENCIES ${WEBCORE_DIR}/rendering/RenderTheme
 list(APPEND WebCore_LIBRARIES
     ${ATK_LIBRARIES}
     ${ENCHANT_LIBRARIES}
-    ${GDK_LIBRARIES}
     ${GLIB_GIO_LIBRARIES}
     ${GLIB_GMODULE_LIBRARIES}
     ${GLIB_GOBJECT_LIBRARIES}
     ${GLIB_LIBRARIES}
-    ${GTK_LIBRARIES}
     ${LIBSECCOMP_LIBRARIES}
     ${LIBSECRET_LIBRARIES}
     ${LIBTASN1_LIBRARIES}
@@ -94,6 +92,7 @@ list(APPEND WebCore_LIBRARIES
     ${X11_Xdamage_LIB}
     ${X11_Xrender_LIB}
     ${X11_Xt_LIB}
+    GTK::GTK
 )
 
 if (USE_WPE_RENDERER)
@@ -105,10 +104,8 @@ endif ()
 list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
     ${ATK_INCLUDE_DIRS}
     ${ENCHANT_INCLUDE_DIRS}
-    ${GDK_INCLUDE_DIRS}
     ${GIO_UNIX_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
-    ${GTK_INCLUDE_DIRS}
     ${LIBSECCOMP_INCLUDE_DIRS}
     ${LIBSECRET_INCLUDE_DIRS}
     ${LIBTASN1_INCLUDE_DIRS}
@@ -166,8 +163,7 @@ include_directories(SYSTEM
     ${WebCore_SYSTEM_INCLUDE_DIRECTORIES}
 )
 
-list(APPEND WebCoreTestSupport_LIBRARIES PRIVATE ${GTK_LIBRARIES})
-list(APPEND WebCoreTestSupport_SYSTEM_INCLUDE_DIRECTORIES ${GTK_INCLUDE_DIRS})
+list(APPEND WebCoreTestSupport_LIBRARIES PRIVATE GTK::GTK)
 
 add_definitions(-DBUILDING_WEBKIT)
 
diff --git a/Source/cmake/FindGDK3.cmake b/Source/cmake/FindGDK3.cmake
deleted file mode 100644 (file)
index be4a4e8..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# - Try to find GDK 3
-# Once done, this will define
-#
-#  GDK3_FOUND - system has GDK 3
-#  GDK3_INCLUDE_DIRS - the GDK 3 include directories
-#  GDK3_LIBRARIES - link these to use GDK 3
-#
-# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
-# Copyright (C) 2013 Igalia S.L.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1.  Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-# 2.  Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
-# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-find_package(PkgConfig QUIET)
-pkg_check_modules(GDK3 gdk-3.0)
-
-set(VERSION_OK TRUE)
-if (GDK3_VERSION)
-    if (GDK3_FIND_VERSION_EXACT)
-        if (NOT("${GDK3_FIND_VERSION}" VERSION_EQUAL "${GDK3_VERSION}"))
-            set(VERSION_OK FALSE)
-        endif ()
-    else ()
-        if ("${GDK3_VERSION}" VERSION_LESS "${GDK3_FIND_VERSION}")
-            set(VERSION_OK FALSE)
-        endif ()
-    endif ()
-endif ()
-
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDK3 DEFAULT_MSG GDK3_INCLUDE_DIRS GDK3_LIBRARIES VERSION_OK)
diff --git a/Source/cmake/FindGTK.cmake b/Source/cmake/FindGTK.cmake
new file mode 100644 (file)
index 0000000..395b8ea
--- /dev/null
@@ -0,0 +1,119 @@
+# - Try to find GTK+ 3.x or 4.x
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2013, 2015, 2020 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#[=======================================================================[.rst:
+FindGTK
+-------
+
+Find GTK headers and libraries.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+``GTK::GTK``
+  The GTK library, if found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This will define the following variables in your project:
+
+``GTK_FOUND``
+  true if (the requested version of) GTK is available.
+``GTK_4``
+  whether GTK 4 was detected
+``GTK_3``
+  whether GTK 3 was detected
+``GTK_VERSION``
+  the version of GTK.
+``GTK_SUPPORTS_BROADWAY``
+  true if the Broadway target is built into GTK.
+``GTK_SUPPORTS_QUARTZ``
+  true if the Quartz target is built into GTK.
+``GTK_SUPPORTS_WAYLAND``
+  true if the Wayland target is built into GTK.
+``GTK_SUPPORTS_WIN32``
+  true if the Windows target is built into GTK.
+``GTK_SUPPORTS_X11``
+  true if the X11 target is built into GTK.
+
+#]=======================================================================]
+
+if (NOT DEFINED GTK_FIND_VERSION)
+    message(FATAL_ERROR "No GTK version specified")
+endif ()
+
+if (GTK_FIND_VERSION VERSION_LESS 3.90)
+    set(GTK_PC_MODULE "gtk+-3.0")
+    set(GTK_4 FALSE)
+    set(GTK_3 TRUE)
+else ()
+    set(GTK_PC_MODULE "gtk4")
+    set(GTK_4 TRUE)
+    set(GTK_3 FALSE)
+endif ()
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(GTK IMPORTED_TARGET ${GTK_PC_MODULE})
+
+set(GTK_VERSION_OK TRUE)
+if (GTK_VERSION)
+    if (GTK_FIND_VERSION_EXACT)
+        if (NOT("${GTK_FIND_VERSION}" VERSION_EQUAL "${GTK_VERSION}"))
+            set(GTK_VERSION_OK FALSE)
+        endif ()
+    else ()
+        if ("${GTK_VERSION}" VERSION_LESS "${GTK_FIND_VERSION}")
+            set(GTK_VERSION_OK FALSE)
+        endif ()
+    endif ()
+endif ()
+
+# Set all the GTK_SUPPORTS_<target> variables to FALSE initially.
+foreach (gtk_target broadway quartz wayland win32 x11)
+    string(TOUPPER "GTK_SUPPORTS_${gtk_target}" gtk_target)
+    set(${gtk_target} FALSE)
+endforeach ()
+
+if (GTK_VERSION AND GTK_VERSION_OK)
+    # Fetch the "targets" variable and set GTK_SUPPORTS_<target>.
+    pkg_get_variable(GTK_TARGETS ${GTK_PC_MODULE} targets)
+    separate_arguments(GTK_TARGETS)
+    foreach (gtk_target ${GTK_TARGETS})
+        string(TOUPPER "GTK_SUPPORTS_${gtk_target}" gtk_target)
+        set(${gtk_target} TRUE)
+    endforeach ()
+endif ()
+
+if (TARGET PkgConfig::GTK AND NOT TARGET GTK::GTK)
+    add_library(GTK::GTK INTERFACE IMPORTED GLOBAL)
+    set_property(TARGET GTK::GTK PROPERTY
+        INTERFACE_LINK_LIBRARIES PkgConfig::GTK
+    )
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK DEFAULT_MSG GTK_VERSION GTK_VERSION_OK)
diff --git a/Source/cmake/FindGTK3.cmake b/Source/cmake/FindGTK3.cmake
deleted file mode 100644 (file)
index 376d412..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-# - Try to find GTK+ 3
-# Once done, this will define
-#
-#  GTK3_FOUND - system has GTK+ 3.
-#  GTK3_INCLUDE_DIRS - the GTK+ 3. include directories
-#  GTK3_LIBRARIES - link these to use GTK+ 3.
-#  GTK3_SUPPORTS_QUARTZ - GTK+ supports Quartz backend
-#  GTK3_SUPPORTS_X11 - GTK+ supports X11 backend
-#  GTK3_SUPPORTS_WAYLAND - GTK+ supports Wayland backend
-#
-# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
-# Copyright (C) 2013, 2015 Igalia S.L.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1.  Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-# 2.  Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
-# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-find_package(PkgConfig QUIET)
-pkg_check_modules(GTK3 gtk+-3.0)
-
-set(VERSION_OK TRUE)
-if (GTK3_VERSION)
-    if (GTK3_FIND_VERSION_EXACT)
-        if (NOT("${GTK3_FIND_VERSION}" VERSION_EQUAL "${GTK3_VERSION}"))
-            set(VERSION_OK FALSE)
-        endif ()
-    else ()
-        if ("${GTK3_VERSION}" VERSION_LESS "${GTK3_FIND_VERSION}")
-            set(VERSION_OK FALSE)
-        endif ()
-    endif ()
-endif ()
-
-if (GTK3_VERSION AND VERSION_OK)
-    pkg_check_modules(GTK3_QUARTZ gtk+-quartz-3.0)
-    if ("${GTK3_QUARTZ_VERSION}" VERSION_EQUAL "${GTK3_VERSION}")
-        set(GTK3_SUPPORTS_QUARTZ TRUE)
-    else ()
-        set(GTK3_SUPPORTS_QUARTZ FALSE)
-    endif ()
-
-    pkg_check_modules(GTK3_X11 gtk+-x11-3.0)
-    if ("${GTK3_X11_VERSION}" VERSION_EQUAL "${GTK3_VERSION}")
-        set(GTK3_SUPPORTS_X11 TRUE)
-    else ()
-        set(GTK3_SUPPORTS_X11 FALSE)
-    endif ()
-
-    pkg_check_modules(GTK3_WAYLAND gtk+-wayland-3.0)
-    if ("${GTK3_WAYLAND_VERSION}" VERSION_EQUAL "${GTK3_VERSION}")
-        set(GTK3_SUPPORTS_WAYLAND TRUE)
-    else ()
-        set(GTK3_SUPPORTS_WAYLAND FALSE)
-    endif ()
-endif ()
-
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARIES VERSION_OK)
index 2b546eb..08ed2f8 100644 (file)
@@ -27,8 +27,7 @@ find_package(Fontconfig 2.8.0 REQUIRED)
 find_package(Freetype 2.4.2 REQUIRED)
 find_package(LibGcrypt 1.6.0 REQUIRED)
 find_package(GLIB 2.44.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule)
-find_package(GTK3 3.22.0 REQUIRED)
-find_package(GDK3 3.22.0 REQUIRED)
+find_package(GTK 3.22.0 REQUIRED)
 find_package(HarfBuzz 0.9.18 REQUIRED COMPONENTS ICU)
 find_package(ICU 60.2 REQUIRED COMPONENTS data i18n uc)
 find_package(JPEG REQUIRED)
@@ -83,9 +82,9 @@ WEBKIT_OPTION_DEFINE(ENABLE_GLES2 "Whether to enable OpenGL ES 2.0." PUBLIC ${EN
 WEBKIT_OPTION_DEFINE(ENABLE_GTKDOC "Whether or not to use generate gtkdoc." PUBLIC OFF)
 WEBKIT_OPTION_DEFINE(ENABLE_INTROSPECTION "Whether to enable GObject introspection." PUBLIC ON)
 WEBKIT_OPTION_DEFINE(ENABLE_OPENGL "Whether to use OpenGL." PUBLIC ON)
-WEBKIT_OPTION_DEFINE(ENABLE_QUARTZ_TARGET "Whether to enable support for the Quartz windowing target." PUBLIC ${GTK3_SUPPORTS_QUARTZ})
-WEBKIT_OPTION_DEFINE(ENABLE_X11_TARGET "Whether to enable support for the X11 windowing target." PUBLIC ${GTK3_SUPPORTS_X11})
-WEBKIT_OPTION_DEFINE(ENABLE_WAYLAND_TARGET "Whether to enable support for the Wayland windowing target." PUBLIC ${GTK3_SUPPORTS_WAYLAND})
+WEBKIT_OPTION_DEFINE(ENABLE_QUARTZ_TARGET "Whether to enable support for the Quartz windowing target." PUBLIC ${GTK_SUPPORTS_QUARTZ})
+WEBKIT_OPTION_DEFINE(ENABLE_X11_TARGET "Whether to enable support for the X11 windowing target." PUBLIC ${GTK_SUPPORTS_X11})
+WEBKIT_OPTION_DEFINE(ENABLE_WAYLAND_TARGET "Whether to enable support for the Wayland windowing target." PUBLIC ${GTK_SUPPORTS_WAYLAND})
 WEBKIT_OPTION_DEFINE(USE_LIBNOTIFY "Whether to enable the default web notification implementation." PUBLIC ON)
 WEBKIT_OPTION_DEFINE(USE_LIBHYPHEN "Whether to enable the default automatic hyphenation implementation." PUBLIC ON)
 WEBKIT_OPTION_DEFINE(USE_LIBSECRET "Whether to enable the persistent credential storage using libsecret." PUBLIC ON)
@@ -211,11 +210,6 @@ else ()
 endif ()
 add_definitions(-DSVN_REVISION="${SVN_REVISION}")
 
-set(GTK_LIBRARIES ${GTK3_LIBRARIES})
-set(GTK_INCLUDE_DIRS ${GTK3_INCLUDE_DIRS})
-set(GDK_LIBRARIES ${GDK3_LIBRARIES})
-set(GDK_INCLUDE_DIRS ${GDK3_INCLUDE_DIRS})
-
 SET_AND_EXPOSE_TO_BUILD(HAVE_GTK_UNIX_PRINTING ${GTKUnixPrint_FOUND})
 
 if (USE_WPE_RENDERER)
@@ -329,13 +323,13 @@ if (ENABLE_SPELLCHECK)
 endif ()
 
 if (ENABLE_QUARTZ_TARGET)
-    if (NOT GTK3_SUPPORTS_QUARTZ)
+    if (NOT GTK_SUPPORTS_QUARTZ)
         message(FATAL_ERROR "Recompile GTK with Quartz backend to use ENABLE_QUARTZ_TARGET")
     endif ()
 endif ()
 
 if (ENABLE_X11_TARGET)
-    if (NOT GTK3_SUPPORTS_X11)
+    if (NOT GTK_SUPPORTS_X11)
         message(FATAL_ERROR "Recompile GTK with X11 backend to use ENABLE_X11_TARGET")
     endif ()
 
@@ -352,7 +346,7 @@ if (ENABLE_X11_TARGET)
 endif ()
 
 if (ENABLE_WAYLAND_TARGET)
-    if (NOT GTK3_SUPPORTS_WAYLAND)
+    if (NOT GTK_SUPPORTS_WAYLAND)
         message(FATAL_ERROR "Recompile GTK with Wayland backend to use ENABLE_WAYLAND_TARGET")
     endif ()
 
index f4f87e2..e670ec7 100644 (file)
@@ -1,3 +1,15 @@
+2020-04-07  Adrian Perez de Castro  <aperez@igalia.com>
+
+        [GTK] CMake find module for GTK4
+        https://bugs.webkit.org/show_bug.cgi?id=210110
+
+        Reviewed by Don Olmstead.
+
+        * MiniBrowser/gtk/CMakeLists.txt: Use the GTK::GTK imported target.
+        * TestWebKitAPI/PlatformGTK.cmake: Ditto.
+        * TestWebKitAPI/glib/PlatformGTK.cmake: Ditto.
+        * WebKitTestRunner/PlatformGTK.cmake: Ditto.
+
 2020-04-07  Youenn Fablet  <youenn@apple.com>
 
         Reset mock capture devices between layout tests
index df53f84..bdb049e 100644 (file)
@@ -29,7 +29,6 @@ set(MiniBrowser_PRIVATE_INCLUDE_DIRECTORIES
 )
 
 set(MiniBrowser_SYSTEM_INCLUDE_DIRECTORIES
-    ${GTK3_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
     ${LIBSOUP_INCLUDE_DIRS}
     ${GSTREAMER_INCLUDE_DIRS}
@@ -38,9 +37,9 @@ set(MiniBrowser_SYSTEM_INCLUDE_DIRECTORIES
 set(MiniBrowser_PRIVATE_LIBRARIES
     ${GLIB_LIBRARIES}
     ${GSTREAMER_LIBRARIES}
-    ${GTK3_LIBRARIES}
     ${JavaScriptCore_LIBRARY_NAME}
     ${LIBSOUP_LIBRARIES}
+    GTK::GTK
     WebKit::WebKit
 )
 
index 241b24c..7c06860 100644 (file)
@@ -22,12 +22,10 @@ list(APPEND TestWTF_SOURCES
 
 list(APPEND TestWTF_SYSTEM_INCLUDE_DIRECTORIES
     ${GLIB_INCLUDE_DIRS}
-    ${GTK3_INCLUDE_DIRS}
 )
 
 list(APPEND TestWTF_LIBRARIES
-    ${GDK3_LIBRARIES}
-    ${GTK3_LIBRARIES}
+    GTK::GTK
 )
 
 # TestWebCore
@@ -42,12 +40,10 @@ list(APPEND TestWebCore_SOURCES
 
 list(APPEND TestWebCore_SYSTEM_INCLUDE_DIRECTORIES
     ${GLIB_INCLUDE_DIRS}
-    ${GTK3_INCLUDE_DIRS}
 )
 
 list(APPEND TestWebCore_LIBRARIES
-    ${GDK3_LIBRARIES}
-    ${GTK3_LIBRARIES}
+    GTK::GTK
 )
 ADD_WHOLE_ARCHIVE_TO_LIBRARIES(TestWebCore_LIBRARIES)
 
@@ -67,12 +63,10 @@ list(APPEND TestWebKit_PRIVATE_INCLUDE_DIRECTORIES
 
 list(APPEND TestWebKit_SYSTEM_INCLUDE_DIRECTORIES
     ${GLIB_INCLUDE_DIRS}
-    ${GTK3_INCLUDE_DIRS}
 )
 
 list(APPEND TestWebKit_LIBRARIES
-    ${GDK3_LIBRARIES}
-    ${GTK3_LIBRARIES}
+    GTK::GTK
 )
 
 # TestWebKitAPIBase
@@ -89,7 +83,6 @@ target_include_directories(TestWebKitAPIInjectedBundle PRIVATE
 )
 target_include_directories(TestWebKitAPIInjectedBundle SYSTEM PRIVATE
     ${GLIB_INCLUDE_DIRS}
-    ${GTK3_INCLUDE_DIRS}
 )
 
 # TestJSC
@@ -99,7 +92,6 @@ set(TestJSC_SOURCES
 
 set(TestJSC_SYSTEM_INCLUDE_DIRECTORIES
     ${GLIB_INCLUDE_DIRS}
-    ${GTK3_INCLUDE_DIRS}
 )
 
 set(TestJSC_PRIVATE_INCLUDE_DIRECTORIES
index a586a6a..1471dd6 100644 (file)
@@ -14,14 +14,13 @@ list(APPEND WebKitGLibAPITests_INCLUDE_DIRECTORIES
 
 list(APPEND WebKitGLibAPITests_SYSTEM_INCLUDE_DIRECTORIES
     ${ATSPI_INCLUDE_DIRS}
-    ${GTK3_INCLUDE_DIRS}
     ${GTK_UNIX_PRINT_INCLUDE_DIRS}
 )
 
 list(APPEND WebKitGLibAPITest_LIBRARIES
     ${ATSPI_LIBRARIES}
-    ${GTK3_LIBRARIES}
     ${GTK_UNIX_PRINT_LIBRARIES}
+    GTK::GTK
 )
 
 list(APPEND WebKitGLibAPIWebProcessTests
index 42a8ec9..a435530 100644 (file)
@@ -20,23 +20,22 @@ list(APPEND WebKitTestRunner_INCLUDE_DIRECTORIES
 
 list(APPEND WebKitTestRunner_SYSTEM_INCLUDE_DIRECTORIES
     ${ATK_INCLUDE_DIRS}
-    ${GTK3_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
 )
 
 list(APPEND WebKitTestRunner_LIBRARIES
     Cairo::Cairo
     ${ATK_LIBRARIES}
-    ${GTK3_LIBRARIES}
     ${GLIB_LIBRARIES}
+    GTK::GTK
     WebCore
 )
 
 set(WebKitTestRunnerInjectedBundle_LIBRARIES
     ${ATK_LIBRARIES}
     ${GLIB_LIBRARIES}
-    ${GTK3_LIBRARIES}
     Fontconfig::Fontconfig
+    GTK::GTK
     WebCoreTestSupport
     WebKit
 )