mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
meson: Revamp qt5qml plugin and example build code
Stricter and simpler. For example, now we properly error out when gstreamer-gl-1.0 was not found when the qt5 plugin is enabled or when a C++ compiler is not enabled. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/587>
This commit is contained in:
parent
d8f0deadc3
commit
2ecba800bf
6 changed files with 204 additions and 204 deletions
|
@ -17,34 +17,59 @@ moc_headers = [
|
|||
'qtglrenderer.h',
|
||||
]
|
||||
|
||||
# FIXME: -Dqt5=enabled is silently ignored if a c++ compiler is not found
|
||||
if have_cxx and build_gstgl
|
||||
qt5_mod = import('qt5')
|
||||
qt5qml_dep = dependency('qt5', modules : ['Core', 'Gui', 'Qml', 'Quick'],
|
||||
required: get_option('qt5'), static: host_machine.system() == 'ios')
|
||||
# Define a not-found dependency so this variable is always defined when we're
|
||||
# deciding whether to build the qt5 examples
|
||||
qt5qml_dep = dependency('', required: false)
|
||||
qt5_option = get_option('qt5')
|
||||
|
||||
# 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'
|
||||
moc = find_program('moc-qt5', 'moc', required : get_option('qt5'))
|
||||
else
|
||||
if qt5_option.disabled()
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
if not build_gstgl
|
||||
if qt5_option.enabled()
|
||||
error('qt5 qmlglsink plugin is enabled, but gstreamer-gl-1.0 was not found')
|
||||
endif
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
if not have_cxx
|
||||
if qt5_option.enabled()
|
||||
error('qt5 qmlglsink plugin is enabled, but no C++ compiler is available')
|
||||
endif
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
qt5_mod = import('qt5')
|
||||
qt5qml_dep = dependency('qt5', modules : ['Core', 'Gui', 'Qml', 'Quick'],
|
||||
required: qt5_option, static: host_machine.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'
|
||||
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()
|
||||
endif
|
||||
if qt5qml_dep.found() and moc.found()
|
||||
optional_deps = []
|
||||
qt_defines = []
|
||||
have_qpa_include = false
|
||||
have_qt_windowing = false
|
||||
endif
|
||||
|
||||
# Attempt to find the QPA header either through pkg-config (preferred) or qmake
|
||||
# This semi-matches what meson does internally with the qt5 module
|
||||
# FIXME Add a way to get some of this information out of the qt5 module
|
||||
if not have_qpa_include
|
||||
if not qt5qml_dep.found() or not moc.found()
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
optional_deps = []
|
||||
qt_defines = []
|
||||
have_qpa_include = false
|
||||
have_qt_windowing = false
|
||||
|
||||
# Attempt to find the QPA header either through pkg-config (preferred) or qmake
|
||||
# This semi-matches what meson does internally with the qt5 module
|
||||
# FIXME Add a way to get some of this information out of the qt5 module
|
||||
if not have_qpa_include
|
||||
# FIXME: automagic
|
||||
qt5core_dep = dependency('Qt5Core', required: false)
|
||||
if qt5core_dep.found() and qt5core_dep.type_name() == 'pkgconfig'
|
||||
|
@ -60,8 +85,8 @@ if have_cxx and build_gstgl
|
|||
message('Found QPA header using pkg-config')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
if not have_qpa_include
|
||||
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()
|
||||
|
@ -75,11 +100,11 @@ if have_cxx and build_gstgl
|
|||
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
|
||||
|
||||
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
|
||||
qt5x11extras = dependency('qt5', modules : ['X11Extras'], required : false)
|
||||
if qt5x11extras.found()
|
||||
|
@ -87,9 +112,9 @@ if have_cxx and build_gstgl
|
|||
qt_defines += ['-DHAVE_QT_X11']
|
||||
have_qt_windowing = true
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if gst_gl_have_platform_egl
|
||||
if gst_gl_have_platform_egl
|
||||
# Embedded linux (e.g. i.MX6) with or without windowing support
|
||||
qt_defines += ['-DHAVE_QT_EGLFS']
|
||||
egl_dep = dependency('egl', required : false)
|
||||
|
@ -123,9 +148,9 @@ if have_cxx and build_gstgl
|
|||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if gst_gl_have_platform_wgl and gst_gl_have_window_win32
|
||||
if gst_gl_have_platform_wgl and gst_gl_have_window_win32
|
||||
# for wglMakeCurrent()
|
||||
# FIXME: automagic
|
||||
opengl32_dep = cc.find_library('opengl32', required : false)
|
||||
|
@ -134,9 +159,9 @@ if have_cxx and build_gstgl
|
|||
optional_deps += opengl32_dep
|
||||
have_qt_windowing = true
|
||||
endif
|
||||
endif
|
||||
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
|
||||
qt5macextras = dependency('qt5', modules : ['MacExtras'], required : false)
|
||||
if qt5macextras.found()
|
||||
|
@ -144,16 +169,16 @@ if have_cxx and build_gstgl
|
|||
optional_deps += qt5macextras
|
||||
have_qt_windowing = true
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if gst_gl_have_window_eagl and gst_gl_have_platform_eagl
|
||||
if gst_gl_have_window_eagl and gst_gl_have_platform_eagl
|
||||
if host_machine.system() == 'ios'
|
||||
qt_defines += ['-DHAVE_QT_IOS']
|
||||
have_qt_windowing = true
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if have_qt_windowing
|
||||
if have_qt_windowing
|
||||
# Build it!
|
||||
moc_files = qt5_mod.preprocess(moc_headers : moc_headers)
|
||||
gstqmlgl = library('gstqmlgl', sources, moc_files,
|
||||
|
@ -166,6 +191,4 @@ if have_cxx and build_gstgl
|
|||
install_dir : plugins_install_dir)
|
||||
pkgconfig.generate(gstqmlgl, install_dir : plugins_pkgconfig_install_dir)
|
||||
plugins += [gstqmlgl]
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
if qt5_option.disabled()
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
# We already did all the checks when building the qt plugin
|
||||
if not qt5qml_dep.found()
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
qt5qml_example_deps = dependency('qt5', modules : ['Core', 'Gui', 'Widgets', 'Qml', 'Quick'],
|
||||
required: get_option('examples'))
|
||||
|
||||
if not qt5qml_example_deps.found()
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
subdir('qmloverlay')
|
||||
subdir('qmlsink')
|
||||
subdir('qmlsink-dynamically-added')
|
||||
|
|
|
@ -2,19 +2,9 @@ sources = [
|
|||
'main.cpp',
|
||||
]
|
||||
|
||||
if have_cxx and build_gstgl and gstgl_dep.found()
|
||||
qt5_mod = import('qt5')
|
||||
qt5qml_deps = dependency('qt5', modules : ['Core', 'Gui', 'Widgets', 'Qml', 'Quick'],
|
||||
required: get_option('examples'))
|
||||
|
||||
# FIXME Add a way to get that information out of the qt5 module
|
||||
moc = find_program('moc-qt5', 'moc', required : get_option('examples'))
|
||||
if qt5qml_deps.found() and moc.found()
|
||||
qt_preprocessed = qt5_mod.preprocess(qresources : 'qmloverlay.qrc')
|
||||
executable('qmlgloverlay', sources, qt_preprocessed,
|
||||
dependencies : [gst_dep, qt5qml_deps],
|
||||
qt_preprocessed = qt5_mod.preprocess(qresources : 'qmloverlay.qrc')
|
||||
executable('qmlgloverlay', sources, qt_preprocessed,
|
||||
dependencies : [gst_dep, qt5qml_example_deps],
|
||||
c_args : gst_plugins_good_args,
|
||||
include_directories : [configinc],
|
||||
install: false)
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -2,19 +2,9 @@ sources = [
|
|||
'main.cpp',
|
||||
]
|
||||
|
||||
if have_cxx and build_gstgl and gstgl_dep.found()
|
||||
qt5_mod = import('qt5')
|
||||
qt5qml_deps = dependency('qt5', modules : ['Core', 'Gui', 'Widgets', 'Qml', 'Quick'],
|
||||
required: get_option('examples'))
|
||||
|
||||
# FIXME Add a way to get that information out of the qt5 module
|
||||
moc = find_program('moc-qt5', 'moc', required : get_option('examples'))
|
||||
if qt5qml_deps.found() and moc.found()
|
||||
qt_preprocessed = qt5_mod.preprocess(qresources : 'qmlsink.qrc')
|
||||
executable('qmlsink-dynamically-added', sources, qt_preprocessed,
|
||||
dependencies : [gst_dep, gstgl_dep, qt5qml_deps],
|
||||
qt_preprocessed = qt5_mod.preprocess(qresources : 'qmlsink.qrc')
|
||||
executable('qmlsink-dynamically-added', sources, qt_preprocessed,
|
||||
dependencies : [gst_dep, gstgl_dep, qt5qml_example_deps],
|
||||
c_args : gst_plugins_good_args,
|
||||
include_directories : [configinc],
|
||||
install: false)
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -2,19 +2,9 @@ sources = [
|
|||
'main.cpp',
|
||||
]
|
||||
|
||||
if have_cxx and build_gstgl and gstgl_dep.found()
|
||||
qt5_mod = import('qt5')
|
||||
qt5qml_deps = dependency('qt5', modules : ['Core', 'Gui', 'Widgets', 'Qml', 'Quick'],
|
||||
required: get_option('examples'))
|
||||
|
||||
# FIXME Add a way to get that information out of the qt5 module
|
||||
moc = find_program('moc-qt5', 'moc', required : get_option('examples'))
|
||||
if qt5qml_deps.found() and moc.found()
|
||||
qt_preprocessed = qt5_mod.preprocess(qresources : 'qmlsink.qrc')
|
||||
executable('qmlsink', sources, qt_preprocessed,
|
||||
dependencies : [gst_dep, qt5qml_deps],
|
||||
qt_preprocessed = qt5_mod.preprocess(qresources : 'qmlsink.qrc')
|
||||
executable('qmlsink', sources, qt_preprocessed,
|
||||
dependencies : [gst_dep, qt5qml_example_deps],
|
||||
c_args : gst_plugins_good_args,
|
||||
include_directories : [configinc],
|
||||
install: false)
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -2,18 +2,9 @@ sources = [
|
|||
'main.cpp',
|
||||
]
|
||||
|
||||
if have_cxx and build_gstgl and gstgl_dep.found()
|
||||
qt5_mod = import('qt5')
|
||||
qt5qml_deps = dependency('qt5', modules : ['Core', 'Gui', 'Widgets', 'Qml', 'Quick'],
|
||||
required: get_option('examples'))
|
||||
# FIXME Add a way to get that information out of the qt5 module
|
||||
moc = find_program('moc-qt5', 'moc', required : get_option('examples'))
|
||||
if qt5qml_deps.found() and moc.found()
|
||||
qt_preprocessed = qt5_mod.preprocess(qresources : 'qmlsrc.qrc')
|
||||
executable('qmlsrc', sources, qt_preprocessed,
|
||||
dependencies : [gst_dep, qt5qml_deps],
|
||||
qt_preprocessed = qt5_mod.preprocess(qresources : 'qmlsrc.qrc')
|
||||
executable('qmlsrc', sources, qt_preprocessed,
|
||||
dependencies : [gst_dep, qt5qml_example_deps],
|
||||
c_args : gst_plugins_good_args,
|
||||
include_directories : [configinc],
|
||||
install: false)
|
||||
endif
|
||||
endif
|
||||
|
|
Loading…
Reference in a new issue