diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2022-08-30 22:59:17 +0300 |
---|---|---|
committer | Sebastian Dröge <slomo@coaxion.net> | 2022-09-03 01:00:57 +0300 |
commit | 4ac60165a83933452965d3ade3adbb6917d2f553 (patch) | |
tree | 825d4531ee16d402c26aba1988fe82efd18f1504 /meson.build | |
parent | ad48d5e8f2444236305b604d0b39db9e9a8f5d94 (diff) |
meson: Define gst_plugins with list of dependencies
This is needed to link gst-full with Rust plugins. The script requires
either python11 or the tomli module.
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/meson.build b/meson.build index 0bbc8f0f..cf1d7977 100644 --- a/meson.build +++ b/meson.build @@ -5,6 +5,7 @@ project('gst-plugins-rs', meson_version : '>= 0.60') python = import('python').find_installation() +fs = import('fs') if get_option('debug') target = 'debug' @@ -137,12 +138,6 @@ if static_build or get_option('default_library') == 'both' endforeach endif -pc_files = [] -foreach p, lib : plugins - # skip the 'lib' prefix in plugin name - pc_files += [lib.substring(3) + '.pc'] -endforeach - # Need to depends on all gstreamer-rs deps to ensure they are built # before gstreamer-rs when building with gst-build. # Custom targets can't depend on dependency() objects so we have to depend @@ -164,10 +159,14 @@ deps = [ ['gstreamer-webrtc-1.0', 'gst-plugins-bad', 'gstwebrtc_dep', 'gstwebrtc_dep'], ] +# Used to not lookup the same dependency multiple times which clutters logs +deps_cache = {} + foreach d: deps dep = dependency(d[0], version : gst_req, fallback : [d[1], d[2]]) set_variable(d[2], dep) + deps_cache += {d[0]: dep} if dep.type_name() == 'internal' lib = subproject(d[1]).get_variable(d[3]) depends += lib @@ -216,6 +215,38 @@ rs_plugins = custom_target('gst-plugins-rs', plugins = rs_plugins.to_list() +# This is used by GStreamer to static link Rust plugins into gst-full +gst_plugins = [] +pc_files = [] +foreach plugin : plugins + # skip the 'lib' prefix and extension from plugin path + plugin_name = fs.stem(plugin.full_path()).substring(3) + + # Extract plugin dependencies from their Cargo.toml file + plugin_deps = [] + p = run_command('dependencies.py', meson.current_source_dir(), plugin_name, + capture: true, + check: true) + foreach dep_name : p.stdout().strip().split(',') + if deps_cache.has_key(dep_name) + plugin_deps += deps_cache[dep_name] + else + dep = dependency(dep_name, required: false) + plugin_deps += dep + deps_cache += {dep_name: dep} + endif + endforeach + + dep = declare_dependency( + link_with: plugin, + dependencies: plugin_deps, + variables: {'full_path': plugin.full_path()}, + ) + meson.override_dependency(plugin_name, dep) + gst_plugins += dep + pc_files += [plugin_name + '.pc'] +endforeach + subdir('docs') # We don't need to pass a command as we depends on the target above |