doc: Do not build plugins to build the doc
[platform/upstream/gstreamer.git] / subprojects / gst-libav / 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 if 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()
19 endif
20
21 required_hotdoc_extensions = ['gst-extension']
22 if gst_dep.type_name() == 'internal'
23     gst_proj = subproject('gstreamer')
24     plugins_cache_generator = gst_proj.get_variable('plugins_cache_generator')
25 else
26     plugins_cache_generator = find_program(join_paths(gst_dep.get_variable('libexecdir'), 'gstreamer-' + api_version, 'gst-plugins-doc-cache-generator'),
27     required: false)
28 endif
29
30 plugins_cache = join_paths(meson.current_source_dir(), 'gst_plugins_cache.json')
31 if plugins_cache_generator.found()
32     gst_plugins_doc_dep = custom_target('libav-plugins-doc-cache',
33         command: [plugins_cache_generator, plugins_cache, '@OUTPUT@', '@INPUT@'],
34         input: plugins,
35         output: 'gst_plugins_cache.json',
36         build_always_stale: true,
37     )
38 else
39     warning('GStreamer plugin inspector for documentation not found, can\'t update the cache')
40 endif
41
42 hotdoc_p = find_program('hotdoc', required: get_option('doc'))
43 if not hotdoc_p.found()
44     message('Hotdoc not found, not building the documentation')
45     subdir_done()
46 endif
47
48 hotdoc_req = '>= 0.11.0'
49 hotdoc_version = run_command(hotdoc_p, '--version', check: false).stdout()
50 if not hotdoc_version.version_compare(hotdoc_req)
51     if get_option('doc').enabled()
52         error('Hotdoc version @0@ not found, got @1@'.format(hotdoc_req, hotdoc_version))
53     else
54         message('Hotdoc version @0@ not found, got @1@'.format(hotdoc_req, hotdoc_version))
55         subdir_done()
56     endif
57 endif
58
59 build_hotdoc = true
60 hotdoc = import('hotdoc')
61 docconf = configuration_data()
62 docconf.set('GST_API_VERSION', api_version)
63
64 foreach extension: required_hotdoc_extensions
65     if not hotdoc.has_extensions(extension)
66         if get_option('doc').enabled()
67             error('Documentation enabled but gi-extension missing')
68         endif
69
70         message('@0@ extensions not found, not building documentation requiring it'.format(extension))
71         subdir_done()
72     endif
73 endforeach
74
75
76 libs_doc = []
77 plugins_doc = [hotdoc.generate_doc('libav',
78     project_version: api_version,
79     sitemap: 'sitemap.txt',
80     index: 'index.md',
81     gst_index: 'index.md',
82     gst_smart_index: true,
83     gst_c_sources: ['../ext/*/*.[ch]',],
84     gst_cache_file: plugins_cache,
85     gst_plugin_name: 'libav',
86     dependencies: [gst_dep],
87     disable_incremental_build: true,
88 )]