doc: Build documentation with 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 = ['gi-extension', '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-' + apiversion, 'gst-plugins-doc-cache-generator'))
18 endif
19
20 plugins_cache = join_paths(meson.current_source_dir(), 'gst_plugins_cache.json')
21
22 if plugins_cache_generator.found()
23     plugins_doc_dep = custom_target('editing-services-doc-cache',
24         build_by_default: true,
25         command: [plugins_cache_generator, plugins_cache, '@OUTPUT@', '@INPUT@'],
26         input: plugins,
27         output: 'gst_plugins_cache.json',
28     )
29 else
30     warning('GStreamer plugin inspector for documentation not found, can\'t update the cache')
31 endif
32
33 hotdoc_p = find_program('hotdoc', required: get_option('doc'))
34 if not hotdoc_p.found()
35     message('Hotdoc not found, not building the documentation')
36     subdir_done()
37 endif
38
39 hotdoc = import('hotdoc')
40 foreach extension: required_hotdoc_extensions
41     if not hotdoc.has_extensions(extension)
42         if get_option('doc').enabled()
43             error('Documentation enabled but gi-extension missing')
44         endif
45
46         message('@0@ extensions not found, not building documentation requiring it'.format(extension))
47     endif
48 endforeach
49
50 if not build_gir
51     if get_option('doc').enabled()
52         error('Documentation enabled but introspection not built.')
53     endif
54
55     message('Introspection not built, can\'t build the documentation')
56     subdir_done()
57 endif
58
59 build_hotdoc = true
60 ges_excludes = []
61 foreach f: ['gesmarshal.*',
62             'ges-internal.*',
63             'ges-auto-transition.*',
64             'ges-structured-interface.*',
65             'ges-structure-parser.*',
66             'ges-version.h',
67             'ges-smart-*',
68             'ges-command-line-formatter.*',
69             'ges-base-xml-formatter.h',
70             'gstframepositioner.*',
71             'lex.priv_ges_parse_yy.c',
72             'ges-parse-lex.[c]']
73     ges_excludes += [join_paths(meson.current_source_dir(), '..', '..', 'ges', f)]
74 endforeach
75
76 hotdoc = import('hotdoc')
77 libs_doc = [hotdoc.generate_doc('gst-editing-services',
78     project_version: apiversion,
79     extra_assets: [join_paths(meson.current_source_dir(), 'images')],
80     gi_c_sources: ges_sources + ges_headers,
81     gi_c_source_roots: [join_paths(meson.current_source_dir(), '../ges/')],
82     gi_sources: [ges_gir[0].full_path()],
83     gi_c_source_filters: ges_excludes,
84     sitemap: 'sitemap.txt',
85     index: 'index.md',
86     gi_index: 'index.md',
87     gi_smart_index: true,
88     gi_order_generated_subpages: true,
89     dependencies: [ges_dep],
90     disable_incremental_build: true,
91 )]
92
93 plugins_doc = [hotdoc.generate_doc('nle',
94     project_version: apiversion,
95     extra_assets: [join_paths(meson.current_source_dir(), 'images')],
96     sitemap: 'nle-sitemap.txt',
97     index: 'nle-index.md',
98     dependencies: [nle],
99     disable_incremental_build: true,
100     gst_order_generated_subpages: true,
101     gst_index: 'nle-index.md',
102     gst_c_sources: ['../../plugins/nle/*.[ch]'],
103     gst_smart_index: true,
104     gst_cache_file: plugins_cache,
105     gst_plugin_name: 'nle',
106 )]