File: meson.build

package info (click to toggle)
gst-python1.0 1.26.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,012 kB
  • sloc: python: 8,030; ansic: 1,869; makefile: 33
file content (104 lines) | stat: -rw-r--r-- 4,245 bytes parent folder | download | duplicates (3)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
runtests = files('runtests.py')

tests = [
    ['Test gst', 'test_gst.py'],
    ['Test fundamentals', 'test_types.py'],
    ['Test plugins', 'test_plugin.py'],
    ['Test analytics', 'test_analytics.py', ['gst-plugins-bad/gst-libs/gst/analytics', 'gst-plugins-base/gst-libs/gst/video']],
    ['Test appsink', 'test_appsink.py', ['gst-plugins-base/gst-libs/gst/app']],
]

runcmd = run_command(python, '-c', '''with open("@0@/mesonconfig.py", "w") as f:
    f.write("path='@1@'")'''.format(
  join_paths(meson.current_build_dir()), join_paths(meson.current_build_dir(), '..')),
  check: true)

pluginsdirs = []
if gst_dep.type_name() == 'pkgconfig'
  pbase = dependency('gstreamer-plugins-base-' + api_version, required : false)
  pluginsdirs = [gst_dep.get_variable('pluginsdir'),
                 pbase.get_variable('pluginsdir')]
endif

pypluginsdir = [join_paths (meson.project_build_root(), 'plugin'), meson.current_source_dir()]

# FIXME : We shouldn't require these dependencies to be present, and instead
# check if they are present and, if needed, only enable the tests that depend on
# them
gst_deps_defs = [
  ['gstreamer', ['gstreamer', 'gst_dep'], 'libgst'],
  ['gstreamer-app', ['gst-plugins-base', 'app_dep'], 'gstapp'],
  ['gstreamer-audio', ['gst-plugins-base', 'audio_dep'], 'gstaudio'],
  ['gstreamer-base', ['gstreamer', 'gst_base_dep'], 'gst_base'],
  ['gstreamer-controller', ['gstreamer', 'gst_controller_dep'], 'gst_controller'],
  ['gstreamer-fft', ['gst-plugins-base', 'fft_dep'], 'gstfft'],
  ['gstreamer-net', ['gstreamer', 'gst_net_dep'], 'gst_net'],
  ['gstreamer-pbutils', ['gst-plugins-base', 'pbutils_dep'], 'pbutils'],
  ['gstreamer-riff', ['gst-plugins-base', 'riff_dep'], 'gstriff'],
  ['gstreamer-rtp', ['gst-plugins-base', 'rtp_dep'], 'gst_rtp'],
  ['gstreamer-rtsp', ['gst-plugins-base', 'rtsp_dep'], 'gst_rtsp'],
  ['gstreamer-sdp', ['gst-plugins-base', 'sdp_dep'], 'gstsdp'],
  ['gstreamer-tag', ['gst-plugins-base', 'tag_dep'], 'gsttag'],
  ['gstreamer-video', ['gst-plugins-base', 'video_dep'], 'gstvideo'],
]

api_version = '1.0'
gst_required_version = '>=@0@'.format(meson.project_version())
gst_deps = []

foreach dep: gst_deps_defs
  gst_deps += [dependency(dep.get(0) + '-' + api_version, version: gst_required_version,
    fallback: dep.get(1))]
endforeach

foreach i: tests
    test_name = i.get(0)
    env = environment()
    env.set('GST_OVERRIDE_SRC_PATH', join_paths (meson.current_source_dir(), '..', 'gi', 'overrides'))
    env.set('GST_OVERRIDE_BUILD_PATH', join_paths (meson.current_build_dir(), '..', 'gi', 'overrides'))
    env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer', 'gst-plugins-base',
        'gst-python@' + meson.project_build_root())
    env.set('GST_PLUGIN_PATH_1_0', meson.global_build_root(), pluginsdirs + pypluginsdir)
    env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name)))

    l = 0
    testsenv_ld_library_path = []
    foreach dep: gst_deps
        if dep.type_name() == 'pkgconfig'
            testsenv_ld_library_path += [dep.get_variable('libdir')]
        else
            depdef = gst_deps_defs[l][1]
            libname = gst_deps_defs[l].get(2, '')
            if libname != ''
                proj = subproject(depdef[0])
                libpath = proj.get_variable(libname).full_path().split('/')
                dirname = ''
                j = 1
                foreach comp: libpath
                    if j < libpath.length()
                        dirname += '/' + comp
                    endif
                    j += 1
                endforeach
                testsenv_ld_library_path += [dirname]
            endif
        endif
        l += 1
    endforeach

    foreach j: i.get(2, [])
      path = meson.project_build_root() / '..' / j
      env.append('GI_TYPELIB_PATH', path)
      testsenv_ld_library_path += path
    endforeach

    if build_machine.system() == 'windows'
      env.append('PATH', testsenv_ld_library_path)
    elif build_machine.system() == 'linux'
      env.append('LD_LIBRARY_PATH', testsenv_ld_library_path)
   else
      env.append('DYLD_LIBRARY_PATH', testsenv_ld_library_path)
    endif

    test(test_name, python, args: [runtests, i.get(1)], env: env)
endforeach