meson: Rework build files for qt examples in -base

The build files had quite a few things wrong:

* Not using the method: kwarg, which can cause the wrong Qt to be
  used for building
* There was no way to enable the build for them
* Qt was being detected multiple times, differently
* Unnecessary check for libGL
* have_cxx was being used incorrectly
* Qt tool detection was outdated

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9046>
This commit is contained in:
Nirbheek Chauhan 2025-05-21 20:25:26 +05:30 committed by GStreamer Marge Bot
parent 0ba85c84a1
commit 32eaa0ae35
9 changed files with 70 additions and 56 deletions

View File

@ -76,6 +76,10 @@ option('tools', type : 'feature', value : 'auto', yield : true)
option('introspection', type : 'feature', value : 'auto', yield : true, description : 'Generate gobject-introspection bindings')
option('nls', type : 'feature', value : 'auto', yield: true, description : 'Enable native language support (translations)')
option('orc', type : 'feature', value : 'auto', yield : true)
# Qt tests 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 examples')
# Common options

View File

@ -1,6 +1,5 @@
subdir('cocoa')
subdir('generic')
subdir('gtk', if_found : gtk_dep)
qt5core_dep = dependency('qt5', modules : ['Core'], required : false)
subdir('qt', if_found: qt5core_dep)
subdir('gtk', if_found: gtk_dep)
subdir('qt', if_found: qt5gui_dep)
subdir('sdl')

View File

@ -1,23 +1,18 @@
if get_option('qt5').disabled()
qt_cxx_warn_less = cxx.get_supported_arguments(['-Wno-aggregate-return'])
subdir('videooverlay')
if not qt5_have_tools
subdir_done()
endif
qt5_mod = import('qt5')
subdir('mousevideooverlay')
qt5gui_dep = dependency('qt5', modules : ['Core', 'Gui', 'Widgets'], required : false)
qt5opengl_dep = dependency('qt5', modules : ['OpenGL'], required : false)
#FIXME; other platforms
libgl = cc.find_library ('GL', required : false)
qt_cxx_warn_less = cxx.get_supported_arguments(['-Wno-aggregate-return'])
if qt5gui_dep.found()
subdir('videooverlay')
if libgl.found()
subdir('mousevideooverlay')
if qt5opengl_dep.found()
subdir('qglwidgetvideooverlay')
subdir('qglwtextureshare')
endif
endif
gl_option = get_option('gl')
qt5gl_option = qt5_option.disable_auto_if(not gstgl_dep.found())
qt5opengl_dep = dependency('qt5', modules: ['OpenGL'], method: qt5_method,
required: qt5gl_option.enabled() and gl_option.enabled() and examples_option.enabled())
if qt5opengl_dep.found()
subdir('qglwidgetvideooverlay')
subdir('qglwtextureshare')
endif

View File

@ -11,9 +11,9 @@ moc_headers = [
'qrenderer.h',
]
moc_files = qt5_mod.preprocess(moc_headers : moc_headers)
moc_files = qt5_mod.preprocess(moc_headers: moc_headers, method: qt5_method)
executable('mousevideoverlay', sources, moc_files,
cpp_args : [gst_plugins_base_args] + qt_cxx_warn_less,
include_directories: [configinc, libsinc],
dependencies : [qt5core_dep, qt5gui_dep, gst_dep, video_dep, gstgl_dep, gstglproto_dep],
dependencies : [qt5gui_dep, gst_dep, video_dep, gstgl_dep, gstglproto_dep],
install: false)

View File

@ -11,9 +11,9 @@ moc_headers = [
'qglrenderer.h',
]
moc_files = qt5_mod.preprocess(moc_headers : moc_headers)
moc_files = qt5_mod.preprocess(moc_headers: moc_headers, method: qt5_method)
executable('qglwidgetvideoverlay', sources, moc_files,
cpp_args : [gst_plugins_base_args] + qt_cxx_warn_less,
include_directories: [configinc, libsinc],
dependencies : [qt5core_dep, qt5gui_dep, qt5opengl_dep, gst_dep, video_dep, gstgl_dep, gstglproto_dep],
dependencies : [qt5gui_dep, qt5opengl_dep, gst_dep, video_dep, gstgl_dep, gstglproto_dep],
install: false)

View File

