[GStreamer][GTK][WPE] Move common things to GStreamer cmake files
authorcalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Aug 2017 08:44:36 +0000 (08:44 +0000)
committercalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Aug 2017 08:44:36 +0000 (08:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175625

Three files were created as kind of hooks for the GTK and WPE
CMake option files. The definitions one is to enable, disable and
create the common options (that can be and are actually overriden
in some cases. The dependencies one adds dependencies for the
option switches that are set. The checks one ensure the
dependencies are met depending on the option switches.

Reviewed by Žan Doberšek.

* Source/cmake/GStreamerChecks.cmake: Added.
* Source/cmake/GStreamerDefinitions.cmake: Added.
* Source/cmake/GStreamerDependencies.cmake: Added.
* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:

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

ChangeLog
Source/cmake/GStreamerChecks.cmake [new file with mode: 0644]
Source/cmake/GStreamerDefinitions.cmake [new file with mode: 0644]
Source/cmake/GStreamerDependencies.cmake [new file with mode: 0644]
Source/cmake/OptionsGTK.cmake
Source/cmake/OptionsWPE.cmake

index 9ffd372..ec6bb83 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2017-08-22  Xabier Rodriguez Calvar  <calvaris@igalia.com>
+
+        [GStreamer][GTK][WPE] Move common things to GStreamer cmake files
+        https://bugs.webkit.org/show_bug.cgi?id=175625
+
+        Three files were created as kind of hooks for the GTK and WPE
+        CMake option files. The definitions one is to enable, disable and
+        create the common options (that can be and are actually overriden
+        in some cases. The dependencies one adds dependencies for the
+        option switches that are set. The checks one ensure the
+        dependencies are met depending on the option switches.
+
+        Reviewed by Žan Doberšek.
+
+        * Source/cmake/GStreamerChecks.cmake: Added.
+        * Source/cmake/GStreamerDefinitions.cmake: Added.
+        * Source/cmake/GStreamerDependencies.cmake: Added.
+        * Source/cmake/OptionsGTK.cmake:
+        * Source/cmake/OptionsWPE.cmake:
+
 2017-08-17  Andreas Kling  <akling@apple.com>
 
         Disable CSS regions at compile time
diff --git a/Source/cmake/GStreamerChecks.cmake b/Source/cmake/GStreamerChecks.cmake
new file mode 100644 (file)
index 0000000..5a6101d
--- /dev/null
@@ -0,0 +1,47 @@
+if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
+    set(GSTREAMER_COMPONENTS app pbutils)
+    SET_AND_EXPOSE_TO_BUILD(USE_GSTREAMER TRUE)
+    if (ENABLE_VIDEO)
+        list(APPEND GSTREAMER_COMPONENTS video mpegts tag gl)
+    endif ()
+
+    if (ENABLE_WEB_AUDIO)
+        list(APPEND GSTREAMER_COMPONENTS audio fft)
+        SET_AND_EXPOSE_TO_BUILD(USE_WEBAUDIO_GSTREAMER TRUE)
+    endif ()
+
+    find_package(GStreamer 1.2.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
+
+    if (ENABLE_WEB_AUDIO)
+        if (NOT PC_GSTREAMER_AUDIO_FOUND OR NOT PC_GSTREAMER_FFT_FOUND)
+            message(FATAL_ERROR "WebAudio requires the audio and fft GStreamer libraries. Please check your gst-plugins-base installation.")
+        else ()
+            SET_AND_EXPOSE_TO_BUILD(USE_WEBAUDIO_GSTREAMER TRUE)
+        endif ()
+    endif ()
+
+    if (ENABLE_VIDEO)
+        if (NOT PC_GSTREAMER_APP_FOUND OR NOT PC_GSTREAMER_PBUTILS_FOUND OR NOT PC_GSTREAMER_TAG_FOUND OR NOT PC_GSTREAMER_VIDEO_FOUND)
+            message(FATAL_ERROR "Video playback requires the following GStreamer libraries: app, pbutils, tag, video. Please check your gst-plugins-base installation.")
+        endif ()
+    endif ()
+
+    if (USE_GSTREAMER_MPEGTS)
+        if (NOT PC_GSTREAMER_MPEGTS_FOUND)
+            message(FATAL_ERROR "GStreamer MPEG-TS is needed for USE_GSTREAMER_MPEGTS.")
+        endif ()
+    endif ()
+
+    if (USE_GSTREAMER_GL)
+        if (PC_GSTREAMER_VERSION VERSION_LESS "1.10")
+            set(USE_GSTREAMER_GL OFF)
+            message(STATUS "Disabling GSTREAMER_GL as the GStreamer version is older than 1.10.")
+        else ()
+            if (NOT PC_GSTREAMER_GL_FOUND)
+                message(FATAL_ERROR "GStreamerGL is needed for USE_GSTREAMER_GL.")
+            endif ()
+        endif ()
+    endif ()
+
+    SET_AND_EXPOSE_TO_BUILD(USE_GSTREAMER TRUE)
+endif ()
diff --git a/Source/cmake/GStreamerDefinitions.cmake b/Source/cmake/GStreamerDefinitions.cmake
new file mode 100644 (file)
index 0000000..514f970
--- /dev/null
@@ -0,0 +1,6 @@
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO_TRACK PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO PUBLIC ON)
+
+WEBKIT_OPTION_DEFINE(USE_GSTREAMER_GL "Whether to enable support for GStreamer GL" PRIVATE ON)
+WEBKIT_OPTION_DEFINE(USE_GSTREAMER_MPEGTS "Whether to enable support for MPEG-TS" PRIVATE OFF)
diff --git a/Source/cmake/GStreamerDependencies.cmake b/Source/cmake/GStreamerDependencies.cmake
new file mode 100644 (file)
index 0000000..e141dda
--- /dev/null
@@ -0,0 +1,5 @@
+if (DEFINED ENABLE_OPENGL)
+  WEBKIT_OPTION_DEPEND(USE_GSTREAMER_GL ENABLE_OPENGL)
+endif ()
+WEBKIT_OPTION_DEPEND(USE_GSTREAMER_GL ENABLE_VIDEO)
+WEBKIT_OPTION_DEPEND(USE_GSTREAMER_MPEGTS ENABLE_VIDEO)
index 2ce7b26..09fad42 100644 (file)
@@ -54,6 +54,8 @@ find_package(OpenGLES2)
 
 WEBKIT_OPTION_BEGIN()
 
+include(GStreamerDefinitions)
+
 set(USE_CAIRO ON)
 set(USE_WOFF2 ON)
 set(USE_XDGMIME ON)
@@ -94,8 +96,6 @@ WEBKIT_OPTION_DEFINE(USE_LIBSECRET "Whether to enable the persistent credential
 
 # Private options specific to the GTK+ port. Changing these options is
 # completely unsupported. They are intended for use only by WebKit developers.
-WEBKIT_OPTION_DEFINE(USE_GSTREAMER_GL "Whether to enable support for GStreamer GL" PRIVATE ON)
-WEBKIT_OPTION_DEFINE(USE_GSTREAMER_MPEGTS "Whether to enable support for MPEG-TS" PRIVATE OFF)
 WEBKIT_OPTION_DEFINE(USE_REDIRECTED_XCOMPOSITE_WINDOW "Whether to use a Redirected XComposite Window for accelerated compositing in X11." PRIVATE ON)
 
 # FIXME: Can we use cairo-glesv2 to avoid this conflict?
@@ -109,9 +109,6 @@ WEBKIT_OPTION_DEPEND(ENABLE_WEBGL ENABLE_OPENGL)
 WEBKIT_OPTION_DEPEND(ENABLE_SUBTLE_CRYPTO ENABLE_WEB_CRYPTO)
 WEBKIT_OPTION_DEPEND(USE_REDIRECTED_XCOMPOSITE_WINDOW ENABLE_OPENGL)
 WEBKIT_OPTION_DEPEND(USE_REDIRECTED_XCOMPOSITE_WINDOW ENABLE_X11_TARGET)
-WEBKIT_OPTION_DEPEND(USE_GSTREAMER_GL ENABLE_OPENGL)
-WEBKIT_OPTION_DEPEND(USE_GSTREAMER_GL ENABLE_VIDEO)
-WEBKIT_OPTION_DEPEND(USE_GSTREAMER_MPEGTS ENABLE_VIDEO)
 
 SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
 if (DEVELOPER_MODE)
@@ -144,8 +141,6 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_JIT PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SAMPLING_PROFILER PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SPELLCHECK PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PUBLIC ON)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO PUBLIC ON)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBDRIVER PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SYSTEM_MALLOC PUBLIC OFF)
 
@@ -171,9 +166,10 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USERSELECT_ALL PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SUBTLE_CRYPTO PRIVATE ON)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO_TRACK PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PRIVATE ON)
 
