+# Ensure that MSVC interprets all source code as UTF-8. Only do this when we're
+# not a subproject, because subprojects are not allowed to call
+# add_global_arguments().
+if not meson.is_subproject() and cc.get_id() == 'msvc'
+ add_global_arguments(
+ cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8
+ language: ['c', 'cpp'])
+endif
+
+building_full = get_option('default_library') == 'static'
+tools_option = []
+if building_full and not get_option('tools').disabled()
+ # Do not build subprojects tools when we build them against gst-full
+ tools_option = ['tools=disabled']
+endif
+
+# Ordered list of subprojects (dict has no ordering guarantees)
+subprojects = [
+ ['gstreamer', {'build-hotdoc': true, 'subproject_options': tools_option}],
+ ['gst-plugins-base', {'option': get_option('base'), 'build-hotdoc': true}],
+ ['gst-plugins-good', {'option': get_option('good'), 'build-hotdoc': true}],
+ ['libnice', { 'option': get_option('libnice'), 'match_gst_version': false}],
+ ['gst-plugins-bad', { 'option': get_option('bad'), 'build-hotdoc': true}],
+ ['gst-plugins-ugly', { 'option': get_option('ugly'), 'build-hotdoc': true}],
+ ['gst-libav', { 'option': get_option('libav'), 'build-hotdoc': true}],
+ ['gst-rtsp-server', { 'option': get_option('rtsp_server'), 'build-hotdoc': true}],
+ ['gst-devtools', { 'option': get_option('devtools'), 'build-hotdoc': true, 'subproject_options': tools_option}],
+ ['gst-integration-testsuites', { 'option': get_option('devtools') }],
+ ['gst-editing-services', { 'option': get_option('ges'), 'build-hotdoc': true, 'subproject_options': tools_option}],
+ ['gstreamer-vaapi', { 'option': get_option('vaapi'), 'build-hotdoc': true}],
+ ['gst-omx', { 'option': get_option('omx'), 'build-hotdoc': true}],
+ ['gstreamer-sharp', { 'option': get_option('sharp') }],
+ ['pygobject', { 'option': get_option('python'), 'match_gst_version': false, 'sysdep': 'pygobject-3.0', 'sysdep_version': '>= 3.8' }],
+ ['gst-python', { 'option': get_option('python')}],
+ ['gst-examples', { 'option': get_option('gst-examples'), 'match_gst_versions': false}],
+ ['gst-plugins-rs', { 'option': get_option('rs'), 'build-hotdoc': true, 'match_gst_version': false}],
+]
+
+if build_system == 'windows'
+ subproject('win-flex-bison-binaries')
+ subproject('win-nasm')
+elif build_system == 'darwin'
+ subproject('macos-bison-binary')
+endif
+
+orc_option = get_option('orc')
+# There is a check below to keep this in sync with subprojects/gst-plugins-base/meson.build
+orc_req = '>= 0.4.24'
+orc_source_option = get_option('orc-source')
+orc_subproject = disabler()
+if orc_option.allowed()
+ if orc_source_option == 'subproject'
+ orc_subproject = subproject('orc', required: orc_option)
+ else
+ dependency('orc-0.4', version: orc_req, required: orc_option,
+ allow_fallback: orc_source_option == 'auto')
+ endif
+endif
+
+foreach custom_subproj: get_option('custom_subprojects').split(',')
+ if custom_subproj != ''
+ message ('Adding custom subproject ' + custom_subproj)
+ subprojects += [[custom_subproj, {'match_gst_version': false}]]
+ endif
+endforeach
+
+
+subprojects_names = []
+plugins_doc_caches = []
+orc_update_targets = []
+all_plugins = []
+all_tools = {}
+# Using a list and not a dict to keep the ordering to build the chain of `gir`
+# dependencies
+all_libraries = []
+foreach sp : subprojects
+ project_name = sp[0]
+ build_infos = sp[1]
+ is_required = build_infos.get('option', true)
+ sysdep = build_infos.get('sysdep', '')
+ sysdep_version = build_infos.get('sysdep_version', '')
+ match_gst_version = build_infos.get('match_gst_version', true)
+ default_options = build_infos.get('subproject_options', [])
+
+ if match_gst_version
+ subproj = subproject(project_name, version: gst_version, required: is_required, default_options: default_options)
+ elif sysdep != ''
+ sysdep_dep = dependency(sysdep, version: sysdep_version, required: false, default_options: default_options)
+ if not sysdep_dep.found()
+ subproj = subproject(project_name, required: is_required, default_options: default_options)
+ endif
+ else
+ subproj = subproject(project_name, required: is_required, default_options: default_options)
+ endif
+
+ if project_name == 'gst-plugins-base'
+ gst_base_orc_req = subproj.get_variable('orc_req', '')
+ if gst_base_orc_req != orc_req
+ error('orc_req is "@0@" but it should be "@1@" from subprojects/gst-plugins-base/meson.build'
+ .format(orc_req, gst_base_orc_req))
+ endif
+ endif
+
+ if subproj.found()
+ plugins = subproj.get_variable('gst_plugins', [])
+ legacy_plugins = subproj.get_variable('plugins', [])
+ all_plugins += plugins
+ if plugins.length() == 0 and legacy_plugins.length() > 0
+ warning(f'DEPRECATED use of the `plugins` variable in @project_name@.')
+ warning('The variable should now be called `gst_plugins` and use:')
+ warning('`declare_dependency( link_with: <plugin_target>, variable: {\'full_path\': <plugin_target>.full_path()})` instead')
+ foreach plugin: legacy_plugins
+ all_plugins += [declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})]
+ endforeach
+ endif
+
+ all_libraries += subproj.get_variable('gst_libraries', [])
+ if not get_option('tools').disabled()
+ all_tools += subproj.get_variable('gst_tools', {})
+ endif
+
+ orc_update_targets += subproj.get_variable('orc_update_targets', [])
+
+ subprojects_names += [project_name]
+
+ if not meson.is_cross_build() and build_infos.get('build-hotdoc', false)
+ plugins_doc_caches += [subproj.get_variable('gst_plugins_doc_dep', [])]
+ if documented_projects != ''
+ documented_projects += ','
+ endif
+ documented_projects += project_name
+ endif
+ endif
+endforeach
+
+# Check if we need to also build glib-networking for TLS modules
+giomodules = []
+glib_dep = dependency('glib-2.0')
+if glib_dep.type_name() == 'internal'
+ subp = subproject('glib-networking', required : get_option('tls'),
+ default_options: ['gnutls=auto', 'openssl=auto'])
+ if subp.found()
+ giomodules += subp.get_variable('giomodules', [])
+ endif
+endif
+
+gst_plugins_doc_dep = custom_target('plugins-doc-cache',
+ command: [python3, '-c', 'print("Built all doc caches")'],
+ input: plugins_doc_caches,
+ output: 'plugins_doc_caches',
+ capture: true,
+)
+
+if meson.is_cross_build() or build_machine.system() == 'windows'
+ if get_option('doc').enabled()
+ error('Documentation enabled but building the doc while cross building or building on windows is not supported yet.')
+ endif
+
+ documented_projects = ''
+ message('Documentation not built as building the documentation while cross building or building on windows is not supported yet.')
+else
+ hotdoc_p = find_program('hotdoc', required : get_option('doc'))
+ if not hotdoc_p.found()
+ documented_projects = ''
+ message('Not building documentation as hotdoc was not found')
+ endif
+endif
+
+write_file_contents = '''
+import os
+import sys
+
+assert len(sys.argv) >= 3
+fname = sys.argv[1]
+contents = sys.argv[2]
+
+with open(fname, 'w') as f:
+ f.write(contents)
+'''
+
+configure_file(
+ output : 'GstDocumentedSubprojects',
+ command : [python3,
+ '-c', write_file_contents,
+ '@OUTPUT@',
+ documented_projects]
+)
+
+if documented_projects != ''
+ gst_doc = subproject('gst-docs', required: get_option('doc').enabled())
+ if gst_doc.found()
+ gst_doc_target = gst_doc.get_variable('gstreamer_doc')
+ alias_target('gst-doc', gst_doc_target)