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')
48 # Ordered list of subprojects (dict has no ordering guarantees)
50 ['gstreamer', {'build-hotdoc': true, 'has-plugins': true}],
51 ['gst-plugins-base', {'build-hotdoc': true, 'has-plugins': true}],
52 ['gst-plugins-good', {'build-hotdoc': true, 'has-plugins': true}],
53 ['libnice', { 'option': get_option('libnice'), 'match_gst_version': false}],
54 ['gst-plugins-bad', { 'option': get_option('bad'), 'build-hotdoc': true, 'has-plugins': true}],
55 ['gst-plugins-ugly', { 'option': get_option('ugly'), 'build-hotdoc': true, 'has-plugins': true}],
56 ['gst-libav', { 'option': get_option('libav'), 'build-hotdoc': true, 'has-plugins': true}],
57 ['gst-rtsp-server', { 'option': get_option('rtsp_server'), 'build-hotdoc': true }],
58 ['gst-devtools', { 'option': get_option('devtools'), 'build-hotdoc': true }],
59 ['gst-integration-testsuites', { 'option': get_option('devtools') }],
60 ['gst-editing-services', { 'option': get_option('ges'), 'build-hotdoc': true, 'has-plugins': true}],
61 ['gstreamer-vaapi', { 'option': get_option('vaapi'), 'build-hotdoc': true, 'has-plugins': true}],
62 ['gst-omx', { 'option': get_option('omx'), 'build-hotdoc': true, 'has-plugins': true}],
63 ['gstreamer-sharp', { 'option': get_option('sharp') }],
64 ['pygobject', { 'option': get_option('python'), 'match_gst_version': false }],
65 ['gst-python', { 'option': get_option('python'), 'has-plugins': true}],
66 ['gst-examples', { 'option': get_option('gst-examples'), 'match_gst_versions': false}],
72 os.symlink(os.path.join('@1@', 'subprojects', '@0@'),
73 os.path.join('@1@', '@0@'))
76 if build_system == 'windows'
77 subproject('win-flex-bison-binaries')
78 subproject('win-nasm')
81 pathsep = host_machine.system() == 'windows' ? ';' : ':'
83 subproject('orc', required: get_option('orc'))
85 subprojects_names = []
86 plugins_doc_caches = []
88 foreach sp : subprojects
91 is_required = build_infos.get('option', true)
92 match_gst_version = build_infos.get('match_gst_version', true)
95 subproj = subproject(project_name, version: gst_version, required: is_required)
97 subproj = subproject(project_name, required: is_required)
101 # Replace by using subproject.get_variable('plugins', [])
102 # when https://github.com/mesonbuild/meson/pull/5426/files
103 # is merged and released
104 if build_infos.has_key('has-plugins', default: false)
105 plugins = subproj.get_variable('plugins')
110 foreach plugin: plugins
111 all_plugins += pathsep + plugin.full_path()
114 subprojects_names += [project_name]
115 cmdres = run_command(python3, '-c', symlink.format(project_name, meson.current_source_dir()))
116 if cmdres.returncode() == 0
117 message('Created symlink to ' + project_name)
120 if not meson.is_cross_build() and build_infos.has_key('build-hotdoc', default: false)
121 if plugins.length() > 0
122 plugins_doc_caches += [subproj.get_variable('plugins_doc_dep')]
124 if documented_projects != ''
125 documented_projects += ','
127 documented_projects += project_name
132 plugins_doc_dep = custom_target('plugins-doc-cache',
133 command: [python3, '-c', 'print("Built all doc caches")'],
134 input: plugins_doc_caches,
135 output: 'plugins_doc_caches',
139 foreach custom_subproj: get_option('custom_subprojects').split(',')
140 if custom_subproj != ''
141 message ('Adding custom subproject ' + custom_subproj)
142 subproject(custom_subproj)
143 subprojects_names += [custom_subproj]
147 if meson.is_cross_build() or build_machine.system() == 'windows'
148 if get_option('doc').enabled()
149 error('Documentation enabled but building the doc while cross building or building on windows is not supported yet.')
152 message('Documentation not built as building the documentation while cross building or building on windows is not supported yet.')
154 hotdoc_p = find_program('hotdoc', required : get_option('doc'))
156 if documented_projects != ''
157 subproject('gst-docs', default_options: 'built_subprojects=' + documented_projects)
158 message('Gst docs subprojects: ' + documented_projects)
161 message('Not building documentation as hotdoc was not found')
165 cmdres = run_command(python3, find_program('scripts/generate_plugins_path.py'), '--builddir',
166 meson.build_root(), all_plugins)
167 assert(cmdres.returncode() == 0, 'Could not create plugins path: @0@'.format(cmdres.stderr()))
169 message('Building subprojects: ' + ', '.join(subprojects_names))
170 setenv = find_program('gst-env.py')
172 devenv_cmd = [setenv, '--builddir=@0@'.format(meson.build_root()),
173 '--srcdir=@0@'.format(meson.source_root())]
175 if meson.has_exe_wrapper() and build_machine.system() == 'linux' and host_machine.system() == 'windows'
176 # FIXME: Ideally we could get the wrapper directly from meson
177 devenv_cmd += ['--wine', host_machine.cpu_family() == 'x86_64' ? 'wine64' : 'wine32']
178 sysroot = meson.get_cross_property('sys_root')
181 devenv_cmd += ['--winepath', 'Z:' + join_paths(sysroot, 'bin')]
185 run_target('uninstalled', command : devenv_cmd)
186 run_target('devenv', command : devenv_cmd)
188 update = find_program('git-update')
189 run_target('git-update', command : [update])
190 run_target('update', command : [update,
191 '--builddir=@0@'.format(meson.current_build_dir())])