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'),
269 if meson.version().version_compare('>= 0.54.0')
270 meson.override_dependency('xkbcommon', dep_libxkbcommon)
275 filebase: 'xkbcommon',
276 version: meson.project_version(),
277 description: 'XKB API common to servers and clients',
282 if get_option('enable-x11')
283 xcb_dep = dependency('xcb', version: '>=1.10', required: false)
284 xcb_xkb_dep = dependency('xcb-xkb', version: '>=1.10', required: false)
285 if not xcb_dep.found() or not xcb_xkb_dep.found()
286 error('''X11 support requires xcb-xkb >= 1.10 which was not found.
287 You can disable X11 support with -Denable-x11=false.''')
290 libxkbcommon_x11_sources = [
294 'src/x11/x11-priv.h',
296 'src/context-priv.c',
302 libxkbcommon_x11_link_args = []
303 libxkbcommon_x11_link_deps = []
304 if have_version_script
305 libxkbcommon_x11_link_args += '-Wl,--version-script=' + meson.current_source_dir()/'xkbcommon-x11.map'
306 libxkbcommon_x11_link_deps += 'xkbcommon-x11.map'
307 elif cc.get_argument_syntax() == 'msvc'
308 libxkbcommon_x11_def = custom_target('xkbcommon-x11.def',
309 command: [map_to_def, '@INPUT@', '@OUTPUT@'],
310 input: 'xkbcommon-x11.map',
311 output: 'xkbcommon-x11.def',
313 libxkbcommon_x11_link_deps += libxkbcommon_x11_def
314 libxkbcommon_x11_link_args += '/DEF:' + libxkbcommon_x11_def.full_path()
316 libxkbcommon_x11 = library(
318 'include/xkbcommon/xkbcommon-x11.h',
319 libxkbcommon_x11_sources,
320 link_args: libxkbcommon_x11_link_args,
321 link_depends: libxkbcommon_x11_link_deps,
322 gnu_symbol_visibility: 'hidden',
325 include_directories: include_directories('src', 'include'),
326 link_with: libxkbcommon,
333 'include/xkbcommon/xkbcommon-x11.h',
336 dep_libxkbcommon_x11 = declare_dependency(
337 link_with: libxkbcommon_x11,
338 include_directories: include_directories('include'),
340 if meson.version().version_compare('>= 0.54.0')
341 meson.override_dependency('xkbcommon-x11', dep_libxkbcommon_x11)
345 name: 'xkbcommon-x11',
346 filebase: 'xkbcommon-x11',
347 version: meson.project_version(),
348 description: 'XKB API common to servers and clients - X11 support',
349 requires: ['xkbcommon'],
350 requires_private: ['xcb>=1.10', 'xcb-xkb>=1.10'],
355 if get_option('enable-xkbregistry')
356 dep_libxml = dependency('libxml-2.0')
357 deps_libxkbregistry = [dep_libxml]
358 libxkbregistry_sources = [
365 libxkbregistry_link_args = []
366 libxkbregistry_link_deps = []
367 if have_version_script
368 libxkbregistry_link_args += '-Wl,--version-script=' + meson.current_source_dir()/'xkbregistry.map'
369 libxkbregistry_link_deps += 'xkbregistry.map'
370 elif cc.get_argument_syntax() == 'msvc'
371 libxkbregistry_def = custom_target('xkbregistry.def',
372 command: [map_to_def, '@INPUT@', '@OUTPUT@'],
373 input: 'xkbregistry.map',
374 output: 'xkbregistry.def',
376 libxkbregistry_link_deps += libxkbregistry_def
377 libxkbregistry_link_args += '/DEF:' + libxkbregistry_def.full_path()
379 libxkbregistry = library(
381 'include/xkbcommon/xkbregistry.h',
382 libxkbregistry_sources,
383 link_args: libxkbregistry_link_args,
384 link_depends: libxkbregistry_link_deps,
385 gnu_symbol_visibility: 'hidden',
386 dependencies: deps_libxkbregistry,
389 include_directories: include_directories('src', 'include'),
392 'include/xkbcommon/xkbregistry.h',
398 filebase: 'xkbregistry',
399 version: meson.project_version(),
400 description: 'XKB API to query available rules, models, layouts, variants and options',
403 dep_libxkbregistry = declare_dependency(
404 link_with: libxkbregistry,
405 include_directories: include_directories('include'),
407 if meson.version().version_compare('>= 0.54.0')
408 meson.override_dependency('xkbregistry', dep_libxkbregistry)
415 build_tools = get_option('enable-tools') and cc.has_header_symbol('getopt.h', 'getopt_long', prefix: '#define _GNU_SOURCE')
417 libxkbcommon_tools_internal = static_library(
419 'tools/tools-common.h',
420 'tools/tools-common.c',
421 dependencies: dep_libxkbcommon,
423 tools_dep = declare_dependency(
424 include_directories: [include_directories('tools', 'include')],
425 link_with: libxkbcommon_tools_internal,
428 executable('xkbcli', 'tools/xkbcli.c',
429 dependencies: tools_dep, install: true)
430 install_man('tools/xkbcli.1')
432 xkbcli_compile_keymap = executable('xkbcli-compile-keymap',
433 'tools/compile-keymap.c',
434 dependencies: tools_dep,
436 install_dir: dir_libexec)
437 install_man('tools/xkbcli-compile-keymap.1')
438 # The same tool again, but with access to some private APIs.
439 executable('compile-keymap',
440 'tools/compile-keymap.c',
441 libxkbcommon_sources,
442 dependencies: [tools_dep],
443 c_args: ['-DENABLE_PRIVATE_APIS'],
444 include_directories: [include_directories('src', 'include')],
446 executable('compose',
448 dependencies: tools_dep,
449 include_directories: [include_directories('src', 'include')],
451 configh_data.set10('HAVE_XKBCLI_COMPILE_KEYMAP', true)
452 executable('xkbcli-how-to-type',
453 'tools/how-to-type.c',
454 dependencies: tools_dep,
456 install_dir: dir_libexec)
457 install_man('tools/xkbcli-how-to-type.1')
458 configh_data.set10('HAVE_XKBCLI_HOW_TO_TYPE', true)
459 if cc.has_header('linux/input.h')
460 executable('xkbcli-interactive-evdev',
461 'tools/interactive-evdev.c',
462 dependencies: tools_dep,
464 install_dir: dir_libexec)
465 configh_data.set10('HAVE_XKBCLI_INTERACTIVE_EVDEV', true)
466 install_man('tools/xkbcli-interactive-evdev.1')
468 if get_option('enable-x11')
469 x11_tools_dep = declare_dependency(
470 link_with: libxkbcommon_x11,
477 executable('xkbcli-interactive-x11',
478 'tools/interactive-x11.c',
479 dependencies: x11_tools_dep,
481 install_dir: dir_libexec)
482 install_man('tools/xkbcli-interactive-x11.1')
483 configh_data.set10('HAVE_XKBCLI_INTERACTIVE_X11', true)
485 if get_option('enable-wayland')
486 wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: false)
487 wayland_protocols_dep = dependency('wayland-protocols', version: '>=1.12', required: false)
488 wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)
489 if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()
490 error('''The Wayland xkbcli programs require wayland-client >= 1.2.0, wayland-protocols >= 1.7 which were not found.
491 You can disable the Wayland xkbcli programs with -Denable-wayland=false.''')
494 wayland_scanner = find_program(wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner'))
495 wayland_scanner_code_gen = generator(
497 output: '@BASENAME@-protocol.c',
498 arguments: ['private-code', '@INPUT@', '@OUTPUT@'],
500 wayland_scanner_client_header_gen = generator(
502 output: '@BASENAME@-client-protocol.h',
503 arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
505 wayland_protocols_datadir = wayland_protocols_dep.get_variable(pkgconfig: 'pkgdatadir')
506 xdg_shell_xml = wayland_protocols_datadir/'stable/xdg-shell/xdg-shell.xml'
507 xdg_shell_sources = [
508 wayland_scanner_code_gen.process(xdg_shell_xml),
509 wayland_scanner_client_header_gen.process(xdg_shell_xml),
511 executable('xkbcli-interactive-wayland',
512 'tools/interactive-wayland.c',
514 dependencies: [tools_dep, wayland_client_dep],
516 install_dir: dir_libexec)
517 install_man('tools/xkbcli-interactive-wayland.1')
518 configh_data.set10('HAVE_XKBCLI_INTERACTIVE_WAYLAND', true)
521 if get_option('enable-xkbregistry')
522 configh_data.set10('HAVE_XKBCLI_LIST', true)
523 executable('xkbcli-list',
524 'tools/registry-list.c',
525 dependencies: dep_libxkbregistry,
527 install_dir: dir_libexec)
528 install_man('tools/xkbcli-list.1')
533 # xkeyboard-config "verifier"
534 xkct_config = configuration_data()
535 xkct_config.set('MESON_BUILD_ROOT', meson.current_build_dir())
536 xkct_config.set('XKB_CONFIG_ROOT', XKBCONFIGROOT)
537 configure_file(input: 'test/xkeyboard-config-test.py.in',
538 output: 'xkeyboard-config-test',
539 configuration: xkct_config)
542 test_env = environment()
543 test_env.set('XKB_LOG_LEVEL', 'debug')
544 test_env.set('XKB_LOG_VERBOSITY', '10')
545 test_env.set('top_srcdir', meson.current_source_dir())
546 test_env.set('top_builddir', meson.current_build_dir())
547 test_env.set('HAVE_XKBCLI_INTERACTIVE_EVDEV', configh_data.get('HAVE_XKBCLI_INTERACTIVE_EVDEV', 0).to_string())
548 test_env.set('HAVE_XKBCLI_INTERACTIVE_WAYLAND', configh_data.get('HAVE_XKBCLI_INTERACTIVE_WAYLAND', 0).to_string())
549 test_env.set('HAVE_XKBCLI_INTERACTIVE_X11', configh_data.get('HAVE_XKBCLI_INTERACTIVE_X11', 0).to_string())
550 test_env.set('HAVE_XKBCLI_LIST', configh_data.get('HAVE_XKBCLI_LIST', 0).to_string())
552 test_configh_data = configuration_data()
553 test_configh_data.set_quoted('TEST_XKB_CONFIG_ROOT', meson.current_source_dir()/'test'/'data')
554 configure_file(output: 'test-config.h', configuration: test_configh_data)
556 # Some tests need to use unexported symbols, so we link them against
557 # an internal copy of libxkbcommon with all symbols exposed.
558 libxkbcommon_test_internal = static_library(
559 'xkbcommon-test-internal',
562 'test/evdev-scancodes.h',
565 libxkbcommon_sources,
566 include_directories: include_directories('src', 'include'),
568 test_dep = declare_dependency(
569 include_directories: include_directories('src', 'include'),
570 link_with: libxkbcommon_test_internal,
572 if get_option('enable-x11')
573 libxkbcommon_x11_internal = static_library(
574 'xkbcommon-x11-internal',
575 libxkbcommon_x11_sources,
576 include_directories: include_directories('src', 'include'),
577 link_with: libxkbcommon_test_internal,
583 x11_test_dep = declare_dependency(
584 link_with: libxkbcommon_x11_internal,
594 executable('test-keysym', 'test/keysym.c', dependencies: test_dep),
599 executable('test-keymap', 'test/keymap.c', dependencies: test_dep),
604 executable('test-filecomp', 'test/filecomp.c', dependencies: test_dep),
609 executable('test-context', 'test/context.c', dependencies: test_dep),
614 executable('test-rules-file', 'test/rules-file.c', dependencies: test_dep),
618 'rules-file-includes',
619 executable('test-rules-file-includes', 'test/rules-file-includes.c', dependencies: test_dep),
624 executable('test-stringcomp', 'test/stringcomp.c', dependencies: test_dep),
629 executable('test-buffercomp', 'test/buffercomp.c', dependencies: test_dep),
634 executable('test-log', 'test/log.c', dependencies: test_dep),
639 executable('test-atom', 'test/atom.c', dependencies: test_dep),
644 executable('test-utf8', 'test/utf8.c', dependencies: test_dep),
649 executable('test-state', 'test/state.c', dependencies: test_dep),
654 executable('test-keyseq', 'test/keyseq.c', dependencies: test_dep),
659 executable('test-rulescomp', 'test/rulescomp.c', dependencies: test_dep),
664 executable('test-compose', 'test/compose.c', dependencies: test_dep),
669 executable('test-utils', 'test/utils.c', dependencies: test_dep),
674 find_program('test/symbols-leak-test.py'),
676 suite: ['python-tests'],
680 executable('test-modifiers', 'test/modifiers.c', dependencies: test_dep),
683 if get_option('enable-x11')
686 executable('test-x11', 'test/x11.c', dependencies: x11_test_dep),
689 # test/x11comp is meant to be run, but it is (temporarily?) disabled.
690 # See: https://github.com/xkbcommon/libxkbcommon/issues/30
691 executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep)
693 if get_option('enable-xkbregistry')
696 executable('test-registry', 'test/registry.c',
697 include_directories: include_directories('src'),
698 dependencies: [dep_libxkbregistry, test_dep]),
703 test('tool-option-parsing',
704 find_program('test/tool-option-parsing.py'),
706 suite: ['python-tests'])
708 # A set of keysyms to test for. Add one or two symbols to this array
709 # whenever the xorgproto gets updated to make sure we resolve them.
715 env.set('XKB_CONFIG_ROOT', meson.current_source_dir()/'test'/'data')
716 foreach keysym: keysyms_to_test
717 test('keysym-test-@0@'.format(keysym),
718 find_program('test/test-keysym.py'),
720 args: [keysym, '--tool', xkbcli_compile_keymap],
721 suite: ['python-tests'])
725 valgrind = find_program('valgrind', required: false)
727 add_test_setup('valgrind',
728 exe_wrapper: [valgrind,
730 '--track-origins=yes',
731 '--gen-suppressions=all',
732 '--error-exitcode=99'],
733 timeout_multiplier : 10)
735 message('valgrind not found, disabling valgrind test setup')
739 # Fuzzing target programs.
740 executable('fuzz-keymap', 'fuzz/keymap/target.c', dependencies: test_dep)
741 executable('fuzz-compose', 'fuzz/compose/target.c', dependencies: test_dep)
745 bench_env = environment()
746 bench_env.set('top_srcdir', meson.current_source_dir())
749 executable('bench-key-proc', 'bench/key-proc.c', dependencies: test_dep),
754 executable('bench-rules', 'bench/rules.c', dependencies: test_dep),
759 executable('bench-rulescomp', 'bench/rulescomp.c', dependencies: test_dep),
764 executable('bench-compose', 'bench/compose.c', dependencies: test_dep),
769 executable('bench-atom', 'bench/atom.c', dependencies: test_dep),
772 if get_option('enable-x11')
775 executable('bench-x11', 'bench/x11.c', dependencies: x11_test_dep),
782 if get_option('enable-docs')
783 doxygen = find_program('doxygen', required: false)
784 if not doxygen.found()
785 error('''Documentation requires doxygen which was not found.
786 You can disable the documentation with -Denable-docs=false.''')
788 doxygen_wrapper = find_program('scripts/doxygen-wrapper')
792 'doc/doxygen-extra.css',
793 'doc/quick-guide.md',
795 'doc/user-configuration.md',
796 'doc/rules-format.md',
797 'doc/keymap-format-text-v1.md',
798 'include/xkbcommon/xkbcommon.h',
799 'include/xkbcommon/xkbcommon-compose.h',
800 'include/xkbcommon/xkbcommon-keysyms.h',
801 'include/xkbcommon/xkbcommon-names.h',
802 'include/xkbcommon/xkbcommon-x11.h',
803 'include/xkbcommon/xkbregistry.h',
805 doxygen_data = configuration_data()
806 doxygen_data.set('PACKAGE_NAME', meson.project_name())
807 doxygen_data.set('PACKAGE_VERSION', meson.project_version())
808 doxygen_data.set('INPUT', ' '.join(doxygen_input))
809 doxygen_data.set('OUTPUT_DIRECTORY', meson.current_build_dir())
810 doxyfile = configure_file(
811 input: 'doc/Doxyfile.in',
813 configuration: doxygen_data,
815 # TODO: Meson should provide this.
816 docdir = get_option('datadir')/'doc'/meson.project_name()
819 input: [doxyfile] + doxygen_input,
821 command: [doxygen_wrapper, doxygen, meson.current_build_dir()/'Doxyfile', meson.current_source_dir()],
824 build_by_default: true,
828 configure_file(output: 'config.h', configuration: configh_data)
831 # Stable variables for projects using xkbcommon as a subproject.
832 # These variables should not be renamed.
833 libxkbcommon_dep = dep_libxkbcommon
834 if get_option('enable-x11')
835 libxkbcommon_x11_dep = dep_libxkbcommon_x11
837 if get_option('enable-xkbregistry')
838 libxkbregistry_dep = dep_libxkbregistry