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())
11 build_system = build_machine.system()
12 cc = meson.get_compiler('c')
14 python3 = import('python').find_installation()
15 # Ensure that we're not being run from inside the gst-uninstalled env
16 # because that will confuse meson, and it might find the already-built
17 # gstreamer. It's fine if people run `ninja` as long as it doesn't run
18 # reconfigure because ninja doesn't care about the env.
19 ensure_not_uninstalled = '''
21 assert('GST_ENV' not in os.environ)
23 cmdres = run_command(python3, '-c', ensure_not_uninstalled)
24 if cmdres.returncode() != 0
25 error('Do not run `ninja` or `meson` for gst-build inside the uninstalled environment, you will run into problems')
28 documented_projects = ''
29 # Make it possible to use msys2 built zlib which fails
30 # when not using the mingw toolchain as it uses unistd.h
31 if not meson.is_subproject() and cc.get_id() == 'msvc'
32 uname = find_program('uname', required: false)
34 ret = run_command(uname, '-o')
35 if ret.returncode() == 0 and ret.stdout().to_lower() == 'msys'
36 ret = run_command(uname, '-r')
37 # The kernel version returned by uname is actually the msys version
38 if ret.returncode() == 0 and ret.stdout().startswith('2')
39 # If a system zlib is found, disable UNIX features in zlib.h and zconf.h
40 if cc.find_library('z').found()
41 add_global_arguments('-DZ_SOLO', language: 'c')
47 # Change some warning which belong to level 3 (production quality) or
48 # 4 (informational) to level 1 (severe)
49 add_global_arguments (
50 '/w14062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
51 '/w14101', # 'identifier' : unreferenced local variable
52 '/w14189', # 'identifier' : local variable is initialized but not referenced
53 cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8
57 # Ordered list of subprojects (dict has no ordering guarantees)
59 ['gstreamer', {'build-hotdoc': true, 'has-plugins': true}],
60 ['gst-plugins-base', {'build-hotdoc': true, 'has-plugins': true}],
61 ['gst-plugins-good', {'build-hotdoc': true, 'has-plugins': true}],
62 ['libnice', { 'option': get_option('libnice'), 'match_gst_version': false}],
63 ['gst-plugins-bad', { 'option': get_option('bad'), 'build-hotdoc': true, 'has-plugins': true}],
64 ['gst-plugins-ugly', { 'option': get_option('ugly'), 'build-hotdoc': true, 'has-plugins': true}],
65 ['gst-libav', { 'option': get_option('libav'), 'build-hotdoc': true, 'has-plugins': true}],
66 ['gst-rtsp-server', { 'option': get_option('rtsp_server'), 'build-hotdoc': true }],
67 ['gst-devtools', { 'option': get_option('devtools'), 'build-hotdoc': true }],
68 ['gst-integration-testsuites', { 'option': get_option('devtools') }],
69 ['gst-editing-services', { 'option': get_option('ges'), 'build-hotdoc': true, 'has-plugins': true}],
70 ['gstreamer-vaapi', { 'option': get_option('vaapi'), 'build-hotdoc': true, 'has-plugins': true}],
71 ['gst-omx', { 'option': get_option('omx'), 'build-hotdoc': true, 'has-plugins': true}],
72 ['gstreamer-sharp', { 'option': get_option('sharp') }],
73 ['pygobject', { 'option': get_option('python'), 'match_gst_version': false }],
74 ['gst-python', { 'option': get_option('python'), 'has-plugins': true}],
75 ['gst-examples', { 'option': get_option('gst-examples'), 'match_gst_versions': false}],
81 os.symlink(os.path.join('@1@', 'subprojects', '@0@'),
82 os.path.join('@1@', '@0@'))
85 if build_system == 'windows'
86 subproject('win-flex-bison-binaries')
87 subproject('win-nasm')
90 pathsep = host_machine.system() == 'windows' ? ';' : ':'
92 subproject('orc', required: get_option('orc'))
94 subprojects_names = []
95 plugins_doc_caches = []
97 foreach sp : subprojects
100 is_required = build_infos.get('option', true)
101 match_gst_version = build_infos.get('match_gst_version', true)
104 subproj = subproject(project_name, version: gst_version, required: is_required)
106 subproj = subproject(project_name, required: is_required)
110 # Replace by using subproject.get_variable('plugins', [])
111 # when https://github.com/mesonbuild/meson/pull/5426/files
112 # is merged and released
113 if build_infos.has_key('has-plugins', default: false)
114 plugins = subproj.get_variable('plugins')
119 foreach plugin: plugins
120 all_plugins += pathsep + plugin.full_path()
123 subprojects_names += [project_name]
124 cmdres = run_command(python3, '-c', symlink.format(project_name, meson.current_source_dir()))
125 if cmdres.returncode() == 0
126 message('Created symlink to ' + project_name)
129 if not meson.is_cross_build() and build_infos.has_key('build-hotdoc', default: false)
130 if plugins.length() > 0
131 plugins_doc_caches += [subproj.get_variable('plugins_doc_dep')]
133 if documented_projects != ''
134 documented_projects += ','
136 documented_projects += project_name
141 plugins_doc_dep = custom_target('plugins-doc-cache',
142 command: [python3, '-c', 'print("Built all doc caches")'],
143 input: plugins_doc_caches,
144 output: 'plugins_doc_caches',
148 foreach custom_subproj: get_option('custom_subprojects').split(',')
149 if custom_subproj != ''
150 message ('Adding custom subproject ' + custom_subproj)
151 subproject(custom_subproj)
152 subprojects_names += [custom_subproj]
156 if meson.is_cross_build() or build_machine.system() == 'windows'
157 if get_option('doc').enabled()
158 error('Documentation enabled but building the doc while cross building or building on windows is not supported yet.')
161 message('Documentation not built as building the documentation while cross building or building on windows is not supported yet.')
163 hotdoc_p = find_program('hotdoc', required : get_option('doc'))
165 if documented_projects != ''
166 subproject('gst-docs', default_options: 'built_subprojects=' + documented_projects)
167 message('Gst docs subprojects: ' + documented_projects)
170 message('Not building documentation as hotdoc was not found')
174 cmdres = run_command(python3, find_program('scripts/generate_plugins_path.py'), '--builddir',
175 meson.build_root(), all_plugins)
176 assert(cmdres.returncode() == 0, 'Could not create plugins path: @0@'.format(cmdres.stderr()))
178 message('Building subprojects: ' + ', '.join(subprojects_names))
179 setenv = find_program('gst-env.py')
181 devenv_cmd = [setenv, '--builddir=@0@'.format(meson.build_root()),
182 '--srcdir=@0@'.format(meson.source_root())]
184 if meson.has_exe_wrapper() and build_machine.system() == 'linux' and host_machine.system() == 'windows'
185 # FIXME: Ideally we could get the wrapper directly from meson
186 devenv_cmd += ['--wine', host_machine.cpu_family() == 'x86_64' ? 'wine64' : 'wine32']
187 sysroot = meson.get_cross_property('sys_root')
190 devenv_cmd += ['--winepath', 'Z:' + join_paths(sysroot, 'bin')]
194 run_target('uninstalled', command : devenv_cmd)
195 run_target('devenv', command : devenv_cmd)
197 update = find_program('git-update')
198 run_target('git-update', command : [update])
199 run_target('update', command : [update,
200 '--builddir=@0@'.format(meson.current_build_dir())])