10 meson_version : '>= 0.51.0',
12 pkgconfig = import('pkgconfig')
13 cc = meson.get_compiler('c')
15 dir_libexec = get_option('prefix')/get_option('libexecdir')/'xkbcommon'
19 '-fno-strict-aliasing',
20 '-Wno-unused-parameter',
21 '-Wno-missing-field-initializers',
23 '-Wmissing-declarations',
25 '-Wstrict-prototypes',
26 '-Wmissing-prototypes',
28 '-Wbad-function-cast',
33 '-Wno-documentation-deprecated-sync',
35 add_project_arguments(cc.get_supported_arguments(cflags), language: 'c')
38 # The XKB config root.
39 XKBCONFIGROOT = get_option('xkb-config-root')
40 if XKBCONFIGROOT == ''
41 xkeyboard_config_dep = dependency('xkeyboard-config', required: false)
42 if xkeyboard_config_dep.found()
43 XKBCONFIGROOT = xkeyboard_config_dep.get_variable(pkgconfig: 'xkb_base')
45 XKBCONFIGROOT = get_option('prefix')/get_option('datadir')/'X11'/'xkb'
49 XKBCONFIGEXTRAPATH = get_option('xkb-config-extra-path')
50 if XKBCONFIGEXTRAPATH == ''
51 XKBCONFIGEXTRAPATH = get_option('prefix')/get_option('sysconfdir')/'xkb'
54 # The X locale directory for compose.
55 XLOCALEDIR = get_option('x-locale-root')
57 XLOCALEDIR = get_option('prefix')/get_option('datadir')/'X11'/'locale'
62 configh_data = configuration_data()
63 configh_data.set('EXIT_INVALID_USAGE', '2')
64 configh_data.set_quoted('LIBXKBCOMMON_VERSION', meson.project_version())
65 configh_data.set_quoted('LIBXKBCOMMON_TOOL_PATH', dir_libexec)
66 # Like AC_USE_SYSTEM_EXTENSIONS, what #define to use to get extensions
67 # beyond the base POSIX function set.
68 if host_machine.system() == 'sunos'
69 system_extensions = '__EXTENSIONS__'
71 system_extensions = '_GNU_SOURCE'
73 configh_data.set(system_extensions, 1)
74 system_ext_define = '#define ' + system_extensions
75 configh_data.set_quoted('DFLT_XKB_CONFIG_ROOT', XKBCONFIGROOT)
76 configh_data.set_quoted('DFLT_XKB_CONFIG_EXTRA_PATH', XKBCONFIGEXTRAPATH)
77 configh_data.set_quoted('XLOCALEDIR', XLOCALEDIR)
78 configh_data.set_quoted('DEFAULT_XKB_RULES', get_option('default-rules'))
79 configh_data.set_quoted('DEFAULT_XKB_MODEL', get_option('default-model'))
80 configh_data.set_quoted('DEFAULT_XKB_LAYOUT', get_option('default-layout'))
81 if get_option('default-variant') != ''
82 configh_data.set_quoted('DEFAULT_XKB_VARIANT', get_option('default-variant'))
84 configh_data.set('DEFAULT_XKB_VARIANT', 'NULL')
86 if get_option('default-options') != ''
87 configh_data.set_quoted('DEFAULT_XKB_OPTIONS', get_option('default-options'))
89 configh_data.set('DEFAULT_XKB_OPTIONS', 'NULL')
91 if cc.has_header('unistd.h')
92 configh_data.set('HAVE_UNISTD_H', 1)
94 if cc.links('int main(){if(__builtin_expect(1<0,0)){}}', name: '__builtin_expect')
95 configh_data.set('HAVE___BUILTIN_EXPECT', 1)
97 if cc.has_header_symbol('unistd.h', 'eaccess', prefix: system_ext_define)
98 configh_data.set('HAVE_EACCESS', 1)
100 if cc.has_header_symbol('unistd.h', 'euidaccess', prefix: system_ext_define)
101 configh_data.set('HAVE_EUIDACCESS', 1)
103 if cc.has_header_symbol('sys/mman.h', 'mmap')
104 configh_data.set('HAVE_MMAP', 1)
106 if cc.has_header_symbol('stdlib.h', 'mkostemp', prefix: system_ext_define)
107 configh_data.set('HAVE_MKOSTEMP', 1)
109 if cc.has_header_symbol('fcntl.h', 'posix_fallocate', prefix: system_ext_define)
110 configh_data.set('HAVE_POSIX_FALLOCATE', 1)
112 if cc.has_header_symbol('string.h', 'strndup', prefix: system_ext_define)
113 configh_data.set('HAVE_STRNDUP', 1)
115 if cc.has_header_symbol('stdio.h', 'asprintf', prefix: system_ext_define)
116 configh_data.set('HAVE_ASPRINTF', 1)
117 elif cc.has_header_symbol('stdio.h', 'vasprintf', prefix: system_ext_define)
118 configh_data.set('HAVE_VASPRINTF', 1)
120 if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix: system_ext_define)
121 configh_data.set('HAVE_SECURE_GETENV', 1)
122 elif cc.has_header_symbol('stdlib.h', '__secure_getenv', prefix: system_ext_define)
123 configh_data.set('HAVE___SECURE_GETENV', 1)
125 message('C library does not support secure_getenv, using getenv instead')
127 if not cc.has_header_symbol('limits.h', 'PATH_MAX', prefix: system_ext_define)
128 if host_machine.system() == 'windows'
129 # see https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation
130 configh_data.set('PATH_MAX', 260)
132 configh_data.set('PATH_MAX', 4096)
136 # Silence some security & deprecation warnings on MSVC
137 # for some unix/C functions we use.
138 # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=vs-2019
139 configh_data.set('_CRT_SECURE_NO_WARNINGS', 1)
140 configh_data.set('_CRT_NONSTDC_NO_WARNINGS', 1)
141 configh_data.set('_CRT_NONSTDC_NO_DEPRECATE', 1)
142 # Reduce unnecessary includes on MSVC.
143 configh_data.set('WIN32_LEAN_AND_MEAN', 1)
145 # Supports -Wl,--version-script?
146 have_version_script = cc.links(
148 args: '-Wl,--version-script=' + meson.current_source_dir()/'xkbcommon.map',
149 name: '-Wl,--version-script',
152 map_to_def = find_program('scripts/map-to-def')
155 # Note: we use some yacc extensions, which work with either GNU bison
156 # (preferred) or byacc (with backtracking enabled).
157 bison = find_program('bison', 'win_bison', required: false)
159 yacc_gen = generator(
161 output: ['@BASENAME@.c', '@BASENAME@.h'],
162 arguments: ['--defines=@OUTPUT1@', '-o', '@OUTPUT0@', '-p', '_xkbcommon_', '@INPUT@'],
165 byacc = find_program('byacc', required: false)
167 yacc_gen = generator(
169 output: ['@BASENAME@.c', '@BASENAME@.h'],
170 arguments: ['-H', '@OUTPUT1@', '-o', '@OUTPUT0@', '-p', '_xkbcommon_', '@INPUT@'],
173 error('Could not find a compatible YACC program (bison or byacc)')
176 libxkbcommon_sources = [
177 'src/compose/parser.c',
178 'src/compose/parser.h',
179 'src/compose/paths.c',
180 'src/compose/paths.h',
181 'src/compose/state.c',
182 'src/compose/table.c',
183 'src/compose/table.h',
184 'src/xkbcomp/action.c',
185 'src/xkbcomp/action.h',
187 'src/xkbcomp/ast-build.c',
188 'src/xkbcomp/ast-build.h',
189 'src/xkbcomp/compat.c',
190 'src/xkbcomp/expr.c',
191 'src/xkbcomp/expr.h',
192 'src/xkbcomp/include.c',
193 'src/xkbcomp/include.h',
194 'src/xkbcomp/keycodes.c',
195 'src/xkbcomp/keymap.c',
196 'src/xkbcomp/keymap-dump.c',
197 'src/xkbcomp/keywords.c',
198 yacc_gen.process('src/xkbcomp/parser.y'),
199 'src/xkbcomp/parser-priv.h',
200 'src/xkbcomp/rules.c',
201 'src/xkbcomp/rules.h',
202 'src/xkbcomp/scanner.c',
203 'src/xkbcomp/symbols.c',
204 'src/xkbcomp/types.c',
205 'src/xkbcomp/vmod.c',
206 'src/xkbcomp/vmod.h',
207 'src/xkbcomp/xkbcomp.c',
208 'src/xkbcomp/xkbcomp-priv.h',
213 'src/context-priv.c',
222 'src/scanner-utils.h',
231 libxkbcommon_link_args = []
232 libxkbcommon_link_deps = []
233 if have_version_script
234 libxkbcommon_link_args += '-Wl,--version-script=' + meson.current_source_dir()/'xkbcommon.map'
235 libxkbcommon_link_deps += 'xkbcommon.map'
236 elif cc.get_argument_syntax() == 'msvc'
237 libxkbcommon_def = custom_target('xkbcommon.def',
238 command: [map_to_def, '@INPUT@', '@OUTPUT@'],
239 input: 'xkbcommon.map',
240 output: 'kxbcommon.def',
242 libxkbcommon_link_deps += libxkbcommon_def
243 libxkbcommon_link_args += '/DEF:' + libxkbcommon_def.full_path()
245 libxkbcommon = library(
247 'include/xkbcommon/xkbcommon.h',
248 libxkbcommon_sources,
249 link_args: libxkbcommon_link_args,
250 link_depends: libxkbcommon_link_deps,
251 gnu_symbol_visibility: 'hidden',
254 include_directories: include_directories('src', 'include'),
257 'include/xkbcommon/xkbcommon.h',
258 'include/xkbcommon/xkbcommon-compat.h',
259 'include/xkbcommon/xkbcommon-compose.h',
260 'include/xkbcommon/xkbcommon-keysyms.h',
261 'include/xkbcommon/xkbcommon-names.h',
265 dep_libxkbcommon = declare_dependency(
266 link_with: libxkbcommon,
267 include_directories: include_directories('include'),
272 filebase: 'xkbcommon',
273 version: meson.project_version(),
274 description: 'XKB API common to servers and clients',
279 if get_option('enable-x11')
280 xcb_dep = dependency('xcb', version: '>=1.10', required: false)
281 xcb_xkb_dep = dependency('xcb-xkb', version: '>=1.10', required: false)
282 if not xcb_dep.found() or not xcb_xkb_dep.found()
283 error('''X11 support requires xcb-xkb >= 1.10 which was not found.
284 You can disable X11 support with -Denable-x11=false.''')
287 libxkbcommon_x11_sources = [
291 'src/x11/x11-priv.h',
293 'src/context-priv.c',
299 libxkbcommon_x11_link_args = []
300 libxkbcommon_x11_link_deps = []
301 if have_version_script
302 libxkbcommon_x11_link_args += '-Wl,--version-script=' + meson.current_source_dir()/'xkbcommon-x11.map'
303 libxkbcommon_x11_link_deps += 'xkbcommon-x11.map'
304 elif cc.get_argument_syntax() == 'msvc'
305 libxkbcommon_x11_def = custom_target('xkbcommon-x11.def',
306 command: [map_to_def, '@INPUT@', '@OUTPUT@'],
307 input: 'xkbcommon-x11.map',
308 output: 'xkbcommon-x11.def',
310 libxkbcommon_x11_link_deps += libxkbcommon_x11_def
311 libxkbcommon_x11_link_args += '/DEF:' + libxkbcommon_x11_def.full_path()
313 libxkbcommon_x11 = library(
315 'include/xkbcommon/xkbcommon-x11.h',
316 libxkbcommon_x11_sources,
317 link_args: libxkbcommon_x11_link_args,
318 link_depends: libxkbcommon_x11_link_deps,
319 gnu_symbol_visibility: 'hidden',
322 include_directories: include_directories('src', 'include'),
323 link_with: libxkbcommon,
330 'include/xkbcommon/xkbcommon-x11.h',
333 dep_libxkbcommon_x11 = declare_dependency(
334 link_with: libxkbcommon_x11,
335 include_directories: include_directories('include'),
339 name: 'xkbcommon-x11',
340 filebase: 'xkbcommon-x11',
341 version: meson.project_version(),
342 description: 'XKB API common to servers and clients - X11 support',
343 requires: ['xkbcommon'],
344 requires_private: ['xcb>=1.10', 'xcb-xkb>=1.10'],
349 if get_option('enable-xkbregistry')
350 dep_libxml = dependency('libxml-2.0')
351 deps_libxkbregistry = [dep_libxml]
352 libxkbregistry_sources = [
359 libxkbregistry_link_args = []
360 libxkbregistry_link_deps = []
361 if have_version_script
362 libxkbregistry_link_args += '-Wl,--version-script=' + meson.current_source_dir()/'xkbregistry.map'
363 libxkbregistry_link_deps += 'xkbregistry.map'
364 elif cc.get_argument_syntax() == 'msvc'
365 libxkbregistry_def = custom_target('xkbregistry.def',
366 command: [map_to_def, '@INPUT@', '@OUTPUT@'],
367 input: 'xkbregistry.map',
368 output: 'xkbregistry.def',
370 libxkbregistry_link_deps += libxkbregistry_def
371 libxkbregistry_link_args += '/DEF:' + libxkbregistry_def.full_path()
373 libxkbregistry = library(
375 'include/xkbcommon/xkbregistry.h',
376 libxkbregistry_sources,
377 link_args: libxkbregistry_link_args,
378 link_depends: libxkbregistry_link_deps,
379 gnu_symbol_visibility: 'hidden',
380 dependencies: deps_libxkbregistry,
383 include_directories: include_directories('src', 'include'),
386 'include/xkbcommon/xkbregistry.h',
392 filebase: 'xkbregistry',
393 version: meson.project_version(),
394 description: 'XKB API to query available rules, models, layouts, variants and options',
397 dep_libxkbregistry = declare_dependency(
398 link_with: libxkbregistry,
399 include_directories: include_directories('include'),
406 build_tools = get_option('enable-tools') and cc.has_header_symbol('getopt.h', 'getopt_long', prefix: '#define _GNU_SOURCE')
408 libxkbcommon_tools_internal = static_library(
410 'tools/tools-common.h',
411 'tools/tools-common.c',
412 dependencies: dep_libxkbcommon,
414 tools_dep = declare_dependency(
415 include_directories: [include_directories('tools', 'include')],
416 link_with: libxkbcommon_tools_internal,
419 executable('xkbcli', 'tools/xkbcli.c',
420 dependencies: tools_dep, install: true)
421 install_man('tools/xkbcli.1')
423 xkbcli_compile_keymap = executable('xkbcli-compile-keymap',
424 'tools/compile-keymap.c',
425 dependencies: tools_dep,
427 install_dir: dir_libexec)
428 install_man('tools/xkbcli-compile-keymap.1')
429 # The same tool again, but with access to some private APIs.
430 executable('compile-keymap',
431 'tools/compile-keymap.c',
432 libxkbcommon_sources,
433 dependencies: [tools_dep],
434 c_args: ['-DENABLE_PRIVATE_APIS'],
435 include_directories: [include_directories('src', 'include')],
437 executable('compose',
439 dependencies: tools_dep,
440 include_directories: [include_directories('src', 'include')],
442 configh_data.set10('HAVE_XKBCLI_COMPILE_KEYMAP', true)
443 executable('xkbcli-how-to-type',
444 'tools/how-to-type.c',
445 dependencies: tools_dep,
447 install_dir: dir_libexec)
448 install_man('tools/xkbcli-how-to-type.1')
449 configh_data.set10('HAVE_XKBCLI_HOW_TO_TYPE', true)
450 if cc.has_header('linux/input.h')
451 executable('xkbcli-interactive-evdev',
452 'tools/interactive-evdev.c',
453 dependencies: tools_dep,
455 install_dir: dir_libexec)
456 configh_data.set10('HAVE_XKBCLI_INTERACTIVE_EVDEV', true)
457 install_man('tools/xkbcli-interactive-evdev.1')
459 if get_option('enable-x11')
460 x11_tools_dep = declare_dependency(
461 link_with: libxkbcommon_x11,
468 executable('xkbcli-interactive-x11',
469 'tools/interactive-x11.c',
470 dependencies: x11_tools_dep,
472 install_dir: dir_libexec)
473 install_man('tools/xkbcli-interactive-x11.1')
474 configh_data.set10('HAVE_XKBCLI_INTERACTIVE_X11', true)
476 if get_option('enable-wayland')
477 wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: false)
478 wayland_protocols_dep = dependency('wayland-protocols', version: '>=1.12', required: false)
479 wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)
480 if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()
481 error('''The Wayland xkbcli programs require wayland-client >= 1.2.0, wayland-protocols >= 1.7 which were not found.
482 You can disable the Wayland xkbcli programs with -Denable-wayland=false.''')
485 wayland_scanner = find_program(wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner'))
486 wayland_scanner_code_gen = generator(
488 output: '@BASENAME@-protocol.c',
489 arguments: ['private-code', '@INPUT@', '@OUTPUT@'],
491 wayland_scanner_client_header_gen = generator(
493 output: '@BASENAME@-client-protocol.h',
494 arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
496 wayland_protocols_datadir = wayland_protocols_dep.get_variable(pkgconfig: 'pkgdatadir')
497 xdg_shell_xml = wayland_protocols_datadir/'stable/xdg-shell/xdg-shell.xml'
498 xdg_shell_sources = [
499 wayland_scanner_code_gen.process(xdg_shell_xml),
500 wayland_scanner_client_header_gen.process(xdg_shell_xml),
502 executable('xkbcli-interactive-wayland',
503 'tools/interactive-wayland.c',
505 dependencies: [tools_dep, wayland_client_dep],
507 install_dir: dir_libexec)
508 install_man('tools/xkbcli-interactive-wayland.1')
509 configh_data.set10('HAVE_XKBCLI_INTERACTIVE_WAYLAND', true)
512 if get_option('enable-xkbregistry')
513 configh_data.set10('HAVE_XKBCLI_LIST', true)
514 executable('xkbcli-list',
515 'tools/registry-list.c',
516 dependencies: dep_libxkbregistry,
518 install_dir: dir_libexec)
519 install_man('tools/xkbcli-list.1')
524 # xkeyboard-config "verifier"
525 xkct_config = configuration_data()
526 xkct_config.set('MESON_BUILD_ROOT', meson.current_build_dir())
527 xkct_config.set('XKB_CONFIG_ROOT', XKBCONFIGROOT)
528 configure_file(input: 'test/xkeyboard-config-test.py.in',
529 output: 'xkeyboard-config-test',
530 configuration: xkct_config)
533 test_env = environment()
534 test_env.set('XKB_LOG_LEVEL', 'debug')
535 test_env.set('XKB_LOG_VERBOSITY', '10')
536 test_env.set('top_srcdir', meson.current_source_dir())
537 test_env.set('top_builddir', meson.current_build_dir())
538 test_env.set('HAVE_XKBCLI_INTERACTIVE_EVDEV', configh_data.get('HAVE_XKBCLI_INTERACTIVE_EVDEV', 0).to_string())
539 test_env.set('HAVE_XKBCLI_INTERACTIVE_WAYLAND', configh_data.get('HAVE_XKBCLI_INTERACTIVE_WAYLAND', 0).to_string())
540 test_env.set('HAVE_XKBCLI_INTERACTIVE_X11', configh_data.get('HAVE_XKBCLI_INTERACTIVE_X11', 0).to_string())
541 test_env.set('HAVE_XKBCLI_LIST', configh_data.get('HAVE_XKBCLI_LIST', 0).to_string())
543 test_configh_data = configuration_data()
544 test_configh_data.set_quoted('TEST_XKB_CONFIG_ROOT', meson.current_source_dir()/'test'/'data')
545 configure_file(output: 'test-config.h', configuration: test_configh_data)
547 # Some tests need to use unexported symbols, so we link them against
548 # an internal copy of libxkbcommon with all symbols exposed.
549 libxkbcommon_test_internal = static_library(
550 'xkbcommon-test-internal',
553 'test/evdev-scancodes.h',
556 libxkbcommon_sources,
557 include_directories: include_directories('src', 'include'),
559 test_dep = declare_dependency(
560 include_directories: include_directories('src', 'include'),
561 link_with: libxkbcommon_test_internal,
563 if get_option('enable-x11')
564 libxkbcommon_x11_internal = static_library(
565 'xkbcommon-x11-internal',
566 libxkbcommon_x11_sources,
567 include_directories: include_directories('src', 'include'),
568 link_with: libxkbcommon_test_internal,
574 x11_test_dep = declare_dependency(
575 link_with: libxkbcommon_x11_internal,
585 executable('test-keysym', 'test/keysym.c', dependencies: test_dep),
590 executable('test-keymap', 'test/keymap.c', dependencies: test_dep),
595 executable('test-filecomp', 'test/filecomp.c', dependencies: test_dep),
600 executable('test-context', 'test/context.c', dependencies: test_dep),
605 executable('test-rules-file', 'test/rules-file.c', dependencies: test_dep),
609 'rules-file-includes',
610 executable('test-rules-file-includes', 'test/rules-file-includes.c', dependencies: test_dep),
615 executable('test-stringcomp', 'test/stringcomp.c', dependencies: test_dep),
620 executable('test-buffercomp', 'test/buffercomp.c', dependencies: test_dep),
625 executable('test-log', 'test/log.c', dependencies: test_dep),
630 executable('test-atom', 'test/atom.c', dependencies: test_dep),
635 executable('test-utf8', 'test/utf8.c', dependencies: test_dep),
640 executable('test-state', 'test/state.c', dependencies: test_dep),
645 executable('test-keyseq', 'test/keyseq.c', dependencies: test_dep),
650 executable('test-rulescomp', 'test/rulescomp.c', dependencies: test_dep),
655 executable('test-compose', 'test/compose.c', dependencies: test_dep),
660 executable('test-utils', 'test/utils.c', dependencies: test_dep),
665 find_program('test/symbols-leak-test.py'),
667 suite: ['python-tests'],
669 if get_option('enable-x11')
672 executable('test-x11', 'test/x11.c', dependencies: x11_test_dep),
675 # test/x11comp is meant to be run, but it is (temporarily?) disabled.
676 # See: https://github.com/xkbcommon/libxkbcommon/issues/30
677 executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep)
679 if get_option('enable-xkbregistry')
682 executable('test-registry', 'test/registry.c',
683 include_directories: include_directories('src'),
684 dependencies: [dep_libxkbregistry, test_dep]),
689 test('tool-option-parsing',
690 find_program('test/tool-option-parsing.py'),
692 suite: ['python-tests'])
694 # A set of keysyms to test for. Add one or two symbols to this array
695 # whenever the xorgproto gets updated to make sure we resolve them.
701 env.set('XKB_CONFIG_ROOT', meson.current_source_dir()/'test'/'data')
702 foreach keysym: keysyms_to_test
703 test('keysym-test-@0@'.format(keysym),
704 find_program('test/test-keysym.py'),
706 args: [keysym, '--tool', xkbcli_compile_keymap],
707 suite: ['python-tests'])
711 valgrind = find_program('valgrind', required: false)
713 add_test_setup('valgrind',
714 exe_wrapper: [valgrind,
716 '--track-origins=yes',
717 '--gen-suppressions=all',
718 '--error-exitcode=99'],
719 timeout_multiplier : 10)
721 message('valgrind not found, disabling valgrind test setup')
725 # Fuzzing target programs.
726 executable('fuzz-keymap', 'fuzz/keymap/target.c', dependencies: test_dep)
727 executable('fuzz-compose', 'fuzz/compose/target.c', dependencies: test_dep)
731 bench_env = environment()
732 bench_env.set('top_srcdir', meson.current_source_dir())
735 executable('bench-key-proc', 'bench/key-proc.c', dependencies: test_dep),
740 executable('bench-rules', 'bench/rules.c', dependencies: test_dep),
745 executable('bench-rulescomp', 'bench/rulescomp.c', dependencies: test_dep),
750 executable('bench-compose', 'bench/compose.c', dependencies: test_dep),
755 executable('bench-atom', 'bench/atom.c', dependencies: test_dep),
758 if get_option('enable-x11')
761 executable('bench-x11', 'bench/x11.c', dependencies: x11_test_dep),
768 if get_option('enable-docs')
769 doxygen = find_program('doxygen', required: false)
770 if not doxygen.found()
771 error('''Documentation requires doxygen which was not found.
772 You can disable the documentation with -Denable-docs=false.''')
774 doxygen_wrapper = find_program('scripts/doxygen-wrapper')
778 'doc/doxygen-extra.css',
779 'doc/quick-guide.md',
781 'doc/user-configuration.md',
782 'doc/rules-format.md',
783 'doc/keymap-format-text-v1.md',
784 'include/xkbcommon/xkbcommon.h',
785 'include/xkbcommon/xkbcommon-names.h',
786 'include/xkbcommon/xkbcommon-x11.h',
787 'include/xkbcommon/xkbcommon-compose.h',
788 'include/xkbcommon/xkbregistry.h',
790 doxygen_data = configuration_data()
791 doxygen_data.set('PACKAGE_NAME', meson.project_name())
792 doxygen_data.set('PACKAGE_VERSION', meson.project_version())
793 doxygen_data.set('INPUT', ' '.join(doxygen_input))
794 doxygen_data.set('OUTPUT_DIRECTORY', meson.current_build_dir())
795 doxyfile = configure_file(
796 input: 'doc/Doxyfile.in',
798 configuration: doxygen_data,
800 # TODO: Meson should provide this.
801 docdir = get_option('datadir')/'doc'/meson.project_name()
804 input: [doxyfile] + doxygen_input,
806 command: [doxygen_wrapper, doxygen, meson.current_build_dir()/'Doxyfile', meson.current_source_dir()],
809 build_by_default: true,
813 configure_file(output: 'config.h', configuration: configh_data)
816 # Stable variables for projects using xkbcommon as a subproject.
817 # These variables should not be renamed.
818 libxkbcommon_dep = dep_libxkbcommon
819 if get_option('enable-x11')
820 libxkbcommon_x11_dep = dep_libxkbcommon_x11
822 if get_option('enable-xkbregistry')
823 libxkbregistry_dep = dep_libxkbregistry