docs: Port to hotdoc
[platform/upstream/gstreamer.git] / docs / meson.build
1 build_hotdoc = false
2
3 if 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()
10 endif
11
12 required_hotdoc_extensions = ['gst-extension']
13 if gst_dep.type_name() == 'internal'
14     gst_proj = subproject('gstreamer')
15     plugins_cache_generator = gst_proj.get_variable('plugins_cache_generator')
16 else
17     plugins_cache_generator = find_program(join_paths(gst_dep.get_pkgconfig_variable('libexecdir'), 'gstreamer-' + api_version, 'gst-plugins-doc-cache-generator'))
18 endif
19
20 plugins_cache = join_paths(meson.current_source_dir(), 'gst_plugins_cache.json')
21 if plugins_cache_generator.found()
22     plugins_doc_dep = custom_target('libav-plugins-doc-cache',
23         build_by_default: true,
24         command: [plugins_cache_generator, plugins_cache, '@OUTPUT@', '@INPUT@'],
25         input: plugins,
26         output: 'gst_plugins_cache.json',
27     )
28 else
29     warning('GStreamer plugin inspector for documentation not found, can\'t update the cache')
30 endif
31
32 hotdoc_p = find_program('hotdoc', required: get_option('doc'))
33 if not hotdoc_p.found()
34     message('Hotdoc not found, not building the documentation')
35     subdir_done()
36 endif
37
38 build_hotdoc = true
39 hotdoc = import('hotdoc')
40 docconf = configuration_data()
41 docconf.set('GST_API_VERSION', api_version)
42
43 foreach extension: required_hotdoc_extensions
44     if not hotdoc.has_extensions(extension)
45         if get_option('doc').enabled()
46             error('Documentation enabled but gi-extension missing')
47         endif
48
49         message('@0@ extensions not found, not building documentation requiring it'.format(extension))
50         subdir_done()
51     endif
52 endforeach
53
54
55 libs_doc = []
56 plugins_doc = [hotdoc.generate_doc('libav',
57     project_version: api_version,
58     sitemap: 'sitemap.txt',
59     index: 'index.md',
60     gst_index: 'index.md',
61     gst_smart_index: true,
62     gst_c_sources: ['../ext/*/*.[ch]',],
63     gst_cache_file: plugins_cache,
64     gst_plugin_name: 'libav',
65     dependencies: [gst_dep, gstlibav_plugin, plugins_doc_dep],
66     disable_incremental_build: true,
67 )]