Merging gstreamer-sharp
[platform/upstream/gstreamer.git] / subprojects / gstreamer / docs / meson.build
1 build_hotdoc = false
2 if meson.is_cross_build()
3     if get_option('doc').enabled()
4         error('Documentation enabled but building the doc while cross building is not supported yet.')
5     endif
6
7     message('Documentation not built as building it while cross building is not supported yet.')
8     subdir_done()
9 endif
10
11 hotdoc_plugin_scanner = executable('gst-hotdoc-plugins-scanner',
12   'gst-hotdoc-plugins-scanner.c',
13   c_args : gst_c_args,
14   include_directories : [configinc],
15   dependencies : [gobject_dep, gmodule_dep, glib_dep, gio_dep, gst_dep],
16   install_dir : helpers_install_dir,
17   link_with: [printf_lib],
18   install: true,
19 )
20
21 configure_file(
22     input: 'gst-plugins-doc-cache-generator.py',
23     output: 'gst-plugins-doc-cache-generator',
24     install_dir: helpers_install_dir,
25     copy: true
26 )
27
28 plugins_cache_generator = find_program(join_paths(meson.current_build_dir(), 'gst-plugins-doc-cache-generator'))
29 plugins_cache = join_paths(meson.current_source_dir(), 'plugins', 'gst_plugins_cache.json')
30 plugins_doc_dep = custom_target('build-doc-cache',
31     command: [plugins_cache_generator, plugins_cache, '@OUTPUT@', '@INPUT@'],
32     input: plugins,
33     output: 'gst_plugins_cache.json',
34     depends: [hotdoc_plugin_scanner],
35     build_always_stale: true,
36 )
37
38 hotdoc_p = find_program('hotdoc', required: get_option('doc'))
39 if not hotdoc_p.found()
40     message('Hotdoc not found, not building the documentation')
41     subdir_done()
42 endif
43
44 hotdoc_req = '>= 0.11.0'
45 hotdoc_version = run_command(hotdoc_p, '--version').stdout()
46 if not hotdoc_version.version_compare(hotdoc_req)
47     if get_option('doc').enabled()
48         error('Hotdoc version @0@ not found, got @1@'.format(hotdoc_req, hotdoc_version))
49     else
50         message('Hotdoc version @0@ not found, got @1@'.format(hotdoc_req, hotdoc_version))
51         subdir_done()
52     endif
53 endif
54
55 hotdoc = import('hotdoc')
56 required_hotdoc_extensions = ['gi-extension', 'gst-extension']
57 foreach extension: required_hotdoc_extensions
58     if not hotdoc.has_extensions(extension)
59         if get_option('doc').enabled()
60             error('Documentation enabled but @0@ missing'.format(extension))
61         endif
62
63         message('@0@ extension not found, not building documentation'.format(extension))
64         subdir_done()
65     endif
66 endforeach
67
68
69 if not build_gir
70     if get_option('doc').enabled()
71         error('Documentation enabled but introspection not built.')
72     endif
73
74     message('Introspection not built, can\'t build the documentation')
75     subdir_done()
76 endif
77
78 all_plugins_paths = []
79 foreach l: plugins
80     all_plugins_paths += l.full_path()
81 endforeach
82
83 build_hotdoc = true
84 docconf = configuration_data()
85 docconf.set('GST_API_VERSION', apiversion)
86
87 version_entities = configure_file(input : 'version.in',
88     output : 'gst_api_version.md',
89     configuration : docconf)
90
91 gst_excludes = []
92 foreach h: ['gettext.h', 'glib-compat-private.h', 'glib-compat.h',
93             'gst-i18n-app.h', 'gst-i18n-lib.h', 'gst_private.h',
94             'gstelementdetails.h', 'gstmacros.h', 'gstmarshal.h',
95             'math-compat.h', 'parse/grammar.tab.h',
96             '../libs/gst/base/gstindex.h',
97             '../libs/gst/base/gstindex.c',
98             '../libs/gst/check/internal-check.h',
99             'parser/grammar.tab.pre.h', 'parse/parse_lex.h', 'types.h',
100             'gst-printf.h', 'printf-args.h', 'printf-extension.h',
101             'printf-parse.h', 'vasnprintf.h', 'gstregistrybinary.c',
102             'gstregistrybinary.h', 'gstpluginloader.h', 'gstpluginloader.c']
103     gst_excludes += [join_paths(meson.current_source_dir(), '..', 'gst', h)]
104 endforeach
105
106 libs_doc = [hotdoc.generate_doc('gstreamer',
107     project_version: apiversion,
108     gi_c_sources: '../gst/*.[hc]',
109     gi_sources: [gst_gir[0].full_path()],
110     gi_c_source_filters: gst_excludes,
111     sitemap: 'gst/sitemap.txt',
112     index: 'gst/index.md',
113     gi_index: 'gst/gi-index.md',
114     gi_smart_index: true,
115     gi_c_source_roots: [join_paths(meson.current_source_dir(), '../gst/'), ],
116     dependencies: [gst_dep, glib_dep, gobject_dep, gmodule_dep, hotdoc_plugin_scanner],
117     extra_assets: [join_paths(meson.current_source_dir(), 'images')],
118 )]
119
120 libs = [
121   ['base', gst_base_gir, gst_base_dep],
122   ['controller', gst_controller_gir, gst_controller_dep,],
123   ['net', gst_net_gir, gst_net_dep],
124   ['check', gst_check_gir, gst_check_dep],
125 ]
126
127 foreach lib: libs
128   name = lib[0]
129   gir = lib[1]
130   deps = [lib[2], gir]
131   libs_doc += [hotdoc.generate_doc(name,
132       project_version: apiversion,
133       gi_c_sources: ['../libs/gst/' + name + '/*.[hc]'],
134       gi_c_source_filters: gst_excludes,
135       gi_sources: gir[0].full_path(),
136       gi_c_source_roots: [join_paths(meson.current_source_dir(), '../libs/gst/' + name), ],
137       sitemap: join_paths('libs', name, 'sitemap.txt'),
138       index: join_paths('libs/', name, 'index.md'),
139       gi_index: join_paths('libs/', name, 'index.md'),
140       gi_smart_index: true,
141       gi_order_generated_subpages: true,
142       dependencies: deps + [hotdoc_plugin_scanner],
143       install: false,
144   )]
145 endforeach
146
147 plugins_doc = [
148     hotdoc.generate_doc('coreelements',
149         project_version: apiversion,
150         sitemap: 'plugins/sitemap.txt',
151         index: 'plugins/index.md',
152         gst_index: 'plugins/index.md',
153         gst_smart_index: true,
154         gst_c_sources: ['../plugins/elements/*.c', '../plugins/elements/*.h'],
155         dependencies: [plugins_doc_dep],
156         gst_cache_file: plugins_cache,
157         gst_plugin_name: 'coreelements',
158     ),
159     hotdoc.generate_doc('coretracers',
160         project_version: apiversion,
161         sitemap: 'plugins/sitemap.txt',
162         index: 'plugins/blank.md',
163         gst_index: 'plugins/blank.md',
164         gst_smart_index: true,
165         gst_c_sources: ['../plugins/tracers/*.c', '../plugins/tracers/*.h'],
166         dependencies: [plugins_doc_dep],
167         gst_cache_file: plugins_cache,
168         gst_plugin_name: 'coretracers',
169     )
170
171 ]