summaryrefslogtreecommitdiff
path: root/meson.build
blob: 998427b211d5242d09ea9a10fe3d86eb9e383f6e (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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
project('All GStreamer modules', 'c',
  version : '1.13.0.1',
  meson_version : '>= 0.42.0',
  default_options : ['buildtype=debugoptimized'])

gst_version = '>= @0@'.format(meson.project_version())
gst_branch = 'master'

glib_req = '>= 2.40.0'

subprojects = [
    'gstreamer',
    'gst-plugins-base',
    'gst-plugins-good',
]

cc = meson.get_compiler('c')
if not meson.is_subproject() and cc.get_id() == 'msvc'
  # Make it possible to use msys2 built zlib
  # which fails when not using the mingw toolchain as
  # it uses unistd.h
  add_global_arguments('-DZ_SOLO', language: 'c')
endif

# FIXME Remove that check once we have ffmpeg as a gst-libav subproject
libavfilter_dep = dependency('libavfilter', version: '>= 6.47.100', required: false)
gst_libav = []
if libavfilter_dep.found()
    cc = meson.get_compiler('c')
    check_ffmpeg_src = '''#include <libavcodec/avcodec.h>
    #if LIBAVCODEC_VERSION_MICRO >= 100
    /* FFmpeg uses 100+ as its micro version */
    #else
    #error libav provider should be FFmpeg
    #endif'''
    if cc.compiles(check_ffmpeg_src, dependencies : libavfilter_dep, name : 'whether libav is provided by FFmpeg')
        gst_libav = ['gst-libav']
    endif
endif

if gst_libav.length() == 0
    message('WARNING: gst-libav not built as ffmpeg >= n3.1.2 not found on the system')
endif

if get_option('enable_python')
    subprojects += ['gst-python']
endif

if not get_option('disable_gst_plugins_ugly')
    subprojects += ['gst-plugins-ugly']
endif

if not get_option('disable_gst_plugins_bad')
    subprojects += ['gst-plugins-bad']
endif

if not get_option('disable_gst_libav')
    subprojects += gst_libav
endif

if not get_option('disable_gst_omx')
    subprojects += ['gst-omx']
endif

if not get_option('disable_gstreamer_vaapi')
  if dependency('libva', version: ['>= 0.30.4', '!= 0.99.0'], required : false).found()
    subprojects += ['gstreamer-vaapi']
  else
    message('WARNING: not building gstreamer-vaapi module, missing libva')
  endif
endif

if not get_option('disable_gst_devtools')
  if dependency('json-glib-1.0', required : false).found()
    subprojects += ['gst-devtools']
  else
    message('WARNING: not building gst-devtools module, missing glib-json-1.0')
  endif
endif

if not get_option('disable_gst_editing_services')
  if dependency('libxml-2.0', required : false).found()
    subprojects += ['gst-editing-services']
  else
    message('WARNING: not building gst-editing-services module, missing libxml-2.0')
  endif
endif

if not get_option('disable_rtsp_server')
    subprojects += ['gst-rtsp-server']
endif

if not get_option('disable_gstreamer_sharp')
  if add_languages('cs', required : false)
    if meson.version().version_compare('>=0.43')
      subprojects += ['gstreamer-sharp']
    else
      message('WARNING: Not building gstreamer-sharp as meson >=0.43 not found.')
    endif
  else
    message('WARNING: Not building gstreamer-sharp as no CS compiler found.')
  endif
endif

python3 = import('python3').find_python()
symlink = '''
import os

os.symlink(os.path.join('@1@', 'subprojects', '@0@'),
    os.path.join('@1@', '@0@'))
'''

foreach custom_subproj: get_option('custom_subprojects').split(',')
    if custom_subproj != ''
        message ('Adding custom subproject ' + custom_subproj)
        subprojects += [custom_subproj]
    endif
endforeach

message('Building subprojects: ' + ', '.join(subprojects))
foreach subproj: subprojects
    default_options = []
    if get_option('disable_introspection')
        default_options += ['disable_introspection=true']
    endif
    subproject(subproj, version: gst_version, default_options: default_options)

    cmdres = run_command(python3, '-c', symlink.format(subproj, meson.current_source_dir()))
    if cmdres.returncode() == 0
       message('Created symlink to ' + subproj)
    else
       message('Could not create symlink to @0@'.format(subproj))
    endif
endforeach

setenv = find_program('gst-uninstalled.py')
run_target('uninstalled', command : [setenv, '--builddir=@0@'.format(meson.build_root()),
	   '--srcdir=@0@'.format(meson.source_root()),
           '--gst-version=@0@'.format(gst_branch)])

update = find_program('git-update')
run_target('git-update', command : [update])
run_target('update', command : [update,
    '--builddir=@0@'.format(meson.current_build_dir())])