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