c348d3101593b05f17cbf08b98939d7e0803c260
[platform/upstream/gstreamer.git] / meson.build
1 project('All GStreamer modules', 'c',
2   version : '1.14.0',
3   meson_version : '>= 0.42.0',
4   default_options : ['buildtype=debugoptimized'])
5
6 gst_version = '>= @0@'.format(meson.project_version())
7 gst_branch = '1.14.0'
8
9 glib_req = '>= 2.40.0'
10
11 subprojects = [
12     'gstreamer',
13     'gst-plugins-base',
14     'gst-plugins-good',
15 ]
16
17 cc = meson.get_compiler('c')
18 if not meson.is_subproject() and cc.get_id() == 'msvc'
19   # Make it possible to use msys2 built zlib
20   # which fails when not using the mingw toolchain as
21   # it uses unistd.h
22   add_global_arguments('-DZ_SOLO', language: 'c')
23 endif
24
25 # FIXME Remove that check once we have ffmpeg as a gst-libav subproject
26 libavfilter_dep = dependency('libavfilter', version: '>= 6.47.100', required: false)
27 gst_libav = []
28 if libavfilter_dep.found()
29     cc = meson.get_compiler('c')
30     check_ffmpeg_src = '''#include <libavcodec/avcodec.h>
31     #if LIBAVCODEC_VERSION_MICRO >= 100
32     /* FFmpeg uses 100+ as its micro version */
33     #else
34     #error libav provider should be FFmpeg
35     #endif'''
36     if cc.compiles(check_ffmpeg_src, dependencies : libavfilter_dep, name : 'whether libav is provided by FFmpeg')
37         gst_libav = ['gst-libav']
38     endif
39 endif
40
41 if gst_libav.length() == 0
42     message('WARNING: gst-libav not built as ffmpeg >= n3.1.2 not found on the system')
43 endif
44
45 if get_option('enable_python')
46     subprojects += ['gst-python']
47 endif
48
49 if not get_option('disable_gst_plugins_ugly')
50     subprojects += ['gst-plugins-ugly']
51 endif
52
53 if not get_option('disable_gst_plugins_bad')
54     subprojects += ['gst-plugins-bad']
55 endif
56
57 if not get_option('disable_gst_libav')
58     subprojects += gst_libav
59 endif
60
61 if not get_option('disable_gst_omx')
62     subprojects += ['gst-omx']
63 endif
64
65 if not get_option('disable_gstreamer_vaapi')
66   if dependency('libva', version: ['>= 0.30.4', '!= 0.99.0'], required : false).found()
67     subprojects += ['gstreamer-vaapi']
68   else
69     message('WARNING: not building gstreamer-vaapi module, missing libva')
70   endif
71 endif
72
73 if not get_option('disable_gst_devtools')
74   if dependency('json-glib-1.0', required : false).found()
75     subprojects += ['gst-devtools']
76   else
77     message('WARNING: not building gst-devtools module, missing glib-json-1.0')
78   endif
79 endif
80
81 if not get_option('disable_gst_editing_services')
82   if dependency('libxml-2.0', required : false).found()
83     subprojects += ['gst-editing-services']
84   else
85     message('WARNING: not building gst-editing-services module, missing libxml-2.0')
86   endif
87 endif
88
89 if not get_option('disable_rtsp_server')
90     subprojects += ['gst-rtsp-server']
91 endif
92
93 if not get_option('disable_gstreamer_sharp')
94   if add_languages('cs', required : false)
95     if meson.version().version_compare('>=0.43')
96       subprojects += ['gstreamer-sharp']
97     else
98       message('WARNING: Not building gstreamer-sharp as meson >=0.43 not found.')
99     endif
100   else
101     message('WARNING: Not building gstreamer-sharp as no CS compiler found.')
102   endif
103 endif
104
105 python3 = import('python3').find_python()
106 symlink = '''
107 import os
108
109 os.symlink(os.path.join('@1@', 'subprojects', '@0@'),
110     os.path.join('@1@', '@0@'))
111 '''
112
113 foreach custom_subproj: get_option('custom_subprojects').split(',')
114     if custom_subproj != ''
115         message ('Adding custom subproject ' + custom_subproj)
116         subprojects += [custom_subproj]
117     endif
118 endforeach
119
120 message('Building subprojects: ' + ', '.join(subprojects))
121 foreach subproj: subprojects
122     default_options = []
123     if get_option('disable_introspection')
124         default_options += ['disable_introspection=true']
125     endif
126     subproject(subproj, version: gst_version, default_options: default_options)
127
128     cmdres = run_command(python3, '-c', symlink.format(subproj, meson.current_source_dir()))
129     if cmdres.returncode() == 0
130        message('Created symlink to ' + subproj)
131     else
132        message('Could not create symlink to @0@'.format(subproj))
133     endif
134 endforeach
135
136 setenv = find_program('gst-uninstalled.py')
137 run_target('uninstalled', command : [setenv, '--builddir=@0@'.format(meson.build_root()),
138            '--srcdir=@0@'.format(meson.source_root()),
139            '--gst-version=@0@'.format(gst_branch)])
140
141 update = find_program('git-update')
142 run_target('git-update', command : [update])
143 run_target('update', command : [update,
144     '--builddir=@0@'.format(meson.current_build_dir())])