Add libxkbregistry to query available RMLVO
[platform/upstream/libxkbcommon.git] / meson.build
1 project(
2     'libxkbcommon',
3     'c',
4     version: '0.10.0',
5     default_options: [
6         'c_std=c99',
7         'warning_level=2',
8         'b_lundef=true',
9     ],
10     meson_version : '>= 0.41.0',
11 )
12 pkgconfig = import('pkgconfig')
13 cc = meson.get_compiler('c')
14
15
16 # Compiler flags.
17 foreach cflag: [
18     '-fvisibility=hidden',
19     '-fno-strict-aliasing',
20     '-fsanitize-undefined-trap-on-error',
21     '-Wextra',
22     '-Wno-unused-parameter',
23     '-Wno-missing-field-initializers',
24     '-Wpointer-arith',
25     '-Wmissing-declarations',
26     '-Wformat=2',
27     '-Wstrict-prototypes',
28     '-Wmissing-prototypes',
29     '-Wnested-externs',
30     '-Wbad-function-cast',
31     '-Wshadow',
32     '-Wlogical-op',
33     '-Wdate-time',
34     '-Wwrite-strings',
35     '-Wno-documentation-deprecated-sync',
36 ]
37     if cc.has_argument(cflag)
38         add_project_arguments(cflag, language: 'c')
39     endif
40 endforeach
41
42
43 # The XKB config root.
44 XKBCONFIGROOT = get_option('xkb-config-root')
45 if XKBCONFIGROOT == ''
46     xkeyboard_config_dep = dependency('xkeyboard-config', required: false)
47     if xkeyboard_config_dep.found()
48         XKBCONFIGROOT = xkeyboard_config_dep.get_pkgconfig_variable('xkb_base')
49     else
50         XKBCONFIGROOT = join_paths(get_option('prefix'), get_option('datadir'), 'X11', 'xkb')
51   endif
52 endif
53
54
55 # The X locale directory for compose.
56 XLOCALEDIR = get_option('x-locale-root')
57 if XLOCALEDIR == ''
58     XLOCALEDIR = join_paths(get_option('prefix'), get_option('datadir'), 'X11', 'locale')
59 endif
60
61
62 # config.h.
63 configh_data = configuration_data()
64 # Like AC_USE_SYSTEM_EXTENSIONS, what #define to use to get extensions
65 # beyond the base POSIX function set.
66 if host_machine.system() == 'sunos'
67   system_extensions = '__EXTENSIONS__'
68 else
69   system_extensions = '_GNU_SOURCE'
70 endif
71 configh_data.set(system_extensions, 1)
72 system_ext_define = '#define ' + system_extensions
73 configh_data.set_quoted('DFLT_XKB_CONFIG_ROOT', XKBCONFIGROOT)
74 configh_data.set_quoted('XLOCALEDIR', XLOCALEDIR)
75 configh_data.set_quoted('DEFAULT_XKB_RULES', get_option('default-rules'))
76 configh_data.set_quoted('DEFAULT_XKB_MODEL', get_option('default-model'))
77 configh_data.set_quoted('DEFAULT_XKB_LAYOUT', get_option('default-layout'))
78 if get_option('default-variant') != ''
79     configh_data.set_quoted('DEFAULT_XKB_VARIANT', get_option('default-variant'))
80 endif
81 if get_option('default-options') != ''
82     configh_data.set_quoted('DEFAULT_XKB_OPTIONS', get_option('default-options'))
83 endif
84 if cc.links('int main(){if(__builtin_expect(1<0,0)){}}', name: '__builtin_expect')
85     configh_data.set('HAVE___BUILTIN_EXPECT', 1)
86 endif
87 if cc.has_header_symbol('unistd.h', 'eaccess', prefix: system_ext_define)
88     configh_data.set('HAVE_EACCESS', 1)
89 endif
90 if cc.has_header_symbol('unistd.h', 'euidaccess', prefix: system_ext_define)
91     configh_data.set('HAVE_EUIDACCESS', 1)
92 endif
93 if cc.has_header_symbol('sys/mman.h', 'mmap')
94     configh_data.set('HAVE_MMAP', 1)
95 endif
96 if cc.has_header_symbol('stdlib.h', 'mkostemp', prefix: system_ext_define)
97     configh_data.set('HAVE_MKOSTEMP', 1)
98 endif
99 if cc.has_header_symbol('fcntl.h', 'posix_fallocate', prefix: system_ext_define)
100     configh_data.set('HAVE_POSIX_FALLOCATE', 1)
101 endif
102 if cc.has_header_symbol('string.h', 'strndup', prefix: system_ext_define)
103     configh_data.set('HAVE_STRNDUP', 1)
104 endif
105 if cc.has_header_symbol('stdio.h', 'asprintf', prefix: system_ext_define)
106     configh_data.set('HAVE_ASPRINTF', 1)
107 elif cc.has_header_symbol('stdio.h', 'vasprintf', prefix: system_ext_define)
108     configh_data.set('HAVE_VASPRINTF', 1)
109 endif
110 if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix: system_ext_define)
111     configh_data.set('HAVE_SECURE_GETENV', 1)
112 elif cc.has_header_symbol('stdlib.h', '__secure_getenv', prefix: system_ext_define)
113     configh_data.set('HAVE___SECURE_GETENV', 1)
114 else
115     message('C library does not support secure_getenv, using getenv instead')
116 endif
117 # Silence some security & deprecation warnings on MSVC
118 # for some unix/C functions we use.
119 # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=vs-2019
120 configh_data.set('_CRT_SECURE_NO_WARNINGS', 1)
121 configh_data.set('_CRT_NONSTDC_NO_WARNINGS', 1)
122 configh_data.set('_CRT_NONSTDC_NO_DEPRECATE', 1)
123 # Reduce unnecessary includes on MSVC.
124 configh_data.set('WIN32_LEAN_AND_MEAN', 1)
125 configure_file(output: 'config.h', configuration: configh_data)
126
127
128 # Supports -Wl,--version-script?
129 have_version_script = cc.links(
130     'int main(){}',
131     args: '-Wl,--version-script=' + join_paths(meson.source_root(), 'xkbcommon.map'),
132     name: '-Wl,--version-script',
133 )
134
135
136 # libxkbcommon.
137 # Note: we use some yacc extensions, which work with either GNU bison
138 # (preferred) or byacc (with backtracking enabled).
139 bison = find_program('bison', 'win_bison', required: false)
140 if bison.found()
141     yacc_gen = generator(
142         bison,
143         output: ['@BASENAME@.c', '@BASENAME@.h'],
144         arguments: ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@', '-p _xkbcommon_'],
145     )
146 else
147     byacc = find_program('byacc', required: false)
148     if byacc.found()
149         yacc_gen = generator(
150             byacc,
151             output: ['@BASENAME@.c', '@BASENAME@.h'],
152             arguments: ['@INPUT@', '-H', '@OUTPUT1@', '-o', '@OUTPUT0@', '-p _xkbcommon_'],
153         )
154     else
155         error('Could not find a compatible YACC program (bison or byacc)')
156     endif
157 endif
158 libxkbcommon_sources = [
159     'src/compose/parser.c',
160     'src/compose/parser.h',
161     'src/compose/paths.c',
162     'src/compose/paths.h',
163     'src/compose/state.c',
164     'src/compose/table.c',
165     'src/compose/table.h',
166     'src/xkbcomp/action.c',
167     'src/xkbcomp/action.h',
168     'src/xkbcomp/ast.h',
169     'src/xkbcomp/ast-build.c',
170     'src/xkbcomp/ast-build.h',
171     'src/xkbcomp/compat.c',
172     'src/xkbcomp/expr.c',
173     'src/xkbcomp/expr.h',
174     'src/xkbcomp/include.c',
175     'src/xkbcomp/include.h',
176     'src/xkbcomp/keycodes.c',
177     'src/xkbcomp/keymap.c',
178     'src/xkbcomp/keymap-dump.c',
179     'src/xkbcomp/keywords.c',
180     yacc_gen.process('src/xkbcomp/parser.y'),
181     'src/xkbcomp/parser-priv.h',
182     'src/xkbcomp/rules.c',
183     'src/xkbcomp/rules.h',
184     'src/xkbcomp/scanner.c',
185     'src/xkbcomp/symbols.c',
186     'src/xkbcomp/types.c',
187     'src/xkbcomp/vmod.c',
188     'src/xkbcomp/vmod.h',
189     'src/xkbcomp/xkbcomp.c',
190     'src/xkbcomp/xkbcomp-priv.h',
191     'src/atom.c',
192     'src/atom.h',
193     'src/context.c',
194     'src/context.h',
195     'src/context-priv.c',
196     'src/darray.h',
197     'src/keysym.c',
198     'src/keysym.h',
199     'src/keysym-utf.c',
200     'src/ks_tables.h',
201     'src/keymap.c',
202     'src/keymap.h',
203     'src/keymap-priv.c',
204     'src/scanner-utils.h',
205     'src/state.c',
206     'src/text.c',
207     'src/text.h',
208     'src/utf8.c',
209     'src/utf8.h',
210     'src/utils.c',
211     'src/utils.h',
212 ]
213 libxkbcommon_link_args = []
214 if have_version_script
215     libxkbcommon_link_args += '-Wl,--version-script=' + join_paths(meson.source_root(), 'xkbcommon.map')
216 endif
217 libxkbcommon = library(
218     'xkbcommon',
219     'xkbcommon/xkbcommon.h',
220     libxkbcommon_sources,
221     link_args: libxkbcommon_link_args,
222     link_depends: 'xkbcommon.map',
223     version: '0.0.0',
224     install: true,
225     include_directories: include_directories('src'),
226 )
227 install_headers(
228     'xkbcommon/xkbcommon.h',
229     'xkbcommon/xkbcommon-compat.h',
230     'xkbcommon/xkbcommon-compose.h',
231     'xkbcommon/xkbcommon-keysyms.h',
232     'xkbcommon/xkbcommon-names.h',
233     subdir: 'xkbcommon',
234 )
235 pkgconfig.generate(
236     name: 'xkbcommon',
237     filebase: 'xkbcommon',
238     libraries: libxkbcommon,
239     version: meson.project_version(),
240     description: 'XKB API common to servers and clients',
241 )
242
243
244 # libxkbcommon-x11.
245 if get_option('enable-x11')
246     xcb_dep = dependency('xcb', version: '>=1.10', required: false)
247     xcb_xkb_dep = dependency('xcb-xkb', version: '>=1.10', required: false)
248     if not xcb_dep.found() or not xcb_xkb_dep.found()
249         error('''X11 support requires xcb-xkb >= 1.10 which was not found.
250 You can disable X11 support with -Denable-x11=false.''')
251     endif
252
253     libxkbcommon_x11_sources = [
254         'src/x11/keymap.c',
255         'src/x11/state.c',
256         'src/x11/util.c',
257         'src/x11/x11-priv.h',
258         'src/context.h',
259         'src/context-priv.c',
260         'src/keymap.h',
261         'src/keymap-priv.c',
262         'src/atom.h',
263         'src/atom.c',
264     ]
265     libxkbcommon_x11_link_args = []
266     if have_version_script
267         libxkbcommon_x11_link_args += '-Wl,--version-script=' + join_paths(meson.source_root(), 'xkbcommon-x11.map')
268     endif
269     libxkbcommon_x11 = library(
270         'xkbcommon-x11',
271         'xkbcommon/xkbcommon-x11.h',
272         libxkbcommon_x11_sources,
273         link_args: libxkbcommon_x11_link_args,
274         link_depends: 'xkbcommon-x11.map',
275         version: '0.0.0',
276         install: true,
277         include_directories: include_directories('src'),
278         link_with: libxkbcommon,
279         dependencies: [
280             xcb_dep,
281             xcb_xkb_dep,
282         ],
283     )
284     install_headers(
285         'xkbcommon/xkbcommon-x11.h',
286         subdir: 'xkbcommon',
287     )
288     pkgconfig.generate(
289         name: 'xkbcommon-x11',
290         filebase: 'xkbcommon-x11',
291         libraries: libxkbcommon_x11,
292         version: meson.project_version(),
293         description: 'XKB API common to servers and clients - X11 support',
294         requires: ['xkbcommon'],
295         requires_private: ['xcb>=1.10', 'xcb-xkb>=1.10'],
296     )
297 endif
298
299 # libxkbregistry
300 if get_option('enable-xkbregistry')
301     dep_libxml = dependency('libxml-2.0')
302     deps_libxkbregistry = [dep_libxml]
303     libxkbregistry_sources = [
304         'src/registry.c',
305         'src/utils.h',
306         'src/utils.c',
307         'src/util-list.h',
308         'src/util-list.c',
309     ]
310     libxkbregistry_link_args = []
311     if have_version_script
312         libxkbregistry_link_args += '-Wl,--version-script=' + join_paths(meson.source_root(), 'xkbregistry.map')
313     endif
314     libxkbregistry = library(
315         'xkbregistry',
316         'xkbcommon/xkbregistry.h',
317         libxkbregistry_sources,
318         link_args: libxkbregistry_link_args,
319         link_depends: 'xkbregistry.map',
320         dependencies: deps_libxkbregistry,
321         version: '0.0.0',
322         install: true,
323         include_directories: include_directories('src'),
324     )
325     install_headers(
326         'xkbcommon/xkbregistry.h',
327         subdir: 'xkbcommon',
328     )
329     pkgconfig.generate(
330         name: 'xkbregistry',
331         filebase: 'xkbregistry',
332         libraries: libxkbregistry,
333         version: meson.project_version(),
334         description: 'XKB API to query available rules, models, layouts, variants and options',
335     )
336
337     dep_libxkbregistry = declare_dependency(
338                                 include_directories: include_directories('xkbcommon'),
339                                 link_with: libxkbregistry
340                                 )
341     executable('xkbcommon-registry-list',
342                'tools/registry-list.c',
343                dependencies: dep_libxkbregistry,
344                install: false)
345 endif
346
347 # Tests
348 test_env = environment()
349 test_env.set('XKB_LOG_LEVEL', 'debug')
350 test_env.set('XKB_LOG_VERBOSITY', '10')
351 test_env.set('top_srcdir', meson.source_root())
352 test_env.set('top_builddir', meson.build_root())
353
354 test_configh_data = configuration_data()
355 test_configh_data.set_quoted('TEST_XKB_CONFIG_ROOT', join_paths(meson.source_root(), 'test', 'data'))
356 configure_file(output: 'test-config.h', configuration: test_configh_data)
357
358 # Some tests need to use unexported symbols, so we link them against
359 # an internal copy of libxkbcommon with all symbols exposed.
360 libxkbcommon_test_internal = static_library(
361     'xkbcommon-test-internal',
362     'test/common.c',
363     'test/test.h',
364     'test/evdev-scancodes.h',
365     libxkbcommon_sources,
366     include_directories: include_directories('src'),
367 )
368 test_dep = declare_dependency(
369     include_directories: include_directories('src'),
370     link_with: libxkbcommon_test_internal,
371 )
372 if get_option('enable-x11')
373     libxkbcommon_x11_internal = static_library(
374         'xkbcommon-x11-internal',
375         libxkbcommon_x11_sources,
376         include_directories: include_directories('src'),
377         link_with: libxkbcommon_test_internal,
378         dependencies: [
379             xcb_dep,
380             xcb_xkb_dep,
381         ],
382     )
383     x11_test_dep = declare_dependency(
384         link_with: libxkbcommon_x11_internal,
385         dependencies: [
386             test_dep,
387             xcb_dep,
388             xcb_xkb_dep,
389         ],
390     )
391 endif
392 test(
393     'keysym',
394     executable('test-keysym', 'test/keysym.c', dependencies: test_dep),
395     env: test_env,
396 )
397 test(
398     'keymap',
399     executable('test-keymap', 'test/keymap.c', dependencies: test_dep),
400     env: test_env,
401 )
402 test(
403     'filecomp',
404     executable('test-filecomp', 'test/filecomp.c', dependencies: test_dep),
405     env: test_env,
406 )
407 # TODO: This test currently uses some functions that don't exist on Windows.
408 if cc.get_id() != 'msvc'
409   test(
410       'context',
411       executable('test-context', 'test/context.c', dependencies: test_dep),
412       env: test_env,
413   )
414 endif
415 test(
416     'rules-file',
417     executable('test-rules-file', 'test/rules-file.c', dependencies: test_dep),
418     env: test_env,
419 )
420 test(
421     'rules-file-includes',
422     executable('test-rules-file-includes', 'test/rules-file-includes.c', dependencies: test_dep),
423     env: test_env,
424 )
425 test(
426     'stringcomp',
427     executable('test-stringcomp', 'test/stringcomp.c', dependencies: test_dep),
428     env: test_env,
429 )
430 test(
431     'buffercomp',
432     executable('test-buffercomp', 'test/buffercomp.c', dependencies: test_dep),
433     env: test_env,
434 )
435 test(
436     'log',
437     executable('test-log', 'test/log.c', dependencies: test_dep),
438     env: test_env,
439 )
440 test(
441     'atom',
442     executable('test-atom', 'test/atom.c', dependencies: test_dep),
443     env: test_env,
444 )
445 test(
446     'utf8',
447     executable('test-utf8', 'test/utf8.c', dependencies: test_dep),
448     env: test_env,
449 )
450 test(
451     'state',
452     executable('test-state', 'test/state.c', dependencies: test_dep),
453     env: test_env,
454 )
455 test(
456     'keyseq',
457     executable('test-keyseq', 'test/keyseq.c', dependencies: test_dep),
458     env: test_env,
459 )
460 test(
461     'rulescomp',
462     executable('test-rulescomp', 'test/rulescomp.c', dependencies: test_dep),
463     env: test_env,
464 )
465 test(
466     'compose',
467     executable('test-compose', 'test/compose.c', dependencies: test_dep),
468     env: test_env,
469 )
470 test(
471     'utils',
472     executable('test-utils', 'test/utils.c', dependencies: test_dep),
473     env: test_env,
474 )
475 test(
476     'symbols-leak-test',
477     find_program('test/symbols-leak-test.bash'),
478     env: test_env,
479 )
480 if get_option('enable-x11')
481     test(
482         'x11',
483         executable('test-x11', 'test/x11.c', dependencies: x11_test_dep),
484         env: test_env,
485     )
486     # test/x11comp is meant to be run, but it is (temporarily?) disabled.
487     # See: https://github.com/xkbcommon/libxkbcommon/issues/30
488     executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep)
489 endif
490 if get_option('enable-xkbregistry')
491     test(
492         'registry',
493         executable('test-registry', 'test/registry.c',
494                    include_directories: include_directories('src'),
495                    dependencies: dep_libxkbregistry),
496         env: test_env,
497     )
498 endif
499
500 # Fuzzing target programs.
501 executable('fuzz-keymap', 'fuzz/keymap/target.c', dependencies: test_dep)
502 executable('fuzz-compose', 'fuzz/compose/target.c', dependencies: test_dep)
503
504
505 # Demo programs.
506 libxkbcommon_tools_internal = static_library(
507     'tools-internal',
508     'tools/tools-common.h',
509     'tools/tools-common.c',
510     libxkbcommon_sources,
511     include_directories: include_directories('src'),
512 )
513 tools_dep = declare_dependency(
514     include_directories: [include_directories('src'), include_directories('tools')],
515     link_with: libxkbcommon_tools_internal,
516 )
517
518 if cc.has_header_symbol('getopt.h', 'getopt_long', prefix: '#define _GNU_SOURCE')
519     executable('xkbcommon-rmlvo-to-kccgst', 'tools/rmlvo-to-kccgst.c', dependencies: tools_dep)
520     executable('xkbcommon-rmlvo-to-keymap', 'tools/rmlvo-to-keymap.c', dependencies: tools_dep)
521     executable('xkbcommon-print-compiled-keymap', 'tools/print-compiled-keymap.c', dependencies: tools_dep)
522     executable('xkbcommon-how-to-type', 'tools/how-to-type.c', dependencies: tools_dep)
523 endif
524 if cc.has_header('linux/input.h')
525     executable('xkbcommon-interactive-evdev', 'tools/interactive-evdev.c', dependencies: tools_dep)
526 endif
527 if get_option('enable-x11')
528     x11_tools_dep = declare_dependency(
529         link_with: libxkbcommon_x11_internal,
530         dependencies: [
531             tools_dep,
532             xcb_dep,
533             xcb_xkb_dep,
534         ],
535     )
536     executable('xkbcommon-interactive-x11', 'tools/interactive-x11.c', dependencies: x11_tools_dep)
537 endif
538 if get_option('enable-wayland')
539     wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: false)
540     wayland_protocols_dep = dependency('wayland-protocols', version: '>=1.12', required: false)
541     wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)
542     if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()
543         error('''The Wayland demo programs require wayland-client >= 1.2.0, wayland-protocols >= 1.7 which were not found.
544 You can disable the Wayland demo programs with -Denable-wayland=false.''')
545     endif
546
547     wayland_scanner = find_program(wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'))
548     wayland_scanner_code_gen = generator(
549         wayland_scanner,
550         output: '@BASENAME@-protocol.c',
551         arguments: ['code', '@INPUT@', '@OUTPUT@'],
552     )
553     wayland_scanner_client_header_gen = generator(
554         wayland_scanner,
555         output: '@BASENAME@-client-protocol.h',
556         arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
557     )
558     wayland_protocols_datadir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir')
559     xdg_shell_xml = join_paths(wayland_protocols_datadir, 'stable/xdg-shell/xdg-shell.xml')
560     xdg_shell_sources = [
561         wayland_scanner_code_gen.process(xdg_shell_xml),
562         wayland_scanner_client_header_gen.process(xdg_shell_xml),
563     ]
564     executable('xkbcommon-interactive-wayland',
565                'tools/interactive-wayland.c',
566                xdg_shell_sources,
567                dependencies: [tools_dep, wayland_client_dep])
568 endif
569
570 # xkeyboard-config "verifier"
571 xkct_config = configuration_data()
572 xkct_config.set('MESON_BUILD_ROOT', meson.build_root())
573 xkct_config.set('XKB_CONFIG_ROOT', XKBCONFIGROOT)
574 configure_file(input: 'test/xkeyboard-config-test.py.in',
575                output: 'xkeyboard-config-test',
576                configuration: xkct_config,
577                install: false)
578
579
580 # Benchmarks.
581 libxkbcommon_bench_internal = static_library(
582     'xkbcommon-bench-internal',
583     'bench/bench.c',
584     'bench/bench.h',
585     link_with: libxkbcommon_test_internal,
586 )
587 bench_dep = declare_dependency(
588     include_directories: include_directories('src'),
589     link_with: libxkbcommon_bench_internal,
590 )
591 bench_env = environment()
592 bench_env.set('top_srcdir', meson.source_root())
593 benchmark(
594     'key-proc',
595     executable('bench-key-proc', 'bench/key-proc.c', dependencies: bench_dep),
596     env: bench_env,
597 )
598 benchmark(
599     'rules',
600     executable('bench-rules', 'bench/rules.c', dependencies: bench_dep),
601     env: bench_env,
602 )
603 benchmark(
604     'rulescomp',
605     executable('bench-rulescomp', 'bench/rulescomp.c', dependencies: bench_dep),
606     env: bench_env,
607 )
608 benchmark(
609     'compose',
610     executable('bench-compose', 'bench/compose.c', dependencies: bench_dep),
611     env: bench_env,
612 )
613
614
615 # Documentation.
616 if get_option('enable-docs')
617     doxygen = find_program('doxygen', required: false)
618     if not doxygen.found()
619         error('''Documentation requires doxygen which was not found.
620 You can disable the documentation with -Denable-docs=false.''')
621     endif
622     doxygen_wrapper = find_program('scripts/doxygen-wrapper')
623
624     doxygen_input = [
625         'README.md',
626         'doc/doxygen-extra.css',
627         'doc/quick-guide.md',
628         'doc/compat.md',
629         'doc/user-configuration.md',
630         'doc/rules-format.md',
631         'xkbcommon/xkbcommon.h',
632         'xkbcommon/xkbcommon-names.h',
633         'xkbcommon/xkbcommon-x11.h',
634         'xkbcommon/xkbcommon-compose.h',
635         'xkbcommon/xkbregistry.h',
636     ]
637     doxygen_data = configuration_data()
638     doxygen_data.set('PACKAGE_NAME', meson.project_name())
639     doxygen_data.set('PACKAGE_VERSION', meson.project_version())
640     doxygen_data.set('INPUT', ' '.join(doxygen_input))
641     doxygen_data.set('OUTPUT_DIRECTORY', meson.build_root())
642     doxyfile = configure_file(
643         input: 'doc/Doxyfile.in',
644         output: 'Doxyfile',
645         configuration: doxygen_data,
646     )
647     # TODO: Meson should provide this.
648     docdir = join_paths(get_option('datadir'), 'doc', meson.project_name())
649     custom_target(
650         'doc',
651         input: [doxyfile] + doxygen_input,
652         output: 'html',
653         command: [doxygen_wrapper, doxygen.path(), join_paths(meson.build_root(), 'Doxyfile'), meson.source_root()],
654         install: true,
655         install_dir: docdir,
656         build_by_default: true,
657     )
658 endif