[CMake] FindGTK3.cmake should not modify the values of build options
authormcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Jun 2015 02:41:09 +0000 (02:41 +0000)
committermcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Jun 2015 02:41:09 +0000 (02:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144613

Reviewed by Martin Robinson.

* Source/cmake/FindGTK3.cmake: Do not check or set the value of ENABLE_X11_TARGET and
ENABLE_WAYLAND_TARGET. Instead, simply define the variables GTK3_SUPPORTS_X11 and
GTK3_SUPPORTS_WAYLAND as appropriate. Also, rename GTK_SUPPORTS_GESTURES to
GTK3_SUPPORTS_GESTURES for consistency.
* Source/cmake/OptionsGTK.cmake: Fail the build if the appropriate GTK+ backend is not
available. It's not possible to automatically select a backend correctly anymore, since all
options are set at the same time.

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

ChangeLog
Source/cmake/FindGTK3.cmake
Source/cmake/OptionsGTK.cmake

index 4d551d1..2125418 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2015-06-19  Michael Catanzaro  <mcatanzaro@igalia.com>
+
+        [CMake] FindGTK3.cmake should not modify the values of build options
+        https://bugs.webkit.org/show_bug.cgi?id=144613
+
+        Reviewed by Martin Robinson.
+
+        * Source/cmake/FindGTK3.cmake: Do not check or set the value of ENABLE_X11_TARGET and
+        ENABLE_WAYLAND_TARGET. Instead, simply define the variables GTK3_SUPPORTS_X11 and
+        GTK3_SUPPORTS_WAYLAND as appropriate. Also, rename GTK_SUPPORTS_GESTURES to
+        GTK3_SUPPORTS_GESTURES for consistency.
+        * Source/cmake/OptionsGTK.cmake: Fail the build if the appropriate GTK+ backend is not
+        available. It's not possible to automatically select a backend correctly anymore, since all
+        options are set at the same time.
+
 2015-06-19  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         Remove unnecessary svn:executable flags
index c8e8750..37d5a00 100644 (file)
@@ -4,9 +4,12 @@
 #  GTK3_FOUND - system has GTK+ 3.
 #  GTK3_INCLUDE_DIRS - the GTK+ 3. include directories
 #  GTK3_LIBRARIES - link these to use GTK+ 3.
+#  GTK3_SUPPORTS_GESTURES - GTK+ supports gestures (GTK+ >= 3.14)
+#  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 Igalia S.L.
+# 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
@@ -45,29 +48,22 @@ if (GTK3_VERSION)
     endif ()
 endif ()
 
-if (GTK3_VERSION AND VERSION_OK AND ENABLE_X11_TARGET)
+if (GTK3_VERSION AND VERSION_OK)
     pkg_check_modules(GTK3_X11 gtk+-x11-3.0)
-    if (NOT("${GTK3_X11_VERSION}" VERSION_EQUAL "${GTK3_VERSION}"))
-        set(ENABLE_X11_TARGET OFF)
+    if ("${GTK3_X11_VERSION}" VERSION_EQUAL "${GTK3_VERSION}")
+        set(GTK3_SUPPORTS_X11 TRUE)
     endif ()
-endif ()
 
-if (GTK3_VERSION AND VERSION_OK AND ENABLE_WAYLAND_TARGET)
     pkg_check_modules(GTK3_WAYLAND gtk+-wayland-3.0)
-    if (NOT("${GTK3_WAYLAND_VERSION}" VERSION_EQUAL "${GTK3_VERSION}"))
-        set(ENABLE_WAYLAND_TARGET OFF)
+    if ("${GTK3_WAYLAND_VERSION}" VERSION_EQUAL "${GTK3_VERSION}")
+        set(GTK3_SUPPORTS_WAYLAND TRUE)
     endif ()
-endif ()
-
-if (NOT(ENABLE_X11_TARGET OR ENABLE_WAYLAND_TARGET))
-    message(FATAL_ERROR "At least one of the following windowing targets must "
-        "be enabled and also supported by the GTK+ dependency: X11, Wayland")
-endif ()
 
-if (GTK3_VERSION AND VERSION_OK AND NOT("${GTK3_VERSION}" VERSION_LESS "3.14.0"))
-    set(GTK_SUPPORTS_GESTURES ON)
-else ()
-    set(GTK_SUPPORTS_GESTURES OFF)
+    if (NOT("${GTK3_VERSION}" VERSION_LESS "3.14.0"))
+        set(GTK3_SUPPORTS_GESTURES ON)
+    else ()
+        set(GTK3_SUPPORTS_GESTURES OFF)
+    endif ()
 endif ()
 
 include(FindPackageHandleStandardArgs)
index c3fab68..55ae243 100644 (file)
@@ -237,8 +237,8 @@ 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_GESTURES ${GTK3_SUPPORTS_GESTURES})
 SET_AND_EXPOSE_TO_BUILD(HAVE_GTK_UNIX_PRINTING ${GTK_UNIX_PRINT_FOUND})
-SET_AND_EXPOSE_TO_BUILD(HAVE_GTK_GESTURES ${GTK_SUPPORTS_GESTURES})
 
 set(glib_components gio gobject gthread gmodule)
 if (ENABLE_GAMEPAD_DEPRECATED OR ENABLE_GEOLOCATION)
@@ -378,6 +378,10 @@ if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
 endif ()
 
 if (ENABLE_X11_TARGET)
+    if (NOT GTK3_SUPPORTS_X11)
+        message(FATAL_ERROR "Recompile GTK+ with X11 backend to use ENABLE_X11_TARGET")
+    endif ()
+
     find_package(X11 REQUIRED)
     if (NOT X11_Xcomposite_FOUND)
         message(FATAL_ERROR "libXcomposite is required for ENABLE_X11_TARGET")
@@ -391,6 +395,10 @@ if (ENABLE_X11_TARGET)
 endif ()
 
 if (ENABLE_WAYLAND_TARGET)
+    if (NOT GTK3_SUPPORTS_WAYLAND)
+        message(FATAL_ERROR "Recompile GTK+ with Wayland backend to use ENABLE_WAYLAND_TARGET")
+    endif ()
+
     find_package(Wayland REQUIRED)
 endif ()