Welcome to mirror list, hosted at ThFree Co, Russian Federation.

generate-static-test.py « ci - gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 68c5d4cdc5398fb7dc8025cca0f965dd6fd8aad5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python3
# Generate a meson project statically linking on all plugins

import sys
import os

from utils import iterate_plugins

# the csound version used on ci does not ship a .pc file
# threadshare we skip in meson static build as well
IGNORE = ['csound', 'threadshare', 'gtk4']

outdir = sys.argv[1]

plugins = list(filter(lambda p: p not in IGNORE, iterate_plugins()))
deps = list(
    map(lambda p: "    dependency('gst{}', static: true)".format(p), plugins))
deps = ',\n'.join(deps)

meson = """
project('test-gst-plugins-rs-static', 'c')

gst_deps = [
    dependency('gstreamer-1.0'),
%s
]

executable('test-gst-static', ['main.c'],
  dependencies: gst_deps,
)
""" % (deps)

declare = list(
    map(lambda p: "GST_PLUGIN_STATIC_DECLARE({});".format(p), plugins))
declare = '\n'.join(declare)

register = list(
    map(lambda p: "\tGST_PLUGIN_STATIC_REGISTER({});".format(p), plugins))
register = '\n'.join(register)

check = list(
    map(lambda p: "\tg_assert (gst_registry_find_plugin(registry, \"{}\"));".format(p), plugins))
check = '\n'.join(check)

main = """
#include <gst/gst.h>

%s

int main(int argc, char **argv)
{
	g_autoptr(GstRegistry) registry = NULL;

	gst_init(&argc, &argv);

%s

	registry = gst_registry_get();

%s

	return 0;
}
""" % (declare, register, check)

os.makedirs(outdir)

meson_file = open(os.path.join(outdir, 'meson.build'), 'w')
meson_file.write(meson)

main_file = open(os.path.join(outdir, 'main.c'), 'w')
main_file.write(main)