+include(GStreamerDefinitions)
+
 # Finalize the value for all options. Do not attempt to use an option before
 # this point, and do not attempt to change any option after this point.
 WEBKIT_OPTION_END()
@@ -325,53 +321,6 @@ if (ENABLE_SPELLCHECK)
     endif ()
 endif ()
 
-if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
-    set(GSTREAMER_COMPONENTS app pbutils)
-
-    if (ENABLE_VIDEO)
-        list(APPEND GSTREAMER_COMPONENTS video mpegts tag gl)
-    endif ()
-
-    if (ENABLE_WEB_AUDIO)
-        list(APPEND GSTREAMER_COMPONENTS audio fft)
-    endif ()
-
-    find_package(GStreamer 1.2.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
-
-    if (ENABLE_WEB_AUDIO)
-        if (NOT PC_GSTREAMER_AUDIO_FOUND OR NOT PC_GSTREAMER_FFT_FOUND)
-            message(FATAL_ERROR "WebAudio requires the audio and fft GStreamer libraries. Please check your gst-plugins-base installation.")
-        else ()
-            SET_AND_EXPOSE_TO_BUILD(USE_WEBAUDIO_GSTREAMER TRUE)
-        endif ()
-    endif ()
-
-    if (ENABLE_VIDEO)
-        if (NOT PC_GSTREAMER_APP_FOUND OR NOT PC_GSTREAMER_PBUTILS_FOUND OR NOT PC_GSTREAMER_TAG_FOUND OR NOT PC_GSTREAMER_VIDEO_FOUND)
-            message(FATAL_ERROR "Video playback requires the following GStreamer libraries: app, pbutils, tag, video. Please check your gst-plugins-base installation.")
-        endif ()
-    endif ()
-
-    if (USE_GSTREAMER_MPEGTS)
-        if (NOT PC_GSTREAMER_MPEGTS_FOUND)
-            message(FATAL_ERROR "GStreamer MPEG-TS is needed for USE_GSTREAMER_MPEGTS.")
-        endif ()
-    endif ()
-
-    if (USE_GSTREAMER_GL)
-        if (PC_GSTREAMER_VERSION VERSION_LESS "1.10")
-            set(USE_GSTREAMER_GL OFF)
-            message(STATUS "Disabling GSTREAMER_GL as the GStreamer version is older than 1.10.")
-        else ()
-            if (NOT PC_GSTREAMER_GL_FOUND)
-                message(FATAL_ERROR "GStreamerGL is needed for USE_GSTREAMER_GL.")
-            endif ()
-        endif ()
-    endif ()
-
-    SET_AND_EXPOSE_TO_BUILD(USE_GSTREAMER TRUE)
-endif ()
-
 if (ENABLE_QUARTZ_TARGET)
     if (NOT GTK3_SUPPORTS_QUARTZ)
         message(FATAL_ERROR "Recompile GTK+ with Quartz backend to use ENABLE_QUARTZ_TARGET")
@@ -474,3 +423,5 @@ macro(ADD_WHOLE_ARCHIVE_TO_LIBRARIES _list_name)
         set(${_list_name} "${${_list_name}_TMP}")
     endif ()
 endmacro()
+
+include(GStreamerChecks)
index 9aaf8c4..7a55f17 100644 (file)
@@ -8,6 +8,8 @@ set(WPE_API_VERSION 0.1)
 
 WEBKIT_OPTION_BEGIN()
 
+include(GStreamerDefinitions)
+
 # WebKit2 C API
 WEBKIT_OPTION_DEFINE(EXPORT_DEPRECATED_WEBKIT2_C_API "Whether to export the WebKit2 C API" PRIVATE OFF)
 
@@ -30,10 +32,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SUBTLE_CRYPTO PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE ON)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO PUBLIC ON)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO_TRACK PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_ANIMATIONS PRIVATE ON)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PUBLIC ON)
 
 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
