meson: use cargo-c

We now have to run 'cbuild' and 'ctest' on each plugin individually.
Replace plugins_rep key by the source path so we can easily discard the
excluded plugins.
This commit is contained in:
Guillaume Desmottes 2020-11-26 16:12:42 +01:00
parent 8bc2e5ebb8
commit dfdbd370f9
2 changed files with 45 additions and 39 deletions

View file

@ -7,6 +7,8 @@ import shutil
import subprocess
import sys
PLUGIN_DIRS = ['audio', 'generic', 'net', 'text', 'utils', 'video']
command, meson_build_dir, meson_current_source_dir, meson_build_root, target, exclude, extra_env = sys.argv[
1:8]
@ -33,30 +35,34 @@ if command == 'build':
except IndexError:
ext2 = None
cargo_cmd = ['cargo', 'build', '--all-targets',
'--manifest-path', os.path.join(
meson_current_source_dir, 'Cargo.toml'),
'--workspace']
# Build with the 'static' feature enforcing the minimal gst version required for static builds
cargo_cmd = ['cargo', 'cbuild', '--features', 'static']
if target == 'release':
cargo_cmd.append('--release')
elif command == 'test':
# cargo test
cargo_cmd = ['cargo', 'test', '--no-fail-fast', '--color=always', '--manifest-path',
os.path.join(meson_current_source_dir, 'Cargo.toml'),
'--workspace']
cargo_cmd = ['cargo', 'ctest', '--no-fail-fast', '--color=always']
else:
print("Unknown command:", command)
sys.exit(1)
if len(exclude) > 0:
for e in exclude.split(','):
cargo_cmd.append('--exclude')
cargo_cmd.append(e)
try:
subprocess.run(cargo_cmd, env=env, check=True)
except subprocess.SubprocessError:
sys.exit(1)
def run(cargo_cmd, env):
try:
subprocess.run(cargo_cmd, env=env, check=True)
except subprocess.SubprocessError:
sys.exit(1)
for d in PLUGIN_DIRS:
for name in os.listdir(os.path.join(meson_current_source_dir, d)):
if '{}/{}'.format(d, name) in exclude:
continue
cargo_toml = os.path.join(
meson_current_source_dir, d, name, 'Cargo.toml')
cmd = cargo_cmd + ['--manifest-path', cargo_toml]
run(cmd, env)
if command == 'build':
# Copy so files to build dir

View file

@ -26,43 +26,43 @@ else
endif
plugins_rep = {
'gst-plugin-audiofx': 'libgstrsaudiofx',
'gst-plugin-cdg': 'libgstcdg',
'gst-plugin-claxon': 'libgstclaxon',
'gst-plugin-closedcaption': 'libgstrsclosedcaption',
'gst-plugin-fallbackswitch': 'libgstfallbackswitch',
'gst-plugin-file': 'libgstrsfile',
'gst-plugin-flv': 'libgstrsflv',
'gst-plugin-gif': 'libgstgif',
'gst-plugin-lewton': 'libgstlewton',
'gst-plugin-rav1e': 'libgstrav1e',
'gst-plugin-reqwest': 'libgstreqwest',
'gst-plugin-rspng': 'libgstrspng',
'gst-plugin-rusoto': 'libgstrusoto',
'gst-plugin-textwrap': 'libgstrstextwrap',
'gst-plugin-threadshare': 'libgstthreadshare',
'gst-plugin-togglerecord': 'libgsttogglerecord',
'gst-plugin-hsv': 'libgsthsv',
'audio/audiofx': 'libgstrsaudiofx',
'video/cdg': 'libgstcdg',
'audio/claxon': 'libgstclaxon',
'video/closedcaption': 'libgstrsclosedcaption',
'utils/fallbackswitch': 'libgstfallbackswitch',
'generic/file': 'libgstrsfile',
'video/flavors': 'libgstrsflv',
'video/gif': 'libgstgif',
'audio/lewton': 'libgstlewton',
'video/rav1e': 'libgstrav1e',
'net/reqwest': 'libgstreqwest',
'video/rspng': 'libgstrspng',
'net/rusoto': 'libgstrusoto',
'text/wrap': 'libgstrstextwrap',
'generic/threadshare': 'libgstthreadshare',
'utils/togglerecord': 'libgsttogglerecord',
'video/hsv': 'libgsthsv',
}
exclude = []
extra_env = {}
if dependency('dav1d', required : get_option('dav1d')).found()
plugins_rep += {'gst-plugin-dav1d' : 'libgstrsdav1d'}
plugins_rep += {'video/dav1d' : 'libgstrsdav1d'}
else
exclude += ['gst-plugin-dav1d']
exclude += ['video/dav1d']
endif
sodium = get_option ('sodium')
if sodium == 'system'
dependency('libsodium')
plugins_rep += {'gst-plugin-sodium': 'libgstsodium'}
plugins_rep += {'generic/sodium': 'libgstsodium'}
extra_env += {'SODIUM_USE_PKG_CONFIG': '1'}
elif sodium == 'built-in'
plugins_rep += {'gst-plugin-sodium': 'libgstsodium'}
plugins_rep += {'generic/sodium': 'libgstsodium'}
else
exclude += ['gst-plugin-sodium']
exclude += ['generic/sodium']
endif
cc = meson.get_compiler('c')
@ -82,9 +82,9 @@ if not csound_option.disabled()
endif
if csound_dep.found()
plugins_rep += {'gst-plugin-csound' : 'libgstcsound'}
plugins_rep += {'audio/csound' : 'libgstcsound'}
else
exclude += ['gst-plugin-csound']
exclude += ['audio/csound']
endif
output = []