1build_hotdoc = false 2 3if meson.is_cross_build() 4 if get_option('doc').enabled() 5 error('Documentation enabled but building the doc while cross building is not supported yet.') 6 endif 7 8 message('Documentation not built as building it while cross building is not supported yet.') 9 subdir_done() 10endif 11 12if static_build 13 if get_option('doc').enabled() 14 error('Documentation enabled but not supported when building statically.') 15 endif 16 17 message('Building statically, can\'t build the documentation') 18 subdir_done() 19endif 20 21if not build_gir 22 if get_option('doc').enabled() 23 error('Documentation enabled but introspection not built.') 24 endif 25 26 message('Introspection not built, won\'t build documentation requiring it') 27endif 28 29required_hotdoc_extensions = ['gi-extension', 'c-extension', 'gst-extension'] 30if gst_dep.type_name() == 'internal' 31 gst_proj = subproject('gstreamer') 32 plugins_cache_generator = gst_proj.get_variable('plugins_cache_generator') 33else 34 plugins_cache_generator = find_program(join_paths(gst_dep.get_variable('libexecdir'), 'gstreamer-' + api_version, 'gst-plugins-doc-cache-generator'), 35 required: false) 36endif 37 38plugins_cache = join_paths(meson.current_source_dir(), 'plugins', 'gst_plugins_cache.json') 39 40if plugins.length() == 0 41 message('All bad plugins have been disabled') 42elif plugins_cache_generator.found() 43 plugins_doc_dep = custom_target('bad-plugins-doc-cache', 44 command: [plugins_cache_generator, plugins_cache, '@OUTPUT@', '@INPUT@'], 45 input: plugins, 46 output: 'gst_plugins_cache.json', 47 build_always_stale: true, 48 ) 49else 50 warning('GStreamer plugin inspector for documentation not found, can\'t update the cache') 51endif 52 53hotdoc_p = find_program('hotdoc', required: get_option('doc')) 54if not hotdoc_p.found() 55 message('Hotdoc not found, not building the documentation') 56 subdir_done() 57endif 58 59hotdoc_req = '>= 0.11.0' 60hotdoc_version = run_command(hotdoc_p, '--version', check: false).stdout() 61if not hotdoc_version.version_compare(hotdoc_req) 62 if get_option('doc').enabled() 63 error('Hotdoc version @0@ not found, got @1@'.format(hotdoc_req, hotdoc_version)) 64 else 65 message('Hotdoc version @0@ not found, got @1@'.format(hotdoc_req, hotdoc_version)) 66 subdir_done() 67 endif 68endif 69 70hotdoc = import('hotdoc') 71foreach extension: required_hotdoc_extensions 72 if not hotdoc.has_extensions(extension) 73 if get_option('doc').enabled() 74 error('Documentation enabled but @0@ missing'.format(extension)) 75 endif 76 77 message('@0@ extensions not found, not building documentation requiring it'.format(extension)) 78 endif 79endforeach 80 81build_hotdoc = true 82 83docconf = configuration_data() 84docconf.set('GST_API_VERSION', api_version) 85 86configure_file(input : 'gst_api_version.in', 87 output : 'gst_api_version.md', 88 configuration : docconf) 89 90root_rel = '..' 91excludes = [] 92foreach f: [ 93 'gst/frei0r/frei0r.h', 94 'gst/mxf/mxful.c', 95 'gst-libs/gst/*/*-private.h', 96 'gst-libs/gst/codecparsers/nalutils.h', 97 'ext/closedcaption/bcd.h', 98 'ext/closedcaption/bit_slicer.[ch]', 99 'ext/closedcaption/decoder.[ch]', 100 'ext/closedcaption/macros.h', 101 'ext/closedcaption/misc.h', 102 'ext/closedcaption/raw_decoder.[ch]', 103 'ext/closedcaption/sampling_par.[ch]', 104 'ext/closedcaption/sliced.[ch]', 105 'ext/*/*.h', 106 'sys/*/*.h', 107 'gst/*/*.h', 108 'gst-libs/gst/*/*-prelude.h', 109 'gst-libs/gst/vulkan/vulkan_fwd.h' 110 ] 111 excludes += [join_paths(meson.current_source_dir(), root_rel, f)] 112endforeach 113 114libs = [] 115if build_gir 116 libs = [ 117 {'name': 'mpegts', 'gir': mpegts_gir, 'lib': gstmpegts_dep}, 118 {'name': 'play', 'gir': play_gir, 'lib': gstplay_dep}, 119 {'name': 'player', 'gir': player_gir, 'lib': gstplayer_dep}, 120 {'name': 'insertbin', 'gir': insertbin_gir, 'lib': gstinsertbin_dep}, 121 {'name': 'codecparsers', 'lib': gstcodecparsers_dep}, 122 {'name': 'adaptivedemux', 'lib': gstadaptivedemux_dep}, 123 {'name': 'basecamerabinsrc', 'gir': basecamerabin_gir, 'lib': gstbasecamerabin_dep}, 124 {'name': 'webrtc', 'gir': webrtc_gir, 'lib': gstwebrtc_dep, 'suffix': 'lib'}, 125 {'name': 'audio', 'gir': audio_gir, 'lib': gstbadaudio_dep, 'prefix': 'bad-'}, 126 {'name': 'transcoder', 'gir': transcoder_gir, 'lib': gst_transcoder_dep}, 127 {'name': 'codecs', 'gir': codecs_gir, 'lib': gstcodecs_dep}, 128 ] 129 130 if gstopencv_dep.found() 131 libs += [ 132 {'name': 'opencv', 'lib': gstopencv_dep, 'c_source_patterns': ['*.h', '*.cpp'], 'extra_c_flags': ['-x c++']}, 133 ] 134 endif 135 136 if gstvulkan_dep.found() 137 libs += [ 138 {'name': 'vulkan', 'gir': vulkan_gir, 'lib': gstvulkan_dep, 'suffix': 'lib'}, 139 ] 140 if enabled_vulkan_winsys.contains('xcb') 141 libs += [ 142 {'name': 'vulkan-xcb', 'gir': vulkan_xcb_gir, 'lib': gstvulkanxcb_dep, 'extra_sources' : [ 143 join_paths(root_rel, 'gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.[ch]'), 144 ]}, 145 ] 146 endif 147 if enabled_vulkan_winsys.contains('wayland') 148 libs += [ 149 {'name': 'vulkan-wayland', 'gir': vulkan_wayland_gir, 'lib': gstvulkanwayland_dep, 'extra_sources' : [ 150 join_paths(root_rel, 'gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.[ch]'), 151 ]}, 152 ] 153 endif 154 endif 155endif 156 157has_gi_extension = hotdoc.has_extensions('gi-extension') 158has_c_extension = hotdoc.has_extensions('c-extension') 159libs_doc = [] 160foreach lib_def: libs 161 name = lib_def['name'] 162 lib = lib_def['lib'] 163 extra_sources = lib_def.get('extra_sources', []) 164 165 c_source_patterns = lib_def.get('c_source_patterns', ['*.[hc]']) 166 c_sources = [] 167 foreach pattern: c_source_patterns 168 c_sources += join_paths(root_rel, 'gst-libs/gst', name, pattern) 169 endforeach 170 c_sources += extra_sources 171 172 if lib_def.has_key('gir') 173 if has_gi_extension 174 gir = lib_def['gir'] 175 prefix = lib_def.get('prefix', '') 176 suffix = lib_def.get('suffix', '') 177 libs_doc += [hotdoc.generate_doc(prefix + name + suffix, 178 project_version: api_version, 179 gi_c_sources: c_sources, 180 gi_sources: gir[0].full_path(), 181 gi_c_source_filters: excludes, 182 sitemap: join_paths('libs', name, 'sitemap.txt'), 183 index: join_paths('libs/', name, 'index.md'), 184 gi_index: join_paths('libs/', name, 'index.md'), 185 gi_smart_index: true, 186 gi_order_generated_subpages: true, 187 dependencies: [lib, gir], 188 c_flags: '-DGST_USE_UNSTABLE_API', 189 install: false, 190 )] 191 endif 192 else 193 if has_c_extension 194 libs_doc += [hotdoc.generate_doc('gst-plugins-bad-' + name, 195 sitemap: join_paths('libs', name, 'sitemap.txt'), 196 index: join_paths('libs', name, 'index.md'), 197 project_version: api_version, 198 c_sources: c_sources, 199 c_source_filters: excludes, 200 c_index: join_paths('libs', name, 'index.md'), 201 c_smart_index: true, 202 c_order_generated_subpages: true, 203 extra_c_flags: ['-DGST_USE_UNSTABLE_API'] + lib_def.get('extra_c_flags', []), 204 dependencies: lib, 205 install: false, 206 )] 207 endif 208 endif 209endforeach 210 211list_plugin_res = run_command(python3, '-c', 212''' 213import sys 214import json 215 216with open("@0@") as f: 217 print(':'.join(json.load(f).keys()), end='') 218'''.format(plugins_cache), 219 check: true) 220 221plugins_doc = [] 222foreach plugin_name: list_plugin_res.stdout().split(':') 223 plugins_doc += [hotdoc.generate_doc(plugin_name, 224 project_version: api_version, 225 sitemap: 'plugins/sitemap.txt', 226 index: 'plugins/index.md', 227 c_flags: '-DGST_USE_UNSTABLE_API', 228 gst_index: 'plugins/index.md', 229 gst_smart_index: true, 230 gst_c_sources: [ 231 join_paths(root_rel, 'sys/*/*.[cmh]'), 232 join_paths(root_rel, 'sys/*/*.cpp'), 233 join_paths(root_rel, 'sys/*/*.cc'), 234 join_paths(root_rel, 'sys/*/*.mm'), 235 join_paths(root_rel, 'sys/*/*.hh'), 236 join_paths(root_rel, 'ext/*/*.[ch]'), 237 join_paths(root_rel, 'ext/*/*.cpp'), 238 join_paths(root_rel, 'ext/*/*.cc'), 239 join_paths(root_rel, 'ext/*/*.hh'), 240 join_paths(root_rel, 'gst/*/*.[ch]'), 241 join_paths(root_rel, 'gst/rtmp2/*/*.[ch]'), 242 ], 243 dependencies: [gst_dep, plugins], 244 install: false, 245 disable_incremental_build: true, 246 gst_cache_file: plugins_cache, 247 gst_c_source_filters: excludes, 248 gst_order_generated_subpages: true, 249 gst_plugin_name: plugin_name, 250 include_paths: join_paths(meson.current_source_dir(), '..'), 251 )] 252endforeach 253