meson: Fix searching of qt5/qt6 tools with qmake

If the pkg-config files are broken, we want to ensure that qmake is
used. This can easily happen on macOS with the official Qt binaries.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5147>
This commit is contained in:
Nirbheek Chauhan 2023-08-04 15:11:05 +05:30 committed by GStreamer Marge Bot
parent fd95f5682e
commit 223a0e3b27
2 changed files with 11 additions and 18 deletions

View file

@ -42,23 +42,16 @@ if not add_languages('cpp', native: false, required: qt5_option)
endif
qt5_mod = import('qt5')
qt5qml_dep = dependency('qt5', modules : ['Core', 'Gui', 'Qml', 'Quick'],
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
# that it's installed.
# We don't do this check on other OSes because they need to be able to simply
# point the `QMAKE` env var to `qmake` to build against a particular Qt5.
if host_system == 'linux' and not meson.is_cross_build()
moc = find_program('moc-qt5', 'moc', required : qt5_option)
else
# We only check if `moc` was found, and then discard it, so we can fake it.
# This is also a good unit test of the fact that we *don't* use it.
moc = declare_dependency()
if not qt5_mod.has_tools(method: qt5_method)
if qt5_option.enabled()
error('qt5 qmlglsink plugin is enabled, but qt specific tools were not found')
endif
subdir_done()
endif
if not qt5qml_dep.found() or not moc.found()
qt5qml_dep = dependency('qt5', modules : ['Core', 'Gui', 'Qml', 'Quick'],
method: qt5_method, required: qt5_option, static: host_system == 'ios')
if not qt5qml_dep.found()
subdir_done()
endif
@ -202,7 +195,7 @@ if qt5_option.require(have_qt_windowing).allowed()
endif
# Build it!
moc_files = qt5_mod.preprocess(moc_headers : moc_headers)
moc_files = qt5_mod.preprocess(moc_headers : moc_headers, method: qt5_method)
gstqmlgl = library('gstqmlgl', sources, moc_files,
cpp_args : gst_plugins_good_args + qt_defines,
link_args : noseh_link_args,

View file

@ -42,7 +42,7 @@ if not add_languages('cpp', native: false, required: qt6_option)
endif
qt6_mod = import('qt6')
if not qt6_mod.has_tools()
if not qt6_mod.has_tools(method: qt6_method)
if qt6_option.enabled()
error('qt6 qmlglsink plugin is enabled, but qt specific tools were not found')
endif
@ -152,7 +152,7 @@ endif
if qt6_option.require(have_qt_windowing).allowed()
# Build it!
moc_files = qt6_mod.preprocess(moc_headers : moc_headers)
moc_files = qt6_mod.preprocess(moc_headers : moc_headers, method: qt6_method)
gstqml6gl = library('gstqml6', sources, moc_files,
cpp_args : gst_plugins_good_args + qt_defines,
link_args : noseh_link_args,