1 project('All GStreamer modules', 'c',
3 meson_version : '>= 0.48.0',
4 default_options : ['buildtype=debugoptimized'])
6 gst_version = '>= @0@'.format(meson.project_version())
9 build_system = build_machine.system()
10 cc = meson.get_compiler('c')
12 python3 = import('python').find_installation()
13 # Ensure that we're not being run from inside the gst-uninstalled env
14 # because that will confuse meson, and it might find the already-built
15 # gstreamer. It's fine if people run `ninja` as long as it doesn't run
16 # reconfigure because ninja doesn't care about the env.
17 ensure_not_uninstalled = '''
19 assert('GST_ENV' not in os.environ)
21 cmdres = run_command(python3, '-c', ensure_not_uninstalled)
22 if cmdres.returncode() != 0
23 error('Do not run `ninja` or `meson` for gst-build inside the uninstalled environment, you will run into problems')
26 documented_projects = ''
27 # Make it possible to use msys2 built zlib which fails
28 # when not using the mingw toolchain as it uses unistd.h
29 if not meson.is_subproject() and cc.get_id() == 'msvc'
30 uname = find_program('uname', required: false)
32 ret = run_command(uname, '-o')
33 if ret.returncode() == 0 and ret.stdout().to_lower() == 'msys'
34 ret = run_command(uname, '-r')
35 # The kernel version returned by uname is actually the msys version
36 if ret.returncode() == 0 and ret.stdout().startswith('2')
37 # If a system zlib is found, disable UNIX features in zlib.h and zconf.h
38 if cc.find_library('z').found()
39 add_global_arguments('-DZ_SOLO', language: 'c')
45 # Change some warning which belong to level 3 (production quality) or
46 # 4 (informational) to level 1 (severe)
47 add_global_arguments (
48 '/w14062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
49 '/w14101', # 'identifier' : unreferenced local variable
50 '/w14189', # 'identifier' : local variable is initialized but not referenced
51 cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8
52 language: ['c', 'cpp'])
55 # Ordered list of subprojects (dict has no ordering guarantees)
57 ['gstreamer', {'build-hotdoc': true, 'has-plugins': true}],
58 ['gst-plugins-base', {'build-hotdoc': true, 'has-plugins': true}],
59 ['gst-plugins-good', {'build-hotdoc': true, 'has-plugins': true}],
60 ['libnice', { 'option': get_option('libnice'), 'match_gst_version': false}],
61 ['gst-plugins-bad', { 'option': get_option('bad'), 'build-hotdoc': true, 'has-plugins': true}],
62 ['gst-plugins-ugly', { 'option': get_option('ugly'), 'build-hotdoc': true, 'has-plugins': true}],
63 ['gst-libav', { 'option': get_option('libav'), 'build-hotdoc': true, 'has-plugins': true}],
64 ['gst-rtsp-server', { 'option': get_option('rtsp_server'), 'build-hotdoc': true }],
65 ['gst-devtools', { 'option': get_option('devtools'), 'build-hotdoc': true }],
66 ['gst-integration-testsuites', { 'option': get_option('devtools') }],
67 ['gst-editing-services', { 'option': get_option('ges'), 'build-hotdoc': true, 'has-plugins': true}],
68 ['gstreamer-vaapi', { 'option': get_option('vaapi'), 'build-hotdoc': true, 'has-plugins': true}],
69 ['gst-omx', { 'option': get_option('omx'), 'build-hotdoc': true, 'has-plugins': true}],
70 ['gstreamer-sharp', { 'option': get_option('sharp') }],
71 ['pygobject', { 'option': get_option('python'), 'match_gst_version': false }],
72 ['gst-python', { 'option': get_option('python'), 'has-plugins': true}],
73 ['gst-examples', { 'option': get_option('gst-examples'), 'match_gst_versions': false}],
74 ['gst-plugins-rs', { 'option': get_option('rs'), 'has-plugins': true, 'match_gst_version': false}],
80 os.symlink(os.path.join('@1@', 'subprojects', '@0@'),
81 os.path.join('@1@', '@0@'))
84 if build_system == 'windows'
85 subproject('win-flex-bison-binaries')
86 subproject('win-nasm')
89 subproject('orc', required: get_option('orc'))
91 subprojects_names = []
92 plugins_doc_caches = []
94 foreach sp : subprojects
97 is_required = build_infos.get('option', true)
98 match_gst_version = build_infos.get('match_gst_version', true)
101 subproj = subproject(project_name, version: gst_version, required: is_required)
103 subproj = subproject(project_name, required: is_required)
107 # Replace by using subproject.get_variable('plugins', [])
108 # when https://github.com/mesonbuild/meson/pull/5426/files
109 # is merged and released
110 if build_infos.has_key('has-plugins', default: false)
111 plugins = subproj.get_variable('plugins')
115 all_plugins += plugins
117 subprojects_names += [project_name]
118 cmdres = run_command(python3, '-c', symlink.format(project_name, meson.current_source_dir()))
119 if cmdres.returncode() == 0
120 message('Created symlink to ' + project_name)
123 if not meson.is_cross_build() and build_infos.has_key('build-hotdoc', default: false)
124 if plugins.length() > 0
125 plugins_doc_caches += [subproj.get_variable('plugins_doc_dep')]
127 if documented_projects != ''
128 documented_projects += ','
130 documented_projects += project_name
135 plugins_doc_dep = custom_target('plugins-doc-cache',
136 command: [python3, '-c', 'print("Built all doc caches")'],
137 input: plugins_doc_caches,
138 output: 'plugins_doc_caches',
142 foreach custom_subproj: get_option('custom_subprojects').split(',')
143 if custom_subproj != ''
144 message ('Adding custom subproject ' + custom_subproj)
145 subproject(custom_subproj)
146 subprojects_names += [custom_subproj]
150 if meson.is_cross_build() or build_machine.system() == 'windows'
151 if get_option('doc').enabled()
152 error('Documentation enabled but building the doc while cross building or building on windows is not supported yet.')
155 message('Documentation not built as building the documentation while cross building or building on windows is not supported yet.')
157 hotdoc_p = find_program('hotdoc', required : get_option('doc'))
159 if documented_projects != ''
160 subproject('gst-docs', default_options: 'built_subprojects=' + documented_projects)
161 message('Gst docs subprojects: ' + documented_projects)
164 message('Not building documentation as hotdoc was not found')
168 all_plugins_paths = []
169 foreach plugin: all_plugins
170 all_plugins_paths += plugin.full_path()
173 generate_plugins_paths = find_program('scripts/generate_plugins_path.py')
175 output : 'GstPluginsPath.json',
176 command : [generate_plugins_paths,
181 message('Building subprojects: ' + ', '.join(subprojects_names))
182 setenv = find_program('gst-env.py')
184 devenv_cmd = [setenv, '--builddir=@0@'.format(meson.build_root()),
185 '--srcdir=@0@'.format(meson.source_root())]
187 if meson.has_exe_wrapper() and build_machine.system() == 'linux' and host_machine.system() == 'windows'
188 # FIXME: Ideally we could get the wrapper directly from meson
189 devenv_cmd += ['--wine', host_machine.cpu_family() == 'x86_64' ? 'wine64' : 'wine32']
190 sysroot = meson.get_cross_property('sys_root')
193 devenv_cmd += ['--winepath', 'Z:' + join_paths(sysroot, 'bin')]
197 run_target('uninstalled', command : devenv_cmd)
198 run_target('devenv', command : devenv_cmd)
200 update = find_program('git-update')
201 run_target('git-update', command : [update])
202 run_target('update', command : [update,
203 '--builddir=@0@'.format(meson.current_build_dir())])