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