From 223a0e3b2722c075011b9b2efe4be4a2ed6d7370 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 4 Aug 2023 15:11:05 +0530 Subject: [PATCH] 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: --- .../gst-plugins-good/ext/qt/meson.build | 25 +++++++------------ .../gst-plugins-good/ext/qt6/meson.build | 4 +-- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/subprojects/gst-plugins-good/ext/qt/meson.build b/subprojects/gst-plugins-good/ext/qt/meson.build index 1e92ebf1df..53de7d7656 100644 --- a/subprojects/gst-plugins-good/ext/qt/meson.build +++ b/subprojects/gst-plugins-good/ext/qt/meson.build @@ -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, diff --git a/subprojects/gst-plugins-good/ext/qt6/meson.build b/subprojects/gst-plugins-good/ext/qt6/meson.build index d622e8385e..fc5f4909b0 100644 --- a/subprojects/gst-plugins-good/ext/qt6/meson.build +++ b/subprojects/gst-plugins-good/ext/qt6/meson.build @@ -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,