meson: List libraries and their corresponding gir definition
[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 if static_build
69     if get_option('doc').enabled()
70         error('Documentation enabled but not supported when building statically.')
71     endif
72
73     message('Building statically, can\'t build the documentation')
74     subdir_done()
75 endif
76
77 if not build_gir
78     if get_option('doc').enabled()
79         error('Documentation enabled but introspection not built.')
80     endif
81
82     message('Introspection not built, can\'t build the documentation')
83     subdir_done()
84 endif
85
86 all_plugins_paths = []
87 foreach l: plugins
88     all_plugins_paths += l.full_path()
89 endforeach
90
91 build_hotdoc = true
92 docconf = configuration_data()
93 docconf.set('GST_API_VERSION', apiversion)
94
95 version_entities = configure_file(input : 'version.in',
96     output : 'gst_api_version.md',
97     configuration : docconf)
98
99 gst_excludes = []
100 foreach h: ['gettext.h', 'glib-compat-private.h', 'glib-compat.h',
101             'gst-i18n-app.h', 'gst-i18n-lib.h', 'gst_private.h',
102             'gstelementdetails.h', 'gstmacros.h', 'gstmarshal.h',
103             'math-compat.h', 'parse/grammar.tab.h',
104             '../libs/gst/base/gstindex.h',
105             '../libs/gst/base/gstindex.c',
106             '../libs/gst/check/internal-check.h',
107             'parser/grammar.tab.pre.h', 'parse/parse_lex.h', 'types.h',
108             'gst-printf.h', 'printf-args.h', 'printf-extension.h',
109             'printf-parse.h', 'vasnprintf.h', 'gstregistrybinary.c',
110             'gstregistrybinary.h', 'gstpluginloader.h', 'gstpluginloader.c']
111     gst_excludes += [join_paths(meson.current_source_dir(), '..', 'gst', h)]
112 endforeach
113
114 libs_doc = [hotdoc.generate_doc('gstreamer',
115     project_version: apiversion,
116     gi_c_sources: '../gst/*.[hc]',
117     gi_sources: [gst_gir[0].full_path()],
118     gi_c_source_filters: gst_excludes,
119     sitemap: 'gst/sitemap.txt',
120     index: 'gst/index.md',
121     gi_index: 'gst/gi-index.md',
122     gi_smart_index: true,
123     gi_c_source_roots: [join_paths(meson.current_source_dir(), '../gst/'), ],
124     dependencies: [gst_dep, glib_dep, gobject_dep, gmodule_dep, hotdoc_plugin_scanner],
125     extra_assets: [join_paths(meson.current_source_dir(), 'images')],
126 )]
127
128 libs = [
129   ['base', gst_base_gir, gst_base_dep],
130   ['controller', gst_controller_gir, gst_controller_dep,],
131   ['net', gst_net_gir, gst_net_dep],
132   ['check', gst_check_gir, gst_check_dep],
133 ]
134
135 foreach lib: libs
136   name = lib[0]
137   gir = lib[1]
138   deps = [lib[2], gir]
139   libs_doc += [hotdoc.generate_doc(name,
140       project_version: apiversion,
141       gi_c_sources: ['../libs/gst/' + name + '/*.[hc]'],
142       gi_c_source_filters: gst_excludes,
143       gi_sources: gir[0].full_path(),
144       gi_c_source_roots: [join_paths(meson.current_source_dir(), '../libs/gst/' + name), ],
145       sitemap: join_paths('libs', name, 'sitemap.txt'),
146       index: join_paths('libs/', name, 'index.md'),
147       gi_index: join_paths('libs/', name, 'index.md'),
148       gi_smart_index: true,
149       gi_order_generated_subpages: true,
150       dependencies: deps + [hotdoc_plugin_scanner],
151       install: false,
152   )]
153 endforeach
154
155 plugins_doc = [
156     hotdoc.generate_doc('coreelements',
157         project_version: apiversion,
158         sitemap: 'plugins/sitemap.txt',
159         index: 'plugins/index.md',
160         gst_index: 'plugins/index.md',
161         gst_smart_index: true,
162         gst_c_sources: ['../plugins/elements/*.c', '../plugins/elements/*.h'],
163         dependencies: [plugins_doc_dep],
164         gst_cache_file: plugins_cache,
165         gst_plugin_name: 'coreelements',
166     ),
167     hotdoc.generate_doc('coretracers',
168         project_version: apiversion,
169         sitemap: 'plugins/sitemap.txt',
170         index: 'plugins/blank.md',
171         gst_index: 'plugins/blank.md',
172         gst_smart_index: true,
173         gst_c_sources: ['../plugins/tracers/*.c', '../plugins/tracers/*.h'],
174         dependencies: [plugins_doc_dep],
175         gst_cache_file: plugins_cache,
176         gst_plugin_name: 'coretracers',
177     )
178
179 ]