meson: Handle features needed only by examples separately

Currently we incorrectly require gtk4 to build the fallbackswitch, livesync,
togglerecord plugins when the examples option is allowed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1604>
This commit is contained in:
Nirbheek Chauhan 2024-06-06 16:40:32 +05:30 committed by GStreamer Marge Bot
parent 4c9ed330c8
commit 6538803cf6

View file

@ -312,18 +312,21 @@ if examples_opt.allowed() and 'gtk4' in plugins
plugins += { plugins += {
'fallbackswitch': { 'fallbackswitch': {
'library': 'libgstfallbackswitch', 'library': 'libgstfallbackswitch',
'examples': ['gtk-fallbackswitch'], 'examples_features': {
'features': ['gtk', 'gio', 'gst-plugin-gtk4'], 'gtk-fallbackswitch': ['gtk', 'gio', 'gst-plugin-gtk4'],
},
}, },
'livesync': { 'livesync': {
'library': 'libgstlivesync', 'library': 'libgstlivesync',
'examples': ['gtk-livesync'], 'examples_features': {
'features': ['gtk', 'gio', 'gst-plugin-gtk4'], 'gtk-livesync': ['gtk', 'gio', 'gst-plugin-gtk4'],
}
}, },
'togglerecord': { 'togglerecord': {
'library': 'libgsttogglerecord', 'library': 'libgsttogglerecord',
'examples': ['gtk-recording'], 'examples_features': {
'features': ['gtk', 'gio', 'gst-plugin-gtk4'], 'gtk-recording': ['gtk', 'gio', 'gst-plugin-gtk4'],
}
}, },
} }
else else
@ -454,6 +457,26 @@ foreach plugin_name, details: plugins
examples += example examples += example
endforeach endforeach
plugin_examples_features = details.get('examples_features', {})
foreach example, examples_features: plugin_examples_features
example_deps_found = true
foreach feature: examples_features
if feature.startswith('gst-plugin') and not packages.contains(feature)
msg = f'@plugin_name@ example @example@ required feature @feature@ not found'
if plugin_opt.enabled() and examples_opt.enabled()
error(msg)
endif
message(msg + ', skipping')
example_deps_found = false
break
endif
endforeach
features += examples_features
if example_deps_found
examples += example
endif
endforeach
packages += f'gst-plugin-@plugin_name@' packages += f'gst-plugin-@plugin_name@'
features += plugin_features features += plugin_features
extra_features = run_command('dependencies.py', meson.current_source_dir(), plugin_name, extra_features = run_command('dependencies.py', meson.current_source_dir(), plugin_name,