qt: Rework how we find the Qt QPA header

Instead of querying the Qt include path from the dependency or from
qmake, rely on the qt5qml_dep to set the include path to QtGui
correctly, and look for the header inside the private includedir.

Then we can use that path to include the header directly.

Reported in https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/780#note_548092

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/640>
This commit is contained in:
Nirbheek Chauhan 2020-06-24 21:58:07 +05:30
parent ed457fe08f
commit 099712338f
2 changed files with 9 additions and 35 deletions

View file

@ -34,7 +34,7 @@
#if GST_GL_HAVE_PLATFORM_EGL && (defined (HAVE_QT_WAYLAND) || defined (HAVE_QT_EGLFS) || defined (HAVE_QT_ANDROID)) #if GST_GL_HAVE_PLATFORM_EGL && (defined (HAVE_QT_WAYLAND) || defined (HAVE_QT_EGLFS) || defined (HAVE_QT_ANDROID))
#include <gst/gl/egl/gstegl.h> #include <gst/gl/egl/gstegl.h>
#ifdef HAVE_QT_QPA_HEADER #ifdef HAVE_QT_QPA_HEADER
#include <qpa/qplatformnativeinterface.h> #include QT_QPA_HEADER
#endif #endif
#include <QtPlatformHeaders/QEGLNativeContext> #include <QtPlatformHeaders/QEGLNativeContext>
#include <gst/gl/egl/gstgldisplay_egl.h> #include <gst/gl/egl/gstgldisplay_egl.h>

View file

@ -63,40 +63,14 @@ qt_defines = []
have_qpa_include = false have_qpa_include = false
have_qt_windowing = false have_qt_windowing = false
# Attempt to find the QPA header either through pkg-config (preferred) or qmake # Look for the QPA platform native interface header
# This semi-matches what meson does internally with the qt5 module qpa_header_path = join_paths(qt5qml_dep.version(), 'QtGui')
# FIXME Add a way to get some of this information out of the qt5 module qpa_header = join_paths(qpa_header_path, 'qpa/qplatformnativeinterface.h')
if not have_qpa_include if cxx.has_header(qpa_header, dependencies : qt5qml_dep)
# FIXME: automagic qt_defines += '-DHAVE_QT_QPA_HEADER'
qt5core_dep = dependency('Qt5Core', required: false) qt_defines += '-DQT_QPA_HEADER=' + '<@0@>'.format(qpa_header)
if qt5core_dep.found() and qt5core_dep.type_name() == 'pkgconfig' have_qpa_include = true
qt_version = qt5core_dep.version() message('Found QtGui QPA header in ' + qpa_header_path)
qt_include_dir = qt5core_dep.get_pkgconfig_variable('includedir')
qpa_include_path = join_paths(qt_include_dir, 'QtGui', qt_version, 'QtGui')
if cxx.has_header('qpa/qplatformnativeinterface.h',
dependencies : qt5core_dep,
args : '-I' + qpa_include_path)
qt_defines += '-DHAVE_QT_QPA_HEADER'
qt_defines += '-I' + qpa_include_path
have_qpa_include = true
message('Found QPA header using pkg-config')
endif
endif
endif
if not have_qpa_include
qmake = find_program('qmake-qt5', 'qmake')
if qmake.found()
qt_version = run_command(qmake, '-query', 'QT_VERSION').stdout().strip()
qt_include_dir = run_command(qmake, '-query', 'QT_INSTALL_HEADERS').stdout().strip()
qpa_include_path = join_paths(qt_include_dir, 'QtGui', qt_version, 'QtGui')
if cxx.has_header('qpa/qplatformnativeinterface.h',
args : '-I' + qpa_include_path)
qt_defines += '-DHAVE_QT_QPA_HEADER'
qt_defines += '-I' + qpa_include_path
have_qpa_include = true
message('Found QPA header using qmake')
endif
endif
endif endif
# Try to come up with all the platform/winsys combinations that will work # Try to come up with all the platform/winsys combinations that will work