meson: Add an option to select the method for finding Qt
authorNirbheek Chauhan <nirbheek@centricular.com>
Thu, 22 Dec 2022 15:53:39 +0000 (21:23 +0530)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 29 Dec 2022 09:53:17 +0000 (09:53 +0000)
This is needed by Cerbero, since we want to force the use of qmake to
find Qt on non-Linux platforms.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3628>

subprojects/gst-plugins-good/ext/qt/meson.build
subprojects/gst-plugins-good/ext/qt6/meson.build
subprojects/gst-plugins-good/meson_options.txt

index eb291b8..b1c47f0 100644 (file)
@@ -22,6 +22,7 @@ moc_headers = [
 # deciding whether to build the qt5 examples
 qt5qml_dep = dependency('', required: false)
 qt5_option = get_option('qt5')
+qt5_method = get_option('qt-method')
 
 if qt5_option.disabled()
   subdir_done()
@@ -40,7 +41,7 @@ endif
 
 qt5_mod = import('qt5')
 qt5qml_dep = dependency('qt5', modules : ['Core', 'Gui', 'Qml', 'Quick'],
-                        required: qt5_option, static: host_machine.system() == 'ios')
+                        method: qt5_method, required: qt5_option, static: host_system == 'ios')
 
 # On Linux, distros often have the Qt5 pkg-config files and moc in separate
 # packages, so the user may not have both installed. Check for moc and ensure
@@ -78,7 +79,7 @@ endif
 
 if gst_gl_have_window_x11 and gst_gl_have_platform_glx
   # FIXME: automagic
-  qt5x11extras = dependency('qt5', modules : ['X11Extras'], required : false)
+  qt5x11extras = dependency('qt5', modules : ['X11Extras'], method: qt5_method, required : false)
   if qt5x11extras.found()
     optional_deps += [qt5x11extras, gstglx11_dep]
     qt_defines += ['-DHAVE_QT_X11']
@@ -95,7 +96,7 @@ if gst_gl_have_platform_egl
     # Wayland windowing
     if gst_gl_have_window_wayland
       # FIXME: automagic
-      qt5waylandextras = dependency('qt5', modules : ['WaylandClient'], required : false)
+      qt5waylandextras = dependency('qt5', modules : ['WaylandClient'], method: qt5_method, required : false)
       if qt5waylandextras.found()
         optional_deps += [qt5waylandextras, gstglwayland_dep]
         qt_defines += ['-DHAVE_QT_WAYLAND']
@@ -105,7 +106,7 @@ if gst_gl_have_platform_egl
     # Android windowing
     if gst_gl_have_window_android
       # FIXME: automagic
-      qt5androidextras = dependency('qt5', modules : ['AndroidExtras'], required : false)
+      qt5androidextras = dependency('qt5', modules : ['AndroidExtras'], method: qt5_method, required : false)
       # for gl functions in QtGui/qopenglfunctions.h
       # FIXME: automagic
       glesv2_dep = cc.find_library('GLESv2', required : false)
@@ -134,7 +135,7 @@ endif
 
 if gst_gl_have_window_cocoa and gst_gl_have_platform_cgl
   # FIXME: automagic
-  qt5macextras = dependency('qt5', modules : ['MacExtras'], required : false)
+  qt5macextras = dependency('qt5', modules : ['MacExtras'], method: qt5_method, required : false)
   if qt5macextras.found()
     qt_defines += ['-DHAVE_QT_MAC']
     optional_deps += qt5macextras
index 4523d2d..150b0b9 100644 (file)
@@ -14,6 +14,7 @@ moc_headers = [
 
 qt6qml_dep = dependency('', required: false)
 qt6_option = get_option('qt6')
+qt6_method = get_option('qt-method')
 
 if qt6_option.disabled()
   subdir_done()
@@ -39,7 +40,7 @@ if not qt6_mod.has_tools()
 endif
 
 qt6qml_dep = dependency('qt6', modules : ['Core', 'Gui', 'Qml', 'Quick'],
-                        required: qt6_option, static: host_machine.system() == 'ios')
+                        method: qt6_method, required: qt6_option, static: host_system == 'ios')
 if not qt6qml_dep.found()
   subdir_done()
 endif
@@ -76,7 +77,7 @@ if gst_gl_have_platform_egl
     # Wayland windowing
     if gst_gl_have_window_wayland
       # FIXME: automagic
-      qt6waylandextras = dependency('qt6', modules : ['WaylandClient'], required : false)
+      qt6waylandextras = dependency('qt6', modules : ['WaylandClient'], method: qt6_method, required : false)
       if qt6waylandextras.found()
         optional_deps += [qt6waylandextras, gstglwayland_dep]
         qt_defines += ['-DHAVE_QT_WAYLAND']
@@ -86,7 +87,7 @@ if gst_gl_have_platform_egl
     # Android windowing
 #    if gst_gl_have_window_android
       # FIXME: automagic
-#      qt5androidextras = dependency('qt5', modules : ['AndroidExtras'], required : false)
+#      qt5androidextras = dependency('qt5', modules : ['AndroidExtras'], method: qt6_method, required : false)
       # for gl functions in QtGui/qopenglfunctions.h
       # FIXME: automagic
 #      glesv2_dep = cc.find_library('GLESv2', required : false)
index 81b78d0..3e472bd 100644 (file)
@@ -66,8 +66,6 @@ option('osxaudio', type : 'feature', value : 'auto', description : 'macOS/iOS Co
 option('osxvideo', type : 'feature', value : 'auto', description : 'macOS Cocoa video sink plugin')
 option('png', type : 'feature', value : 'auto', description : 'PNG image codec plugin')
 option('pulse', type : 'feature', value : 'auto', description : 'Pulseaudio audio source/sink plugin')
-option('qt5', type : 'feature', value : 'auto', yield : true, description : 'Qt5 QML video sink plugin')
-option('qt6', type : 'feature', value : 'auto', yield : true, description : 'Qt6 QML video sink plugin')
 option('shout2', type : 'feature', value : 'auto', description : 'Shout-casting network sink plugin based on libshout2')
 option('soup', type : 'feature', value : 'auto', description : 'libsoup HTTP client source/sink plugin')
 option('speex', type : 'feature', value : 'auto', description : 'Speex audio codec plugin')
@@ -86,6 +84,12 @@ option('rpicamsrc', type : 'feature', value : 'auto', description : 'Raspberry P
 option('rpi-header-dir', type : 'string', value : '/opt/vc/include', description : 'Directory where VideoCore/MMAL headers and bcm_host.h can be found')
 option('rpi-lib-dir', type : 'string', value : '/opt/vc/lib', description : 'Directory where VideoCore/MMAL libraries can be found')
 
+# Qt plugin options
+option('qt-method', type: 'combo', value: 'auto', choices: ['auto', 'pkg-config', 'qmake'],
+       description: 'Method to use to find Qt')
+option('qt5', type : 'feature', value : 'auto', yield : true, description : 'Qt5 QML video sink plugin')
+option('qt6', type : 'feature', value : 'auto', yield : true, description : 'Qt6 QML video sink plugin')
+
 # ximagesrc plugin options
 option('ximagesrc', type : 'feature', value : 'auto', description : 'X11 ximagesrc plugin')
 option('ximagesrc-xshm', type : 'feature', value : 'auto', description : 'X11 ximagesrc plugin (XSHM support)')