10 meson_version : '>= 0.52.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, version: '>= 2.3a')
160 yacc_gen = generator(
162 output: ['@BASENAME@.c', '@BASENAME@.h'],
163 arguments: ['--defines=@OUTPUT1@', '-o', '@OUTPUT0@', '-p', '_xkbcommon_', '@INPUT@'],
166 byacc = find_program('byacc', required: false)
169 yacc_gen = generator(
171 output: ['@BASENAME@.c', '@BASENAME@.h'],
172 arguments: ['-H', '@OUTPUT1@', '-o', '@OUTPUT0@', '-p', '_xkbcommon_', '@INPUT@'],
175 error('Could not find a compatible YACC program (bison or byacc)')
178 libxkbcommon_sources = [
179 'src/compose/parser.c',
180 'src/compose/parser.h',
181 'src/compose/paths.c',
182 'src/compose/paths.h',
183 'src/compose/state.c',
184 'src/compose/table.c',
185 'src/compose/table.h',
186 'src/xkbcomp/action.c',
187 'src/xkbcomp/action.h',
189 'src/xkbcomp/ast-build.c',
190 'src/xkbcomp/ast-build.h',
191 'src/xkbcomp/compat.c',
192 'src/xkbcomp/expr.c',
193 'src/xkbcomp/expr.h',
194 'src/xkbcomp/include.c',
195 'src/xkbcomp/include.h',
196 'src/xkbcomp/keycodes.c',
197 'src/xkbcomp/keymap.c',
198 'src/xkbcomp/keymap-dump.c',
199 'src/xkbcomp/keywords.c',
200 yacc_gen.process('src/xkbcomp/parser.y'),
201 'src/xkbcomp/parser-priv.h',
202 'src/xkbcomp/rules.c',
203 'src/xkbcomp/rules.h',
204 'src/xkbcomp/scanner.c',
205 'src/xkbcomp/symbols.c',
206 'src/xkbcomp/types.c',
207 'src/xkbcomp/vmod.c',
208 'src/xkbcomp/vmod.h',
209 'src/xkbcomp/xkbcomp.c',
210 'src/xkbcomp/xkbcomp-priv.h',
215 'src/context-priv.c',
224 'src/scanner-utils.h',
233 libxkbcommon_link_args = []
234 libxkbcommon_link_deps = []
235 if have_version_script
236 libxkbcommon_link_args += '-Wl,--version-script=' + meson.current_source_dir()/'xkbcommon.map'
237 libxkbcommon_link_deps += 'xkbcommon.map'
238 elif cc.get_argument_syntax() == 'msvc'
239 libxkbcommon_def = custom_target('xkbcommon.def',
240 command: [map_to_def, '@INPUT@', '@OUTPUT@'],
241 input: 'xkbcommon.map',
242 output: 'kxbcommon.def',
244 libxkbcommon_link_deps += libxkbcommon_def
245 libxkbcommon_link_args += '/DEF:' + libxkbcommon_def.full_path()
247 libxkbcommon = library(
249 'include/xkbcommon/xkbcommon.h',
250 libxkbcommon_sources,
251 link_args: libxkbcommon_link_args,
252 link_depends: libxkbcommon_link_deps,
253 gnu_symbol_visibility: 'hidden',
256 include_directories: include_directories('src', 'include'),
259 'include/xkbcommon/xkbcommon.h',
260 'include/xkbcommon/xkbcommon-compat.h',
261 'include/xkbcommon/xkbcommon-compose.h',
262 'include/xkbcommon/xkbcommon-keysyms.h',
263 'include/xkbcommon/xkbcommon-names.h',
267 dep_libxkbcommon = declare_dependency(
268 link_with: libxkbcommon,
269 include_directories: include_directories('include'),
271 if meson.version().version_compare('>= 0.54.0')
272 meson.override_dependency('xkbcommon', dep_libxkbcommon)
277 filebase: 'xkbcommon',
278 version: meson.project_version(),
279 description: 'XKB API common to servers and clients',
284 if get_option('enable-x11')
285 xcb_dep = dependency('xcb', version: '>=1.10', required: false)
286 xcb_xkb_dep = dependency('xcb-xkb', version: '>=1.10', required: false)
287 if not xcb_dep.found() or not xcb_xkb_dep.found()
288 error('''X11 support requires xcb-xkb >= 1.10 which was not found.
289 You can disable X11 support with -Denable-x11=false.''')
292 libxkbcommon_x11_sources = [
296 'src/x11/x11-priv.h',
298 'src/context-priv.c',
304 libxkbcommon_x11_link_args = []
305 libxkbcommon_x11_link_deps = []
306 if have_version_script
307 libxkbcommon_x11_link_args += '-Wl,--version-script=' + meson.current_source_dir()/'xkbcommon-x11.map'
308 libxkbcommon_x11_link_deps += 'xkbcommon-x11.map'
309 elif cc.get_argument_syntax() == 'msvc'
310 libxkbcommon_x11_def = custom_target('xkbcommon-x11.def',
311 command: [map_to_def, '@INPUT@', '@OUTPUT@'],
312 input: 'xkbcommon-x11.map',
313 output: 'xkbcommon-x11.def',
315 libxkbcommon_x11_link_deps += libxkbcommon_x11_def
316 libxkbcommon_x11_link_args += '/DEF:' + libxkbcommon_x11_def.full_path()
318 libxkbcommon_x11 = library(
320 'include/xkbcommon/xkbcommon-x11.h',
321 libxkbcommon_x11_sources,
322 link_args: libxkbcommon_x11_link_args,
323 link_depends: libxkbcommon_x11_link_deps,
324 gnu_symbol_visibility: 'hidden',
327 include_directories: include_directories('src', 'include'),
328 link_with: libxkbcommon,
335 'include/xkbcommon/xkbcommon-x11.h',
338 dep_libxkbcommon_x11 = declare_dependency(
339 link_with: libxkbcommon_x11,
340 include_directories: include_directories('include'),
342 if meson.version().version_compare('>= 0.54.0')
343 meson.override_dependency('xkbcommon-x11', dep_libxkbcommon_x11)
347 name: 'xkbcommon-x11',
348 filebase: 'xkbcommon-x11',
349 version: meson.project_version(),
350 description: 'XKB API common to servers and clients - X11 support',
351 requires: ['xkbcommon'],
352 requires_private: ['xcb>=1.10', 'xcb-xkb>=1.10'],
357 if get_option('enable-xkbregistry')
358 dep_libxml = dependency('libxml-2.0')
359 deps_libxkbregistry = [dep_libxml]
360 libxkbregistry_sources = [
367 libxkbregistry_link_args = []
368 libxkbregistry_link_deps = []
369 if have_version_script
370 libxkbregistry_link_args += '-Wl,--version-script=' + meson.current_source_dir()/'xkbregistry.map'
371 libxkbregistry_link_deps += 'xkbregistry.map'
372 elif cc.get_argument_syntax() == 'msvc'
373 libxkbregistry_def = custom_target('xkbregistry.def',
374 command: [map_to_def, '@INPUT@', '@OUTPUT@'],
375 input: 'xkbregistry.map',
376 output: 'xkbregistry.def',
378 libxkbregistry_link_deps += libxkbregistry_def
379 libxkbregistry_link_args += '/DEF:' + libxkbregistry_def.full_path()
381 libxkbregistry = library(
383 'include/xkbcommon/xkbregistry.h',
384 libxkbregistry_sources,
385 link_args: libxkbregistry_link_args,
386 link_depends: libxkbregistry_link_deps,
387 gnu_symbol_visibility: 'hidden',
388 dependencies: deps_libxkbregistry,
391 include_directories: include_directories('src', 'include'),
394 'include/xkbcommon/xkbregistry.h',
400 filebase: 'xkbregistry',
401 version: meson.project_version(),
402 description: 'XKB API to query available rules, models, layouts, variants and options',
405 dep_libxkbregistry = declare_dependency(
406 link_with: libxkbregistry,
407 include_directories: include_directories('include'),
409 if meson.version().version_compare('>= 0.54.0')
410 meson.override_dependency('xkbregistry', dep_libxkbregistry)
417 build_tools = get_option('enable-tools') and cc.has_header_symbol('getopt.h', 'getopt_long', prefix: '#define _GNU_SOURCE')
419 libxkbcommon_tools_internal_sources = [
420 'tools/tools-common.h',
421 'tools/tools-common.c',
423 libxkbcommon_tools_internal = static_library(
425 libxkbcommon_tools_internal_sources,
426 dependencies: dep_libxkbcommon,
428 tools_dep = declare_dependency(
429 include_directories: [include_directories('tools', 'include')],
430 link_with: libxkbcommon_tools_internal,
431 dependencies: dep_libxkbcommon,
434 executable('xkbcli', 'tools/xkbcli.c',
435 dependencies: tools_dep, install: true)
436 install_man('tools/xkbcli.1')
438 xkbcli_compile_keymap = executable('xkbcli-compile-keymap',
439 'tools/compile-keymap.c',
440 dependencies: tools_dep,
442 install_dir: dir_libexec)
443 install_man('tools/xkbcli-compile-keymap.1')
444 # The same tool again, but with access to some private APIs.
445 executable('compile-keymap',
446 'tools/compile-keymap.c',
447 libxkbcommon_sources,
448 dependencies: [tools_dep],
449 c_args: ['-DENABLE_PRIVATE_APIS'],
450 include_directories: [include_directories('src', 'include')],
452 executable('compose',
454 dependencies: tools_dep,
455 include_directories: [include_directories('src', 'include')],
457 configh_data.set10('HAVE_XKBCLI_COMPILE_KEYMAP', true)
458 executable('xkbcli-how-to-type',
459 'tools/how-to-type.c',
460 dependencies: tools_dep,
462 install_dir: dir_libexec)
463 install_man('tools/xkbcli-how-to-type.1')
464 configh_data.set10('HAVE_XKBCLI_HOW_TO_TYPE', true)
465 if cc.has_header('linux/input.h')
466 executable('xkbcli-interactive-evdev',
467 'tools/interactive-evdev.c',
468 dependencies: tools_dep,
470 install_dir: dir_libexec)
471 configh_data.set10('HAVE_XKBCLI_INTERACTIVE_EVDEV', true)
472 install_man('tools/xkbcli-interactive-evdev.1')
473 # The same tool again, but with access to some private APIs.
474 executable('interactive-evdev',
475 'tools/interactive-evdev.c',
476 libxkbcommon_sources,
477 libxkbcommon_tools_internal_sources,
478 dependencies: [tools_dep],
479 c_args: ['-DENABLE_PRIVATE_APIS'],
480 include_directories: [include_directories('src', 'include')],
483 if get_option('enable-x11')
484 x11_tools_dep = declare_dependency(
485 link_with: libxkbcommon_x11,
492 executable('xkbcli-interactive-x11',
493 'tools/interactive-x11.c',
494 dependencies: x11_tools_dep,
496 install_dir: dir_libexec)
497 install_man('tools/xkbcli-interactive-x11.1')
498 configh_data.set10('HAVE_XKBCLI_INTERACTIVE_X11', true)
500 if get_option('enable-wayland')
501 wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: false)
502 wayland_protocols_dep = dependency('wayland-protocols', version: '>=1.12', required: false)
503 wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)
504 if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()
505 error('''The Wayland xkbcli programs require wayland-client >= 1.2.0, wayland-protocols >= 1.7 which were not found.
506 You can disable the Wayland xkbcli programs with -Denable-wayland=false.''')
509 wayland_scanner = find_program(wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner'))
510 wayland_scanner_code_gen = generator(
512 output: '@BASENAME@-protocol.c',
513 arguments: ['private-code', '@INPUT@', '@OUTPUT@'],
515 wayland_scanner_client_header_gen = generator(
517 output: '@BASENAME@-client-protocol.h',
518 arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
520 wayland_protocols_datadir = wayland_protocols_dep.get_variable(pkgconfig: 'pkgdatadir')
521 xdg_shell_xml = wayland_protocols_datadir/'stable/xdg-shell/xdg-shell.xml'
522 xdg_shell_sources = [
523 wayland_scanner_code_gen.process(xdg_shell_xml),
524 wayland_scanner_client_header_gen.process(xdg_shell_xml),
526 executable('xkbcli-interactive-wayland',
527 'tools/interactive-wayland.c',
529 dependencies: [tools_dep, wayland_client_dep],
531 install_dir: dir_libexec)
532 install_man('tools/xkbcli-interactive-wayland.1')
533 configh_data.set10('HAVE_XKBCLI_INTERACTIVE_WAYLAND', true)
536 if get_option('enable-xkbregistry')
537 configh_data.set10('HAVE_XKBCLI_LIST', true)
538 executable('xkbcli-list',
539 'tools/registry-list.c',
540 dependencies: dep_libxkbregistry,
542 install_dir: dir_libexec)
543 install_man('tools/xkbcli-list.1')
548 # xkeyboard-config "verifier"
549 xkct_config = configuration_data()
550 xkct_config.set('MESON_BUILD_ROOT', meson.current_build_dir())
551 xkct_config.set('XKB_CONFIG_ROOT', XKBCONFIGROOT)
552 configure_file(input: 'test/xkeyboard-config-test.py.in',
553 output: 'xkeyboard-config-test',
554 configuration: xkct_config)
557 test_env = environment()
558 test_env.set('XKB_LOG_LEVEL', 'debug')
559 test_env.set('XKB_LOG_VERBOSITY', '10')
560 test_env.set('top_srcdir', meson.current_source_dir())
561 test_env.set('top_builddir', meson.current_build_dir())
562 test_env.set('HAVE_XKBCLI_INTERACTIVE_EVDEV', configh_data.get('HAVE_XKBCLI_INTERACTIVE_EVDEV', 0).to_string())
563 test_env.set('HAVE_XKBCLI_INTERACTIVE_WAYLAND', configh_data.get('HAVE_XKBCLI_INTERACTIVE_WAYLAND', 0).to_string())
564 test_env.set('HAVE_XKBCLI_INTERACTIVE_X11', configh_data.get('HAVE_XKBCLI_INTERACTIVE_X11', 0).to_string())
565 test_env.set('HAVE_XKBCLI_LIST', configh_data.get('HAVE_XKBCLI_LIST', 0).to_string())
567 test_configh_data = configuration_data()
568 test_configh_data.set_quoted('TEST_XKB_CONFIG_ROOT', meson.current_source_dir()/'test'/'data')
569 configure_file(output: 'test-config.h', configuration: test_configh_data)
571 # Some tests need to use unexported symbols, so we link them against
572 # an internal copy of libxkbcommon with all symbols exposed.
573 libxkbcommon_test_internal = static_library(
574 'xkbcommon-test-internal',
577 'test/evdev-scancodes.h',
580 libxkbcommon_sources,
581 include_directories: include_directories('src', 'include'),
583 test_dep = declare_dependency(
584 include_directories: include_directories('src', 'include'),
585 link_with: libxkbcommon_test_internal,
587 if get_option('enable-x11')
588 libxkbcommon_x11_test_internal = static_library(
589 'xkbcommon-x11-internal',
590 libxkbcommon_x11_sources,
591 'test/xvfb-wrapper.c',
592 'test/xvfb-wrapper.h',
593 include_directories: include_directories('src', 'include'),
594 link_with: libxkbcommon_test_internal,
600 x11_test_dep = declare_dependency(
601 link_with: libxkbcommon_x11_test_internal,
611 executable('test-keysym', 'test/keysym.c', dependencies: test_dep),
616 executable('test-keymap', 'test/keymap.c', dependencies: test_dep),
621 executable('test-filecomp', 'test/filecomp.c', dependencies: test_dep),
626 executable('test-context', 'test/context.c', dependencies: test_dep),
631 executable('test-rules-file', 'test/rules-file.c', dependencies: test_dep),
635 'rules-file-includes',
636 executable('test-rules-file-includes', 'test/rules-file-includes.c', dependencies: test_dep),
641 executable('test-stringcomp', 'test/stringcomp.c', dependencies: test_dep),
646 executable('test-buffercomp', 'test/buffercomp.c', dependencies: test_dep),
651 executable('test-log', 'test/log.c', dependencies: test_dep),
656 executable('test-atom', 'test/atom.c', dependencies: test_dep),
661 executable('test-utf8', 'test/utf8.c', dependencies: test_dep),
666 executable('test-state', 'test/state.c', dependencies: test_dep),
671 executable('test-keyseq', 'test/keyseq.c', dependencies: test_dep),
676 executable('test-rulescomp', 'test/rulescomp.c', dependencies: test_dep),
681 executable('test-compose', 'test/compose.c', dependencies: test_dep),
686 executable('test-utils', 'test/utils.c', dependencies: test_dep),
691 find_program('test/symbols-leak-test.py'),
693 suite: ['python-tests'],
697 executable('test-modifiers', 'test/modifiers.c', dependencies: test_dep),
700 if get_option('enable-x11')
703 executable('test-x11', 'test/x11.c', dependencies: x11_test_dep),
708 executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep),
712 if get_option('enable-xkbregistry')
715 executable('test-registry', 'test/registry.c',
716 include_directories: include_directories('src'),
717 dependencies: [dep_libxkbregistry, test_dep]),
722 test('tool-option-parsing',
723 find_program('test/tool-option-parsing.py'),
725 suite: ['python-tests'])
727 # A set of keysyms to test for. Add one or two symbols to this array
728 # whenever the xorgproto gets updated to make sure we resolve them.
734 env.set('XKB_CONFIG_ROOT', meson.current_source_dir()/'test'/'data')
735 foreach keysym: keysyms_to_test
736 test('keysym-test-@0@'.format(keysym),
737 find_program('test/test-keysym.py'),
739 args: [keysym, '--tool', xkbcli_compile_keymap],
740 suite: ['python-tests'])
744 valgrind = find_program('valgrind', required: false)
746 add_test_setup('valgrind',
747 exe_wrapper: [valgrind,
749 '--track-origins=yes',
750 '--gen-suppressions=all',
751 '--error-exitcode=99'],
752 timeout_multiplier : 10)
754 message('valgrind not found, disabling valgrind test setup')
758 # Fuzzing target programs.
759 executable('fuzz-keymap', 'fuzz/keymap/target.c', dependencies: test_dep)
760 executable('fuzz-compose', 'fuzz/compose/target.c', dependencies: test_dep)
764 bench_env = environment()
765 bench_env.set('top_srcdir', meson.current_source_dir())
768 executable('bench-key-proc', 'bench/key-proc.c', dependencies: test_dep),
773 executable('bench-rules', 'bench/rules.c', dependencies: test_dep),
778 executable('bench-rulescomp', 'bench/rulescomp.c', dependencies: test_dep),
783 executable('bench-compose', 'bench/compose.c', dependencies: test_dep),
788 executable('bench-atom', 'bench/atom.c', dependencies: test_dep),
791 if get_option('enable-x11')
794 executable('bench-x11', 'bench/x11.c', dependencies: x11_test_dep),
801 if get_option('enable-docs')
802 doxygen = find_program('doxygen', required: false)
803 if not doxygen.found()
804 error('''Documentation requires doxygen which was not found.
805 You can disable the documentation with -Denable-docs=false.''')
807 doxygen_wrapper = find_program('scripts/doxygen-wrapper')
811 'doc/diagrams/xkb-configuration.dot',
812 'doc/doxygen-extra.css',
813 'doc/introduction-to-xkb.md',
814 'doc/quick-guide.md',
815 'doc/compatibility.md',
816 'doc/user-configuration.md',
817 'doc/rules-format.md',
818 'doc/keymap-format-text-v1.md',
819 'include/xkbcommon/xkbcommon.h',
820 'include/xkbcommon/xkbcommon-compose.h',
821 'include/xkbcommon/xkbcommon-keysyms.h',
822 'include/xkbcommon/xkbcommon-names.h',
823 'include/xkbcommon/xkbcommon-x11.h',
824 'include/xkbcommon/xkbregistry.h',
826 doxygen_data = configuration_data()
827 doxygen_data.set('PACKAGE_NAME', meson.project_name())
828 doxygen_data.set('PACKAGE_VERSION', meson.project_version())
829 doxygen_data.set('INPUT', ' '.join(doxygen_input))
830 doxygen_data.set('OUTPUT_DIRECTORY', meson.current_build_dir())
831 doxyfile = configure_file(
832 input: 'doc/Doxyfile.in',
834 configuration: doxygen_data,
836 # TODO: Meson should provide this.
837 docdir = get_option('datadir')/'doc'/meson.project_name()
838 doc_gen = custom_target(
840 input: [doxyfile] + doxygen_input,
845 meson.current_build_dir()/'Doxyfile',
846 meson.current_source_dir(),
850 build_by_default: true,
852 if get_option('enable-cool-uris')
853 ensure_stable_urls = find_program('scripts'/'ensure-stable-doc-urls.py')
856 input: [doc_gen, 'doc'/'cool-uris.yaml'],
860 'generate-redirections',
861 meson.current_source_dir()/'doc'/'cool-uris.yaml',
862 meson.current_build_dir()/'html'
865 build_by_default: true,
870 configure_file(output: 'config.h', configuration: configh_data)
873 # Stable variables for projects using xkbcommon as a subproject.
874 # These variables should not be renamed.
875 libxkbcommon_dep = dep_libxkbcommon
876 if get_option('enable-x11')
877 libxkbcommon_x11_dep = dep_libxkbcommon_x11
879 if get_option('enable-xkbregistry')
880 libxkbregistry_dep = dep_libxkbregistry
883 if meson.version().version_compare('>=0.62.0')
885 'backend': meson.backend(),
886 'buildtype': get_option('buildtype'),
887 'c_args': get_option('c_args'),
888 'c_link_args': get_option('c_link_args'),
889 'yacc': yacc.full_path() + ' ' + yacc.version(),
890 }, section: 'Compiler')
892 'prefix': get_option('prefix'),
893 'bindir': get_option('bindir'),
894 'libdir': get_option('libdir'),
895 'datadir': get_option('datadir'),
896 'xkb-config-root': XKBCONFIGROOT,
897 'xkb-config-extra-path': XKBCONFIGEXTRAPATH,
898 'xlocaledir': XLOCALEDIR,
899 }, section: 'Directories')
901 'docs': get_option('enable-docs'),
902 'tools': get_option('enable-tools'),
903 'wayland': get_option('enable-wayland'),
904 'x11': get_option('enable-x11'),
905 }, section: 'Features')
907 'layout': get_option('default-layout'),
908 'model': get_option('default-model'),
909 'options': get_option('default-options'),
910 'rules': get_option('default-rules'),
911 'variant': get_option('default-variant'),
912 }, section: 'Defaults')