1 project('libinput', 'c',
4 default_options : [ 'c_std=gnu99', 'warning_level=2' ],
5 meson_version : '>= 0.49.0')
7 libinput_version = meson.project_version().split('.')
9 dir_data = get_option('prefix') / get_option('datadir') / 'libinput'
10 dir_etc = get_option('prefix') / get_option('sysconfdir')
11 dir_overrides = get_option('prefix') / get_option('sysconfdir') / 'libinput'
12 dir_libexec = get_option('prefix') / get_option('libexecdir') / 'libinput'
13 dir_lib = get_option('prefix') / get_option('libdir')
14 dir_man1 = get_option('prefix') / get_option('mandir') / 'man1'
15 dir_system_udev = get_option('prefix') / 'lib' / 'udev'
16 dir_src_quirks = meson.current_source_dir() / 'quirks'
17 dir_src_test = meson.current_source_dir() / 'test'
18 dir_src = meson.current_source_dir() / 'src'
19 dir_gitlab_ci = meson.current_source_dir() / '.gitlab-ci'
21 dir_udev = get_option('udev-dir')
23 dir_udev = dir_system_udev
25 dir_udev_callouts = dir_udev
26 dir_udev_rules = dir_udev / 'rules.d'
28 # Collection of man pages, we'll append to that
31 # We use libtool-version numbers because it's easier to understand.
32 # Before making a release, the libinput_so_*
33 # numbers should be modified. The components are of the form C:R:A.
34 # a) If binary compatibility has been broken (eg removed or changed interfaces)
36 # b) If interfaces have been changed or added, but binary compatibility has
37 # been preserved, change to C+1:0:A+1
38 # c) If the interface is the same as the previous version, change to C:R+1:A
44 libinput_so_version = '@0@.@1@.@2@'.format((libinput_lt_c - libinput_lt_a),
45 libinput_lt_a, libinput_lt_r)
48 cc = meson.get_compiler('c')
50 '-Wno-unused-parameter',
51 '-Wmissing-prototypes',
52 '-Wstrict-prototypes',
58 '-Wstrict-prototypes',
59 '-Wimplicit-fallthrough',
61 '-Wincompatible-pointer-types',
63 '-Wno-missing-field-initializers',
64 '-Wmissing-declarations',
66 '-fvisibility=hidden',
68 add_project_arguments(cc.get_supported_arguments(cflags), language : 'c')
71 config_h = configuration_data()
73 doc_url_base = 'https://wayland.freedesktop.org/libinput/doc'
74 if libinput_version[2].to_int() >= 90
75 doc_url = '@0@/latest'.format(doc_url_base)
77 doc_url = '@0@/@1@'.format(doc_url_base, meson.project_version())
79 config_h.set_quoted('HTTP_DOC_LINK', doc_url)
81 config_h.set('_GNU_SOURCE', '1')
82 if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
83 config_h.set_quoted('MESON_BUILD_ROOT', meson.current_build_dir())
85 config_h.set_quoted('MESON_BUILD_ROOT', '')
88 prefix = '''#define _GNU_SOURCE 1
91 if cc.get_define('static_assert', prefix : prefix) == ''
92 config_h.set('static_assert(...)', '/* */')
95 # Coverity breaks because it doesn't define _Float128 correctly, you'll end
96 # up with a bunch of messages in the form:
97 # "/usr/include/stdlib.h", line 133: error #20: identifier "_Float128" is
99 # extern _Float128 strtof128 (const char *__restrict __nptr,
101 # We don't use float128 ourselves, it gets pulled in from math.h or
102 # something, so let's just define it as uint128 and move on.
103 # Unfortunately we can't detect the coverity build at meson configure
104 # time, we only know it fails at runtime. So make this an option instead, to
105 # be removed when coverity fixes this again.
106 if get_option('coverity')
107 config_h.set('_Float128', '__uint128_t')
108 config_h.set('_Float32', 'int')
109 config_h.set('_Float32x', 'int')
110 config_h.set('_Float64', 'long')
111 config_h.set('_Float64x', 'long')
114 if cc.has_header_symbol('dirent.h', 'versionsort', prefix : prefix)
115 config_h.set('HAVE_VERSIONSORT', '1')
118 if not cc.has_header_symbol('errno.h', 'program_invocation_short_name', prefix : prefix)
119 if cc.has_header_symbol('stdlib.h', 'getprogname')
120 config_h.set('program_invocation_short_name', 'getprogname()')
124 if cc.has_header('xlocale.h')
125 config_h.set('HAVE_XLOCALE_H', '1')
130 void main(void) { newlocale(LC_NUMERIC_MASK, "C", (locale_t)0); }
132 if cc.links(code, name : 'locale.h')
133 config_h.set('HAVE_LOCALE_H', '1')
136 if not cc.has_header_symbol('sys/ptrace.h', 'PTRACE_ATTACH', prefix : prefix)
137 config_h.set('PTRACE_ATTACH', 'PT_ATTACH')
138 config_h.set('PTRACE_CONT', 'PT_CONTINUE')
139 config_h.set('PTRACE_DETACH', 'PT_DETACH')
142 config_h.set10('HAVE_INSTALLED_TESTS', get_option('install-tests'))
145 pkgconfig = import('pkgconfig')
146 dep_udev = dependency('libudev')
147 dep_mtdev = dependency('mtdev', version : '>= 1.1.0')
148 dep_libevdev = dependency('libevdev')
149 config_h.set10('HAVE_LIBEVDEV_DISABLE_PROPERTY',
150 dep_libevdev.version().version_compare('>= 1.9.902'))
152 dep_lm = cc.find_library('m', required : false)
153 dep_rt = cc.find_library('rt', required : false)
155 # Include directories
156 includes_include = include_directories('include')
157 includes_src = include_directories('src')
159 ############ libwacom configuration ############
161 have_libwacom = get_option('libwacom')
162 config_h.set10('HAVE_LIBWACOM', have_libwacom)
164 dep_libwacom = dependency('libwacom', version : '>= 0.27')
166 dep_libwacom = declare_dependency()
169 ############ udev bits ############
171 executable('libinput-device-group',
172 'udev/libinput-device-group.c',
173 dependencies : [dep_udev, dep_libwacom],
174 include_directories : [includes_src, includes_include],
176 install_dir : dir_udev_callouts)
177 executable('libinput-fuzz-extract',
178 'udev/libinput-fuzz-extract.c',
179 'src/util-strings.c',
180 'src/util-prop-parsers.c',
181 dependencies : [dep_udev, dep_libevdev, dep_lm],
182 include_directories : [includes_src, includes_include],
184 install_dir : dir_udev_callouts)
185 executable('libinput-fuzz-to-zero',
186 'udev/libinput-fuzz-to-zero.c',
187 dependencies : [dep_udev, dep_libevdev],
188 include_directories : [includes_src, includes_include],
190 install_dir : dir_udev_callouts)
192 udev_rules_config = configuration_data()
193 udev_rules_config.set('UDEV_TEST_PATH', '')
194 configure_file(input : 'udev/80-libinput-device-groups.rules.in',
195 output : '80-libinput-device-groups.rules',
196 install_dir : dir_udev_rules,
197 configuration : udev_rules_config)
198 configure_file(input : 'udev/90-libinput-fuzz-override.rules.in',
199 output : '90-libinput-fuzz-override.rules',
200 install_dir : dir_udev_rules,
201 configuration : udev_rules_config)
203 litest_udev_rules_config = configuration_data()
204 litest_udev_rules_config.set('UDEV_TEST_PATH', meson.current_build_dir() + '/')
205 litest_groups_rules_file = configure_file(input : 'udev/80-libinput-device-groups.rules.in',
206 output : '80-libinput-device-groups-litest.rules',
207 configuration : litest_udev_rules_config)
208 litest_fuzz_override_file = configure_file(input : 'udev/90-libinput-fuzz-override.rules.in',
209 output : '90-libinput-fuzz-override-litest.rules',
210 configuration : litest_udev_rules_config)
212 ############ Check for leftover udev rules ########
214 # This test should be defined first so we don't waste time testing anything
215 # else if we're about to fail anyway. ninja test will execute tests in the
216 # order of them defined in meson.build
218 if get_option('tests')
219 test('leftover-rules',
220 find_program('test/check-leftover-udev-rules.sh'),
225 ############ libepoll-shim (BSD) ############
227 if cc.has_header_symbol('sys/epoll.h', 'epoll_create1', prefix : prefix)
228 # epoll is built-in (Linux, illumos)
229 dep_libepoll = declare_dependency()
231 # epoll is implemented in userspace by libepoll-shim (FreeBSD)
232 dir_libepoll = get_option('epoll-dir')
233 if dir_libepoll == ''
234 dir_libepoll = get_option('prefix')
236 includes_epoll = include_directories(dir_libepoll / 'include' / 'libepoll-shim')
237 dep_libepoll = cc.find_library('epoll-shim', dirs : dir_libepoll / 'lib')
239 #include <sys/epoll.h>
240 int main(void) { epoll_create1(0); }
242 if not cc.links(code,
243 name : 'libepoll-shim check',
244 dependencies : [dep_libepoll, dep_rt],
245 include_directories : includes_epoll) # note: wants an include_directories object
246 error('No built-in epoll or libepoll-shim found.')
248 dep_libepoll = declare_dependency(
249 include_directories : includes_epoll,
250 dependencies : [dep_libepoll, dep_rt])
253 ############ libinput-util.a ############
255 # Basic compilation test to make sure the headers include and define all the
259 'util-input-event.h',
263 'util-prop-parsers.h',
268 foreach h: util_headers
269 c = configuration_data()
270 c.set_quoted('FILE', h)
271 testfile = configure_file(input : 'test/test-util-includes.c',
272 output : 'test-util-includes-@0@.c'.format(h),
274 executable('test-build-@0@'.format(h),
276 include_directories : [includes_src, includes_include],
280 src_libinput_util = [
282 'src/util-ratelimit.c',
283 'src/util-strings.c',
284 'src/util-prop-parsers.c',
286 libinput_util = static_library('libinput-util',
288 dependencies : [dep_udev, dep_libevdev, dep_libwacom],
289 include_directories : includes_include)
290 dep_libinput_util = declare_dependency(link_with : libinput_util)
292 ############ libfilter.a ############
296 'src/filter-low-dpi.c',
297 'src/filter-mouse.c',
298 'src/filter-touchpad.c',
299 'src/filter-touchpad-flat.c',
300 'src/filter-touchpad-x230.c',
301 'src/filter-tablet.c',
302 'src/filter-trackpoint.c',
303 'src/filter-trackpoint-flat.c',
305 libfilter = static_library('filter', src_libfilter,
306 dependencies : [dep_udev, dep_libwacom],
307 include_directories : includes_include)
308 dep_libfilter = declare_dependency(link_with : libfilter)
310 ############ libquirks.a #############
311 libinput_data_path = dir_data
312 libinput_data_override_path = dir_overrides / 'local-overrides.quirks'
313 config_h.set_quoted('LIBINPUT_QUIRKS_DIR', dir_data)
314 config_h.set_quoted('LIBINPUT_QUIRKS_OVERRIDE_FILE', libinput_data_override_path)
316 config_h.set_quoted('LIBINPUT_QUIRKS_SRCDIR', dir_src_quirks)
317 install_subdir('quirks',
318 exclude_files: ['README.md'],
319 install_dir : dir_data,
320 strip_directory : true)
326 deps_libquirks = [dep_udev, dep_libwacom, dep_libinput_util]
327 libquirks = static_library('quirks', src_libquirks,
328 dependencies : deps_libquirks,
329 include_directories : includes_include)
330 dep_libquirks = declare_dependency(link_with : libquirks)
332 # Create /etc/libinput
333 if meson.version().version_compare('>= 0.60')
334 install_emptydir(dir_etc / 'libinput')
336 install_subdir('libinput', install_dir : dir_etc)
339 ############ libinput.so ############
340 install_headers('src/libinput.h')
341 src_libinput = src_libfilter + [
343 'src/libinput-private-config.c',
345 'src/evdev-debounce.c',
346 'src/evdev-fallback.c',
348 'src/evdev-middle-button.c',
349 'src/evdev-mt-touchpad.c',
350 'src/evdev-mt-touchpad-tap.c',
351 'src/evdev-mt-touchpad-thumb.c',
352 'src/evdev-mt-touchpad-buttons.c',
353 'src/evdev-mt-touchpad-edge-scroll.c',
354 'src/evdev-mt-touchpad-gestures.c',
355 'src/evdev-tablet.c',
356 'src/evdev-tablet-pad.c',
357 'src/evdev-tablet-pad-leds.c',
376 libinput_version_h_config = configuration_data()
377 libinput_version_h_config.set('LIBINPUT_VERSION_MAJOR', libinput_version[0])
378 libinput_version_h_config.set('LIBINPUT_VERSION_MINOR', libinput_version[1])
379 libinput_version_h_config.set('LIBINPUT_VERSION_MICRO', libinput_version[2])
380 libinput_version_h_config.set('LIBINPUT_VERSION', meson.project_version())
382 libinput_version_h = configure_file(
383 input : 'src/libinput-version.h.in',
384 output : 'libinput-version.h',
385 configuration : libinput_version_h_config,
388 mapfile = dir_src / 'libinput.sym'
389 version_flag = '-Wl,--version-script,@0@'.format(mapfile)
390 lib_libinput = shared_library('input',
392 include_directories : [include_directories('.'), includes_include],
393 dependencies : deps_libinput,
394 version : libinput_so_version,
395 link_args : version_flag,
396 link_depends : mapfile,
400 dep_libinput = declare_dependency(
401 link_with : lib_libinput,
402 dependencies : deps_libinput)
405 filebase : 'libinput',
407 description : 'Input device library',
408 version : meson.project_version(),
409 libraries : lib_libinput
412 git_version_h = vcs_tag(command : ['git', 'describe'],
413 fallback : 'unknown',
414 input : 'src/libinput-git-version.h.in',
415 output :'libinput-git-version.h')
417 ############ documentation ############
419 if get_option('documentation')
424 ############ shell completion #########
426 subdir('completion/zsh')
428 ############ tools ############
429 libinput_tool_path = dir_libexec
430 config_h.set_quoted('LIBINPUT_TOOL_PATH', libinput_tool_path)
431 tools_shared_sources = [ 'tools/shared.c' ]
432 deps_tools_shared = [ dep_libinput, dep_libevdev ]
433 lib_tools_shared = static_library('tools_shared',
434 tools_shared_sources,
435 include_directories : [includes_src, includes_include],
436 dependencies : deps_tools_shared)
437 dep_tools_shared = declare_dependency(link_with : lib_tools_shared,
438 dependencies : deps_tools_shared)
440 deps_tools = [ dep_tools_shared, dep_libinput ]
441 libinput_debug_events_sources = [
442 'tools/libinput-debug-events.c',
445 executable('libinput-debug-events',
446 libinput_debug_events_sources,
447 dependencies : deps_tools,
448 include_directories : [includes_src, includes_include],
449 install_dir : libinput_tool_path,
453 libinput_debug_tablet_sources = [ 'tools/libinput-debug-tablet.c' ]
454 executable('libinput-debug-tablet',
455 libinput_debug_tablet_sources,
456 dependencies : deps_tools,
457 include_directories : [includes_src, includes_include],
458 install_dir : libinput_tool_path,
462 libinput_quirks_sources = [ 'tools/libinput-quirks.c' ]
463 libinput_quirks = executable('libinput-quirks',
464 libinput_quirks_sources,
465 dependencies : [dep_libquirks, dep_tools_shared, dep_libinput],
466 include_directories : [includes_src, includes_include],
467 install_dir : libinput_tool_path,
470 test('validate-quirks',
472 args: ['validate', '--data-dir=@0@'.format(dir_src_quirks)],
476 libinput_list_devices_sources = [ 'tools/libinput-list-devices.c' ]
477 libinput_list_devices = executable('libinput-list-devices',
478 libinput_list_devices_sources,
479 dependencies : deps_tools,
480 include_directories : [includes_src, includes_include],
481 install_dir : libinput_tool_path,
485 libinput_list_devices,
486 suite : ['all', 'root', 'hardware'])
488 libinput_measure_sources = [ 'tools/libinput-measure.c' ]
489 executable('libinput-measure',
490 libinput_measure_sources,
491 dependencies : deps_tools,
492 include_directories : [includes_src, includes_include],
493 install_dir : libinput_tool_path,
497 libinput_analyze_sources = [ 'tools/libinput-analyze.c' ]
498 executable('libinput-analyze',
499 libinput_analyze_sources,
500 dependencies : deps_tools,
501 include_directories : [includes_src, includes_include],
502 install_dir : libinput_tool_path,
506 src_python_tools = files(
507 'tools/libinput-analyze-per-slot-delta.py',
508 'tools/libinput-analyze-recording.py',
509 'tools/libinput-analyze-touch-down-state.py',
510 'tools/libinput-measure-fuzz.py',
511 'tools/libinput-measure-touchpad-size.py',
512 'tools/libinput-measure-touchpad-tap.py',
513 'tools/libinput-measure-touchpad-pressure.py',
514 'tools/libinput-measure-touch-size.py',
515 'tools/libinput-replay.py'
518 foreach t : src_python_tools
519 configure_file(input: t,
520 output: '@BASENAME@',
522 install_dir : libinput_tool_path
526 libinput_record_sources = [ 'tools/libinput-record.c', git_version_h ]
527 executable('libinput-record',
528 libinput_record_sources,
529 dependencies : deps_tools + [dep_udev],
530 include_directories : [includes_src, includes_include],
531 install_dir : libinput_tool_path,
535 config_h.set10('HAVE_DEBUG_GUI', get_option('debug-gui'))
536 if get_option('debug-gui')
537 dep_gtk = dependency('gtk4', version : '>= 4.0', required : false)
538 config_h.set10('HAVE_GTK4', dep_gtk.found())
539 if not dep_gtk.found()
540 dep_gtk = dependency('gtk+-3.0', version : '>= 3.20')
541 config_h.set10('HAVE_GTK3', dep_gtk.found())
544 gtk_targets = dep_gtk.get_pkgconfig_variable('targets')
545 have_gtk_wayland = gtk_targets.contains('wayland')
546 have_gtk_x11 = gtk_targets.contains('x11')
548 dep_cairo = dependency('cairo')
549 dep_glib = dependency('glib-2.0')
550 dep_x11 = dependency('x11', required : false)
551 dep_wayland_client = dependency('wayland-client', required : false)
552 dep_wayland_protocols = dependency('wayland-protocols', required : false)
554 config_h.set10('HAVE_GTK_X11', have_gtk_x11 and dep_x11.found())
555 config_h.set10('HAVE_GTK_WAYLAND', false)
557 debug_gui_sources = [ 'tools/libinput-debug-gui.c' ]
559 if have_gtk_wayland and dep_wayland_client.found() and dep_wayland_protocols.found()
560 wayland_scanner = find_program('wayland-scanner')
561 wlproto_dir = dep_wayland_protocols.get_pkgconfig_variable('pkgdatadir')
563 proto_name = 'pointer-constraints-unstable-v1'
564 input = files(wlproto_dir / 'unstable' / 'pointer-constraints' / '@0@.xml'.format(proto_name))
566 wayland_headers = custom_target('@0@ client header'.format(proto_name),
568 output: '@0@-client-protocol.h'.format(proto_name),
569 command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
572 wayland_sources = custom_target('@0@ source'.format(proto_name),
574 output: '@0@-protocol.c'.format(proto_name),
575 command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
578 debug_gui_sources += [ wayland_headers, wayland_sources ]
579 config_h.set10('HAVE_GTK_WAYLAND', true)
587 dep_wayland_protocols,
590 executable('libinput-debug-gui',
592 dependencies : deps_debug_gui,
593 include_directories : [includes_src, includes_include],
594 install_dir : libinput_tool_path,
597 src_man += files('tools/libinput-debug-gui.man')
600 libinput_sources = [ 'tools/libinput-tool.c' ]
602 libinput_tool = executable('libinput',
604 dependencies : deps_tools,
605 include_directories : [includes_src, includes_include],
609 ptraccel_debug_sources = [ 'tools/ptraccel-debug.c' ]
610 executable('ptraccel-debug',
611 ptraccel_debug_sources,
612 dependencies : [ dep_libfilter, dep_libinput ],
613 include_directories : [includes_src, includes_include],
617 # Don't run the test during a release build because we rely on the magic
619 if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
620 config_tool_option_test = configuration_data()
621 config_tool_option_test.set('DISABLE_WARNING', 'yes')
622 config_tool_option_test.set('MESON_ENABLED_DEBUG_GUI', get_option('debug-gui'))
623 config_tool_option_test.set('MESON_BUILD_ROOT', meson.current_build_dir())
624 config_tool_option_test.set('TOOL_PATH', libinput_tool.full_path())
625 tool_option_test = configure_file(input: 'tools/test_tool_option_parsing.py',
626 output: '@PLAINNAME@',
627 configuration : config_tool_option_test)
628 test('tool-option-parsing',
630 args : [tool_option_test, '-n', 'auto'],
631 suite : ['all', 'root'],
635 # the libinput tools check whether we execute from the builddir, this is
636 # the test to verify that lookup. We test twice, once as normal test
637 # run from the builddir, once after copying to /tmp
638 test_builddir_lookup = executable('test-builddir-lookup',
639 'test/test-builddir-lookup.c',
640 dependencies : [ dep_tools_shared],
641 include_directories : [includes_src, includes_include],
643 test('tools-builddir-lookup',
644 test_builddir_lookup,
645 args : ['--builddir-is-set'],
647 test('tools-builddir-lookup-installed',
648 find_program('test/helper-copy-and-exec-from-tmp.sh'),
649 args : [test_builddir_lookup.full_path(), '--builddir-is-null'],
650 env : ['LD_LIBRARY_PATH=@0@'.format(meson.current_build_dir())],
654 ############ tests ############
656 test('symbols-leak-test',
657 find_program('test/symbols-leak-test'),
658 args : [ dir_src / 'libinput.sym', dir_src],
662 executable('test-build-pedantic',
663 'test/build-pedantic.c',
664 dependencies : [dep_udev],
665 include_directories : [includes_src, includes_include],
666 c_args : ['-std=c99', '-pedantic', '-Werror'],
669 executable('test-build-std-gnuc90',
670 'test/build-pedantic.c',
671 dependencies : [dep_udev],
672 include_directories : [includes_src, includes_include],
673 c_args : ['-std=gnu89', '-Werror'],
675 # test for linking with the minimal linker flags
676 executable('test-build-linker',
677 'test/build-pedantic.c',
678 include_directories : [includes_src, includes_include],
679 dependencies : [ dep_libinput, dep_libinput_util ],
681 # test including from C++ (in case CPP compiler is available)
682 if add_languages('cpp', required: false)
683 executable('test-build-cxx',
685 dependencies : [dep_udev],
686 include_directories : [includes_src, includes_include],
690 libinput_test_sources = [ 'tools/libinput-test.c' ]
691 executable('libinput-test',
692 libinput_test_sources,
693 dependencies : deps_tools,
694 include_directories : [includes_src, includes_include],
695 install_dir : libinput_tool_path,
699 # This is the test suite runner, we allow disabling that one because of
701 if get_option('tests')
702 dep_check = dependency('check', version : '>= 0.9.10')
704 gstack = find_program('gstack', required : false)
705 config_h.set10('HAVE_GSTACK', gstack.found())
707 # for inhibit support during test run
708 dep_libsystemd = dependency('libsystemd', version : '>= 221', required : false)
709 config_h.set10('HAVE_LIBSYSTEMD', dep_libsystemd.found())
712 'src/libinput-private-config.c',
713 'test/litest-device-absinfo-override.c',
714 'test/litest-device-acer-hawaii-keyboard.c',
715 'test/litest-device-acer-hawaii-touchpad.c',
716 'test/litest-device-aiptek-tablet.c',
717 'test/litest-device-alps-3fg.c',
718 'test/litest-device-alps-semi-mt.c',
719 'test/litest-device-alps-dualpoint.c',
720 'test/litest-device-anker-mouse-kbd.c',
721 'test/litest-device-apple-appletouch.c',
722 'test/litest-device-apple-internal-keyboard.c',
723 'test/litest-device-apple-magicmouse.c',
724 'test/litest-device-asus-rog-gladius.c',
725 'test/litest-device-atmel-hover.c',
726 'test/litest-device-bcm5974.c',
727 'test/litest-device-calibrated-touchscreen.c',
728 'test/litest-device-cyborg-rat-5.c',
729 'test/litest-device-dell-canvas-totem.c',
730 'test/litest-device-dell-canvas-totem-touch.c',
731 'test/litest-device-elantech-touchpad.c',
732 'test/litest-device-elan-tablet.c',
733 'test/litest-device-format-string.c',
734 'test/litest-device-generic-pressurepad.c',
735 'test/litest-device-generic-singletouch.c',
736 'test/litest-device-gpio-keys.c',
737 'test/litest-device-huion-pentablet.c',
738 'test/litest-device-hp-wmi-hotkeys.c',
739 'test/litest-device-ignored-mouse.c',
740 'test/litest-device-keyboard.c',
741 'test/litest-device-keyboard-all-codes.c',
742 'test/litest-device-keyboard-quirked.c',
743 'test/litest-device-keyboard-razer-blackwidow.c',
744 'test/litest-device-keyboard-razer-blade-stealth.c',
745 'test/litest-device-keyboard-razer-blade-stealth-videoswitch.c',
746 'test/litest-device-lenovo-scrollpoint.c',
747 'test/litest-device-lid-switch.c',
748 'test/litest-device-lid-switch-surface3.c',
749 'test/litest-device-logitech-media-keyboard-elite.c',
750 'test/litest-device-logitech-trackball.c',
751 'test/litest-device-nexus4-touch-screen.c',
752 'test/litest-device-magic-trackpad.c',
753 'test/litest-device-mouse.c',
754 'test/litest-device-mouse-wheel-tilt.c',
755 'test/litest-device-mouse-roccat.c',
756 'test/litest-device-mouse-low-dpi.c',
757 'test/litest-device-mouse-wheel-click-angle.c',
758 'test/litest-device-mouse-wheel-click-count.c',
759 'test/litest-device-ms-nano-transceiver-mouse.c',
760 'test/litest-device-ms-surface-cover.c',
761 'test/litest-device-protocol-a-touch-screen.c',
762 'test/litest-device-qemu-usb-tablet.c',
763 'test/litest-device-sony-vaio-keys.c',
764 'test/litest-device-synaptics-x220.c',
765 'test/litest-device-synaptics-hover.c',
766 'test/litest-device-synaptics-i2c.c',
767 'test/litest-device-synaptics-pressurepad.c',
768 'test/litest-device-synaptics-rmi4.c',
769 'test/litest-device-synaptics-st.c',
770 'test/litest-device-synaptics-t440.c',
771 'test/litest-device-synaptics-x1-carbon-3rd.c',
772 'test/litest-device-tablet-mode-switch.c',
773 'test/litest-device-thinkpad-extrabuttons.c',
774 'test/litest-device-trackpoint.c',
775 'test/litest-device-touch-screen.c',
776 'test/litest-device-touchscreen-invalid-range.c',
777 'test/litest-device-touchscreen-fuzz.c',
778 'test/litest-device-touchscreen-mt-tool.c',
779 'test/litest-device-uclogic-tablet.c',
780 'test/litest-device-wacom-bamboo-2fg-finger.c',
781 'test/litest-device-wacom-bamboo-2fg-pad.c',
782 'test/litest-device-wacom-bamboo-2fg-pen.c',
783 'test/litest-device-wacom-bamboo-16fg-pen.c',
784 'test/litest-device-wacom-cintiq-12wx-pen.c',
785 'test/litest-device-wacom-cintiq-13hdt-finger.c',
786 'test/litest-device-wacom-cintiq-13hdt-pad.c',
787 'test/litest-device-wacom-cintiq-13hdt-pen.c',
788 'test/litest-device-wacom-cintiq-24hd-pen.c',
789 'test/litest-device-wacom-cintiq-24hdt-pad.c',
790 'test/litest-device-wacom-cintiq-pro-16-finger.c',
791 'test/litest-device-wacom-cintiq-pro-16-pad.c',
792 'test/litest-device-wacom-cintiq-pro-16-pen.c',
793 'test/litest-device-wacom-ekr.c',
794 'test/litest-device-wacom-hid4800-pen.c',
795 'test/litest-device-wacom-intuos3-pad.c',
796 'test/litest-device-wacom-intuos5-finger.c',
797 'test/litest-device-wacom-intuos5-pad.c',
798 'test/litest-device-wacom-intuos5-pen.c',
799 'test/litest-device-wacom-isdv4-4200-pen.c',
800 'test/litest-device-wacom-isdv4-524c-pen.c',
801 'test/litest-device-wacom-isdv4-e6-pen.c',
802 'test/litest-device-wacom-isdv4-e6-finger.c',
803 'test/litest-device-wacom-mobilestudio-pro-pad.c',
804 'test/litest-device-waltop-tablet.c',
805 'test/litest-device-wheel-only.c',
806 'test/litest-device-xen-virtual-pointer.c',
807 'test/litest-device-vmware-virtual-usb-mouse.c',
808 'test/litest-device-yubikey.c',
812 dep_dl = cc.find_library('dl')
824 litest_config_h = configuration_data()
825 litest_config_h.set_quoted('LIBINPUT_DEVICE_GROUPS_RULES_FILE',
826 meson.current_build_dir() /
827 '80-libinput-device-groups-litest.rules')
828 litest_config_h.set_quoted('LIBINPUT_FUZZ_OVERRIDE_UDEV_RULES_FILE',
829 meson.current_build_dir() /
830 '90-libinput-fuzz-override-litest.rules')
832 def_no_main = '-DLITEST_NO_MAIN'
833 def_disable_backtrace = '-DLITEST_DISABLE_BACKTRACE_LOGGING'
834 defs_litest_selftest = [
836 def_disable_backtrace,
839 test_litest_selftest_sources = [
840 'test/litest-selftest.c',
843 test_litest_selftest = executable('test-litest-selftest',
844 test_litest_selftest_sources,
845 include_directories : [includes_src, includes_include],
846 dependencies : deps_litest,
847 c_args : defs_litest_selftest,
849 test('test-litest-selftest',
850 test_litest_selftest,
854 def_LT_VERSION = '-DLIBINPUT_LT_VERSION="@0@:@1@:@2@"'.format(libinput_lt_c, libinput_lt_r, libinput_lt_a)
855 test_library_version = executable('test-library-version',
856 ['test/test-library-version.c'],
857 c_args : [ def_LT_VERSION ],
859 test('test-library-version',
860 test_library_version,
863 test_utils_sources = [
866 test_utils = executable('libinput-test-utils',
868 include_directories : [includes_src, includes_include],
869 dependencies : deps_litest,
870 install_dir : libinput_tool_path,
871 install : get_option('install-tests'))
876 # When adding new files to this list, update the CI
880 'test/test-pointer.c',
883 'test/test-tablet.c',
886 'test/test-touchpad.c',
887 'test/test-touchpad-tap.c',
888 'test/test-touchpad-buttons.c',
889 'test/test-trackpoint.c',
890 'test/test-trackball.c',
892 'test/test-keyboard.c',
893 'test/test-device.c',
894 'test/test-gestures.c',
895 'test/test-switch.c',
896 'test/test-quirks.c',
898 libinput_test_runner_sources = litest_sources + tests_sources
899 libinput_test_runner = executable('libinput-test-suite',
900 libinput_test_runner_sources,
901 include_directories : [includes_src, includes_include],
902 dependencies : deps_litest,
903 install_dir : libinput_tool_path,
904 install : get_option('install-tests'))
906 src_man += 'test/libinput-test-suite.man'
908 foreach testfile : tests_sources
909 tfile = testfile.split('test/test-')[1]
910 group = tfile.split('.c')[0]
911 test('libinput-test-suite-@0@'.format(group),
912 libinput_test_runner,
913 suite : ['all', 'valgrind', 'root', 'hardware'],
914 args : ['--filter-group=@0@'.format(group),
915 '--xml-output=junit-@0@-XXXXXX.xml'.format(group)],
920 test('libinput-test-deviceless',
921 libinput_test_runner,
922 suite : ['all', 'valgrind'],
923 args: ['--filter-deviceless',
924 '--xml-output=junit-deviceless-XXXXXX.xml'])
926 valgrind = find_program('valgrind', required : false)
928 valgrind_env = environment()
929 valgrind_suppressions_file = dir_src_test / 'valgrind.suppressions'
930 add_test_setup('valgrind',
931 exe_wrapper : [ valgrind,
933 '--gen-suppressions=all',
934 '--error-exitcode=3',
935 '--suppressions=' + valgrind_suppressions_file ],
937 timeout_multiplier : 100)
939 message('valgrind not found, disabling valgrind test suite')
941 configure_file(output : 'litest-config.h',
942 configuration : litest_config_h)
946 ############ man pages ############
947 man_config = configuration_data()
948 man_config.set('LIBINPUT_VERSION', meson.project_version())
949 man_config.set('LIBINPUT_DATA_DIR', dir_data)
950 if get_option('install-tests')
951 man_config.set('HAVE_INSTALLED_TESTS', '.\"')
953 man_config.set('HAVE_INSTALLED_TESTS', '')
956 'tools/libinput.man',
957 'tools/libinput-analyze.man',
958 'tools/libinput-analyze-per-slot-delta.man',
959 'tools/libinput-analyze-recording.man',
960 'tools/libinput-analyze-touch-down-state.man',
961 'tools/libinput-debug-events.man',
962 'tools/libinput-debug-tablet.man',
963 'tools/libinput-list-devices.man',
964 'tools/libinput-measure.man',
965 'tools/libinput-measure-fuzz.man',
966 'tools/libinput-measure-touchpad-size.man',
967 'tools/libinput-measure-touchpad-tap.man',
968 'tools/libinput-measure-touchpad-pressure.man',
969 'tools/libinput-measure-touch-size.man',
970 'tools/libinput-quirks.man',
971 'tools/libinput-record.man',
972 'tools/libinput-replay.man',
973 'tools/libinput-test.man',
977 configure_file(input : m,
978 output : '@BASENAME@.1',
979 configuration : man_config,
980 install_dir : dir_man1)
983 # Same man page for the subtools to stay consistent with the other tools
984 configure_file(input : 'tools/libinput-quirks.man',
985 output : 'libinput-quirks-list.1',
986 configuration : man_config,
987 install_dir : dir_man1,
989 configure_file(input : 'tools/libinput-quirks.man',
990 output : 'libinput-quirks-validate.1',
991 configuration : man_config,
992 install_dir : dir_man1,
995 ############ output files ############
996 configure_file(output : 'config.h', configuration : config_h)