@@ -42,7 +41,7 @@ else ()
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE OFF)
 endif ()
 
-WEBKIT_OPTION_DEFINE(USE_GSTREAMER_GL "Whether to enable support for GStreamer GL" PRIVATE OFF)
+include(GStreamerDependencies)
 
 WEBKIT_OPTION_END()
 
@@ -83,23 +82,6 @@ set(USE_CAIRO ON)
 set(USE_XDGMIME ON)
 SET_AND_EXPOSE_TO_BUILD(USE_GCRYPT TRUE)
 
-if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
-    set(GSTREAMER_COMPONENTS app audio pbutils)
-    SET_AND_EXPOSE_TO_BUILD(USE_GSTREAMER TRUE)
-    if (ENABLE_VIDEO)
-        list(APPEND GSTREAMER_COMPONENTS video tag)
-    endif ()
-
-    if (ENABLE_WEB_AUDIO)
-        list(APPEND GSTREAMER_COMPONENTS fft)
-        SET_AND_EXPOSE_TO_BUILD(USE_WEBAUDIO_GSTREAMER TRUE)
-    endif ()
-
-    find_package(GStreamer 1.2.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
-
-    # FIXME: What about MPEGTS support? USE_GSTREAMER_MPEGTS?
-endif ()
-
 if (ENABLE_MEDIA_STREAM OR ENABLE_WEB_RTC)
     find_package(OpenWebRTC)
     if (NOT OPENWEBRTC_FOUND)
@@ -153,3 +135,5 @@ if (NOT DEVELOPER_MODE)
     set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fvisibility=hidden")
     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility=hidden -fvisibility-inlines-hidden")
 endif ()
+
+include(GStreamerChecks)