meson: Add an option to select the method for finding Qt

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>
This commit is contained in:
Nirbheek Chauhan 2022-12-22 21:23:39 +05:30 committed by GStreamer Marge Bot
parent 19603248c2
commit 92b9c604c4
3 changed files with 16 additions and 10 deletions

View file

@ -22,6 +22,7 @@ moc_headers = [
# deciding whether to build the qt5 examples # deciding whether to build the qt5 examples
qt5qml_dep = dependency('', required: false) qt5qml_dep = dependency('', required: false)
qt5_option = get_option('qt5') qt5_option = get_option('qt5')
qt5_method = get_option('qt-method')
if qt5_option.disabled() if qt5_option.disabled()
subdir_done() subdir_done()
@ -40,7 +41,7 @@ endif
qt5_mod = import('qt5') qt5_mod = import('qt5')
qt5qml_dep = dependency('qt5', modules : ['Core', 'Gui', 'Qml', 'Quick'], 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 # 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 # 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 if gst_gl_have_window_x11 and gst_gl_have_platform_glx
# FIXME: automagic # FIXME: automagic
qt5x11extras = dependency('qt5', modules : ['X11Extras'], required : false) qt5x11extras = dependency('qt5', modules : ['X11Extras'], method: qt5_method, required : false)
if qt5x11extras.found() if qt5x11extras.found()
optional_deps += [qt5x11extras, gstglx11_dep] optional_deps += [qt5x11extras, gstglx11_dep]
qt_defines += ['-DHAVE_QT_X11'] qt_defines += ['-DHAVE_QT_X11']
@ -95,7 +96,7 @@ if gst_gl_have_platform_egl
# Wayland windowing # Wayland windowing
if gst_gl_have_window_wayland if gst_gl_have_window_wayland
# FIXME: automagic # FIXME: automagic
qt5waylandextras = dependency('qt5', modules : ['WaylandClient'], required : false) qt5waylandextras = dependency('qt5', modules : ['WaylandClient'], method: qt5_method, required : false)
if qt5waylandextras.found() if qt5waylandextras.found()
optional_deps += [qt5waylandextras, gstglwayland_dep] optional_deps += [qt5waylandextras, gstglwayland_dep]
qt_defines += ['-DHAVE_QT_WAYLAND'] qt_defines += ['-DHAVE_QT_WAYLAND']
@ -105,7 +106,7 @@ if gst_gl_have_platform_egl
# Android windowing # Android windowing
if gst_gl_have_window_android if gst_gl_have_window_android
# FIXME: automagic # 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 # for gl functions in QtGui/qopenglfunctions.h
# FIXME: automagic # FIXME: automagic
glesv2_dep = cc.find_library('GLESv2', required : false) 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 if gst_gl_have_window_cocoa and gst_gl_have_platform_cgl
# FIXME: automagic # FIXME: automagic
qt5macextras = dependency('qt5', modules : ['MacExtras'], required : false) qt5macextras = dependency('qt5', modules : ['MacExtras'], method: qt5_method, required : false)
if qt5macextras.found() if qt5macextras.found()
qt_defines += ['-DHAVE_QT_MAC'] qt_defines += ['-DHAVE_QT_MAC']
optional_deps += qt5macextras optional_deps += qt5macextras

View file

@ -14,6 +14,7 @@ moc_headers = [
qt6qml_dep = dependency('', required: false) qt6qml_dep = dependency('', required: false)
qt6_option = get_option('qt6') qt6_option = get_option('qt6')
qt6_method = get_option('qt-method')
if qt6_option.disabled() if qt6_option.disabled()
subdir_done() subdir_done()
@ -39,7 +40,7 @@ if not qt6_mod.has_tools()
endif endif
qt6qml_dep = dependency('qt6', modules : ['Core', 'Gui', 'Qml', 'Quick'], 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() if not qt6qml_dep.found()
subdir_done() subdir_done()
endif endif
@ -76,7 +77,7 @@ if gst_gl_have_platform_egl
# Wayland windowing # Wayland windowing
if gst_gl_have_window_wayland if gst_gl_have_window_wayland
# FIXME: automagic # FIXME: automagic
qt6waylandextras = dependency('qt6', modules : ['WaylandClient'], required : false) qt6waylandextras = dependency('qt6', modules : ['WaylandClient'], method: qt6_method, required : false)
if qt6waylandextras.found() if qt6waylandextras.found()
optional_deps += [qt6waylandextras, gstglwayland_dep] optional_deps += [qt6waylandextras, gstglwayland_dep]
qt_defines += ['-DHAVE_QT_WAYLAND'] qt_defines += ['-DHAVE_QT_WAYLAND']
@ -86,7 +87,7 @@ if gst_gl_have_platform_egl
# Android windowing # Android windowing
# if gst_gl_have_window_android # if gst_gl_have_window_android
# FIXME: automagic # 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 # for gl functions in QtGui/qopenglfunctions.h
# FIXME: automagic # FIXME: automagic
# glesv2_dep = cc.find_library('GLESv2', required : false) # glesv2_dep = cc.find_library('GLESv2', required : false)

View 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('osxvideo', type : 'feature', value : 'auto', description : 'macOS Cocoa video sink plugin')
option('png', type : 'feature', value : 'auto', description : 'PNG image codec 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('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('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('soup', type : 'feature', value : 'auto', description : 'libsoup HTTP client source/sink plugin')
option('speex', type : 'feature', value : 'auto', description : 'Speex audio codec 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-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') 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 # ximagesrc plugin options
option('ximagesrc', type : 'feature', value : 'auto', description : 'X11 ximagesrc plugin') option('ximagesrc', type : 'feature', value : 'auto', description : 'X11 ximagesrc plugin')
option('ximagesrc-xshm', type : 'feature', value : 'auto', description : 'X11 ximagesrc plugin (XSHM support)') option('ximagesrc-xshm', type : 'feature', value : 'auto', description : 'X11 ximagesrc plugin (XSHM support)')