ci: rebuild windows image
[platform/upstream/gstreamer.git] / subprojects / gst-rtsp-server / 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 if 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, can\'t build the documentation')
27     subdir_done()
28 endif
29
30 required_hotdoc_extensions = ['gi-extension', 'gst-extension']
31 if gst_dep.type_name() == 'internal'
32     gst_proj = subproject('gstreamer')
33     plugins_cache_generator = gst_proj.get_variable('plugins_cache_generator')
34 else
35     required_hotdoc_extensions += ['gst-extension']
36     plugins_cache_generator = find_program(join_paths(gst_dep.get_variable('libexecdir'), 'gstreamer-' + api_version, 'gst-plugins-doc-cache-generator'),
37         required: false)
38 endif
39
40 plugins_cache = join_paths(meson.current_source_dir(), 'plugins', 'gst_plugins_cache.json')
41 if plugins.length() == 0
42     message('All rtsp-server plugins have been disabled')
43 elif plugins_cache_generator.found()
44     gst_plugins_doc_dep = custom_target('rtsp-server-plugins-doc-cache',
45         command: [plugins_cache_generator, plugins_cache, '@OUTPUT@', '@INPUT@'],
46         input: plugins,
47         output: 'gst_plugins_cache.json',
48     )
49 else
50     warning('GStreamer plugin inspector for documentation not found, can\'t update the cache')
51 endif
52
53 hotdoc_p = find_program('hotdoc', required: get_option('doc'))
54 if not hotdoc_p.found()
55     message('Hotdoc not found, not building the documentation')
56     subdir_done()
57 endif
58
59 hotdoc_req = '>= 0.11.0'
60 hotdoc_version = run_command(hotdoc_p, '--version', check: false).stdout()
61 if 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
68 endif
69
70 hotdoc = import('hotdoc')
71 foreach 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@ extension not found, not building documentation'.format(extension))
78         subdir_done()
79     endif
80 endforeach
81
82 build_hotdoc = true
83 hotdoc = import('hotdoc')
84
85 libs_doc = [hotdoc.generate_doc('gst-rtsp-server',
86     project_version: api_version,
87     gi_c_sources: ['../gst/rtsp-server/*.[hc]'],
88     gi_sources: rtsp_server_gir[0].full_path(),
89     sitemap: 'sitemap.txt',
90     index: 'index.md',
91     gi_index: 'index.md',
92     gi_smart_index: true,
93     gi_order_generated_subpages: true,
94     depends: rtsp_server_gir[0],
95 )]
96
97 plugins_doc = [hotdoc.generate_doc('rtspclientsink',
98     project_version: api_version,
99     sitemap: 'plugins/sitemap.txt',
100     index: 'plugins/index.md',
101     gst_index: 'plugins/index.md',
102     gst_c_sources: ['../gst/rtsp-sink/*.[ch]'],
103     gst_dl_sources: [rtspsink.full_path()],
104     gst_smart_index: true,
105     dependencies: gst_rtsp_server_deps + [rtspsink],
106     gst_cache_file: plugins_cache,
107     gst_plugin_name: 'rtspclientsink',
108 )]
109 doc = libs_doc[0]