xref: /aosp_15_r20/external/wayland/doc/doxygen/meson.build (revision 84e872a0dc482bffdb63672969dd03a827d67c73)
1# Here be dragons
2
3dot_gv = {
4	'wayland-architecture': files('dot/wayland-architecture.gv'),
5	'x-architecture': files('dot/x-architecture.gv'),
6}
7
8# This is a workaround for Meson's custom_target() directive, which
9# currently does not support outputs pointing to a sub-directory
10# XXX: try turning these into maps, so they can be indexed with picture name
11dot_png = []
12dot_map = []
13
14doxygen_conf = configuration_data()
15doxygen_conf.set('VERSION', meson.project_version())
16doxygen_conf.set('top_builddir', meson.project_build_root())
17wayland_doxygen = configure_file(
18	input: 'wayland.doxygen.in',
19	output: 'wayland.doxygen',
20	configuration: doxygen_conf,
21)
22
23shared_files = files([
24	'../../src/wayland-util.h',
25])
26
27client_files = files([
28	'../../src/wayland-client.c',
29	'../../src/wayland-client.h',
30	'../../src/wayland-client-core.h',
31])
32
33server_files = files([
34	'../../src/event-loop.c',
35	'../../src/wayland-server.c',
36	'../../src/wayland-server.h',
37	'../../src/wayland-server-core.h',
38	'../../src/wayland-shm.c',
39])
40
41cursor_files = files([
42	'../../cursor/wayland-cursor.c',
43	'../../cursor/wayland-cursor.h',
44])
45
46extra_client_files = [
47	'mainpage.dox',
48	wayland_client_protocol_h,
49]
50
51extra_server_files = [
52	'mainpage.dox',
53	wayland_server_protocol_h,
54]
55
56extra_cursor_files = [
57	'mainpage.dox',
58]
59
60gen_doxygen = find_program('gen-doxygen.py')
61
62subdir('xml')
63
64formats = {
65	'html': {
66		'Client': shared_files + client_files + extra_client_files,
67		'Server': shared_files + server_files + extra_server_files,
68		'Cursor': shared_files + cursor_files + extra_cursor_files,
69	},
70}
71
72foreach f_name, sections: formats
73	foreach s_name, s_files: sections
74		t_name = '@0@-@1@-doc'.format(f_name, s_name)
75
76		# We do not really need an output file, but Meson
77		# will complain if one is not set, so we use a
78		# dummy 'stamp' file
79		stamp = join_paths(meson.current_build_dir(), '@[email protected]'.format(t_name))
80		custom_target(
81			t_name,
82			command: [
83				gen_doxygen,
84				# XXX pass doxygen path as argument
85				'--builddir=@OUTDIR@',
86				'--section=@0@'.format(s_name),
87				'--output-format=@0@'.format(f_name),
88				'--stamp=@0@'.format(stamp),
89				wayland_doxygen,
90				'@INPUT@',
91			],
92			input: s_files,
93			output: '@[email protected]'.format(t_name),
94			depends: [dot_png, dot_map],
95			build_by_default: true,
96		)
97	endforeach
98endforeach
99
100man_files = shared_files + server_files + client_files + cursor_files
101stamp = join_paths(meson.current_build_dir(), 'man3.stamp')
102custom_target(
103	'man-pages-3',
104	command: [
105		gen_doxygen,
106		'--builddir=@OUTDIR@',
107		'--output-format=man3',
108		'--stamp=@0@'.format(stamp),
109		wayland_doxygen,
110		'@INPUT@',
111	],
112	input: man_files,
113	output: 'man3',
114	build_by_default: true,
115	install: true,
116	install_dir: join_paths(get_option('prefix'), get_option('mandir')),
117)
118