@ -13,7 +13,8 @@ moc_headers = [
qtwinsys_deps = []
if enabled_gl_winsys.contains('x11') and enabled_gl_platforms.contains('glx')
qt5x11extras = dependency('qt5', modules : ['X11Extras'], required : false)
qt5x11extras = dependency('qt5', modules: ['X11Extras'], method: qt5_method,
required: qt5_option)
if qt5x11extras.found()
qtwinsys_deps += [qt5x11extras, glx_dep]
else
@ -21,9 +22,9 @@ if enabled_gl_winsys.contains('x11') and enabled_gl_platforms.contains('glx')
endif
endif
moc_files = qt5_mod.preprocess(moc_headers : moc_headers)
moc_files = qt5_mod.preprocess(moc_headers: moc_headers, method: qt5_method)
executable('qglwtextureshare', sources, moc_files,
cpp_args : [gst_plugins_base_args] + qt_cxx_warn_less,
include_directories: [configinc, libsinc],
dependencies : [qt5core_dep, qt5gui_dep, qt5opengl_dep, qtwinsys_deps, gst_dep, video_dep, gstgl_dep, gstglproto_dep],
dependencies : [qt5gui_dep, qt5opengl_dep, qtwinsys_deps, gst_dep, video_dep, gstgl_dep, gstglproto_dep],
install: false)

View File

@ -1,5 +1,5 @@
executable('videoverlay', 'videooverlay.cpp',
cpp_args : [gst_plugins_base_args],
include_directories: [configinc, libsinc],
dependencies : [qt5core_dep, qt5gui_dep, gst_dep, video_dep],
dependencies : [qt5gui_dep, gst_dep, video_dep],
install: false)

View File

@ -7,10 +7,34 @@ subdir('decodebin_next')
subdir('encoding')
subdir('fft')
subdir('gio')
if build_gstgl
# Qt is used by gl/qt and overlay examples
examples_option = get_option('examples')
qt5_method = get_option('qt-method')
qt5_option = get_option('qt5').require(have_cxx)
qt5_option = qt5_option.disable_auto_if(examples_option.disabled())
qt5gui_dep = dependency('', required: false)
qt5opengl_dep = dependency('', required: false)
qt5_have_tools = false
qt5_mod = import('qt5')
if qt5_option.allowed()
qt5gui_dep = dependency('qt5', modules: ['Core', 'Gui', 'Widgets'], method: qt5_method,
required: qt5_option.enabled() and examples_option.enabled())
if meson.version().version_compare('>=1.6')
qt5_have_tools = qt5_mod.has_tools(method: qt5_method, tools: ['moc', 'uic', 'rcc'],
required: qt5_option.enabled() and examples_option.enabled())
else
qt5_have_tools = qt5_mod.has_tools(method: qt5_method,
required: qt5_option.enabled() and examples_option.enabled())
endif
endif
if gstgl_dep.found()
subdir('gl')
endif
subdir('overlay')
subdir('overlaycomposition')
subdir('playback')
subdir('playrec')

View File

@ -1,36 +1,27 @@
if get_option('qt5').disabled()
subdir_done()
endif
if x11_dep.found()
if gtk_x11_dep.found()
if x11_dep.found() and gtk_x11_dep.found()
executable('gtk-videooverlay', 'gtk-videooverlay.c',
c_args : gst_plugins_base_args,
include_directories: [configinc, libsinc],
dependencies : [gst_dep, video_dep, libm, x11_dep, gtk_x11_dep],
install: false)
endif
endif
if have_cxx # check for C++ support
qt5_mod = import('qt5')
qt5widgets_dep = dependency('qt5', modules : ['Core', 'Gui', 'Widgets'],
required: get_option('examples'))
if qt5gui_dep.found()
executable('qt-videooverlay', 'qt-videooverlay.cpp',
cpp_args : gst_plugins_base_args,
include_directories: [configinc, libsinc],
dependencies: [gst_dep, video_dep, libm, x11_dep, qt5gui_dep],
install: false)
if qt5widgets_dep.found() and qt5_mod.has_tools(required: get_option('examples'))
executable('qt-videooverlay', 'qt-videooverlay.cpp',
cpp_args : gst_plugins_base_args,
include_directories: [configinc, libsinc],
dependencies : [gst_dep, video_dep, libm, x11_dep, qt5widgets_dep],
install: false)
# FIXME: this doesn't work properly yet, no moc_qtgv-videooverlay.cpp generated
moc_files = qt5_mod.preprocess(moc_headers : 'qtgv-videooverlay.h')#moc_sources : 'qtgv-videooverlay.cpp')
executable('qtgv-videooverlay', 'qtgv-videooverlay.cpp', moc_files,
cpp_args : gst_plugins_base_args,
include_directories: [configinc, libsinc],
dependencies : [gst_dep, video_dep, libm, x11_dep, qt5widgets_dep],
install: false)
endif
if qt5_have_tools
# FIXME: this doesn't work properly yet, no moc_qtgv-videooverlay.cpp generated
# moc_sources : 'qtgv-videooverlay.cpp'
moc_files = qt5_mod.preprocess(moc_headers: 'qtgv-videooverlay.h', method: qt5_method)
executable('qtgv-videooverlay', 'qtgv-videooverlay.cpp', moc_files,
cpp_args : gst_plugins_base_args,
include_directories: [configinc, libsinc],
dependencies : [gst_dep, video_dep, libm, x11_dep, qt5gui_dep],
install: false)
endif
endif