meson.build 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222
  1. project('libinput', 'c',
  2. version : '1.31.0',
  3. license : 'MIT/Expat',
  4. default_options : [ 'c_std=gnu99', 'warning_level=2' ],
  5. meson_version : '>= 0.64.0')
  6. libinput_version = meson.project_version().split('.')
  7. dir_data = get_option('prefix') / get_option('datadir') / 'libinput'
  8. dir_etc = get_option('prefix') / get_option('sysconfdir')
  9. dir_overrides = get_option('prefix') / get_option('sysconfdir') / 'libinput'
  10. dir_libexec = get_option('prefix') / get_option('libexecdir') / 'libinput'
  11. dir_lib = get_option('prefix') / get_option('libdir')
  12. dir_man1 = get_option('prefix') / get_option('mandir') / 'man1'
  13. dir_system_udev = get_option('prefix') / 'lib' / 'udev'
  14. dir_src_quirks = meson.current_source_dir() / 'quirks'
  15. dir_src_test = meson.current_source_dir() / 'test'
  16. dir_src = meson.current_source_dir() / 'src'
  17. dir_gitlab_ci = meson.current_source_dir() / '.gitlab-ci'
  18. dir_udev = get_option('udev-dir')
  19. if dir_udev == ''
  20. dir_udev = dir_system_udev
  21. endif
  22. dir_udev_callouts = dir_udev
  23. dir_udev_rules = dir_udev / 'rules.d'
  24. # Collection of man pages, we'll append to that
  25. src_man = files()
  26. # We use libtool-version numbers because it's easier to understand.
  27. # Before making a release, the libinput_so_*
  28. # numbers should be modified. The components are of the form C:R:A.
  29. # a) If binary compatibility has been broken (eg removed or changed interfaces)
  30. # change to C+1:0:0.
  31. # b) If interfaces have been changed or added, but binary compatibility has
  32. # been preserved, change to C+1:0:A+1
  33. # c) If the interface is the same as the previous version, change to C:R+1:A
  34. libinput_lt_c=23
  35. libinput_lt_r=0
  36. libinput_lt_a=13
  37. # convert to soname
  38. libinput_so_version = '@0@.@1@.@2@'.format((libinput_lt_c - libinput_lt_a),
  39. libinput_lt_a, libinput_lt_r)
  40. # Compiler setup
  41. cc = meson.get_compiler('c')
  42. cflags = [
  43. '-Wno-error=deprecated-declarations',
  44. '-Wno-unused-parameter',
  45. '-Wmissing-prototypes',
  46. '-Wstrict-prototypes',
  47. '-Wundef',
  48. '-Wlogical-op',
  49. '-Wpointer-arith',
  50. '-Wuninitialized',
  51. '-Winit-self',
  52. '-Wstrict-prototypes',
  53. '-Wimplicit-fallthrough',
  54. '-Wredundant-decls',
  55. '-Wincompatible-pointer-types',
  56. '-Wformat=2',
  57. '-Wno-missing-field-initializers',
  58. '-Wmissing-declarations',
  59. '-fvisibility=hidden',
  60. ]
  61. add_project_arguments(cc.get_supported_arguments(cflags), language : 'c')
  62. # config.h
  63. config_h = configuration_data()
  64. doc_url_base = 'https://wayland.freedesktop.org/libinput/doc'
  65. if libinput_version[2].to_int() >= 90
  66. doc_url = '@0@/latest'.format(doc_url_base)
  67. else
  68. doc_url = '@0@/@1@'.format(doc_url_base, meson.project_version())
  69. endif
  70. config_h.set_quoted('HTTP_DOC_LINK', doc_url)
  71. config_h.set('_GNU_SOURCE', '1')
  72. is_debug_build = get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
  73. if is_debug_build
  74. config_h.set('IS_DEBUG_BUILD', '1')
  75. config_h.set_quoted('MESON_BUILD_ROOT', meson.current_build_dir())
  76. endif
  77. prefix = '''#define _GNU_SOURCE 1
  78. #include <assert.h>
  79. '''
  80. if cc.get_define('static_assert', prefix : prefix) == ''
  81. config_h.set('static_assert(...)', '/* */')
  82. endif
  83. # Coverity breaks because it doesn't define _Float128 correctly, you'll end
  84. # up with a bunch of messages in the form:
  85. # "/usr/include/stdlib.h", line 133: error #20: identifier "_Float128" is
  86. # undefined
  87. # extern _Float128 strtof128 (const char *__restrict __nptr,
  88. # ^
  89. # We don't use float128 ourselves, it gets pulled in from math.h or
  90. # something, so let's just define it as uint128 and move on.
  91. # Unfortunately we can't detect the coverity build at meson configure
  92. # time, we only know it fails at runtime. So make this an option instead, to
  93. # be removed when coverity fixes this again.
  94. if get_option('coverity')
  95. config_h.set('_Float128', '__uint128_t')
  96. config_h.set('_Float32', 'int')
  97. config_h.set('_Float32x', 'int')
  98. config_h.set('_Float64', 'long')
  99. config_h.set('_Float64x', 'long')
  100. endif
  101. if cc.has_header_symbol('dirent.h', 'versionsort', prefix : prefix)
  102. config_h.set('HAVE_VERSIONSORT', '1')
  103. endif
  104. if cc.get_define('SYS_pidfd_open', prefix: '#include <sys/syscall.h>') != ''
  105. config_h.set('HAVE_PIDFD_OPEN', '1')
  106. endif
  107. if cc.has_function('sigabbrev_np', prefix: '#define _GNU_SOURCE 1\n#include <string.h>')
  108. config_h.set('HAVE_SIGABBREV_NP', '1')
  109. endif
  110. if not cc.has_header_symbol('errno.h', 'program_invocation_short_name', prefix : prefix)
  111. if cc.has_header_symbol('stdlib.h', 'getprogname')
  112. config_h.set('program_invocation_short_name', 'getprogname()')
  113. endif
  114. endif
  115. if cc.has_header('xlocale.h')
  116. config_h.set('HAVE_XLOCALE_H', '1')
  117. endif
  118. code = '''
  119. #include <time.h>
  120. void func() { auto foo = gmtime(NULL); foo->tm_sec = 0; }
  121. '''
  122. if cc.compiles(code, name: 'has C23 auto keyword')
  123. config_h.set('HAVE_C23_AUTO', '1')
  124. endif
  125. code = '''
  126. #include <locale.h>
  127. void main(void) { newlocale(LC_NUMERIC_MASK, "C", (locale_t)0); }
  128. '''
  129. if cc.links(code, name : 'locale.h')
  130. config_h.set('HAVE_LOCALE_H', '1')
  131. endif
  132. if not cc.has_header_symbol('sys/ptrace.h', 'PTRACE_ATTACH', prefix : prefix)
  133. config_h.set('PTRACE_ATTACH', 'PT_ATTACH')
  134. config_h.set('PTRACE_CONT', 'PT_CONTINUE')
  135. config_h.set('PTRACE_DETACH', 'PT_DETACH')
  136. endif
  137. if get_option('install-tests')
  138. config_h.set('HAVE_INSTALLED_TESTS', 1)
  139. endif
  140. # Dependencies
  141. pkgconfig = import('pkgconfig')
  142. dep_udev = dependency('libudev')
  143. dep_libevdev = dependency('libevdev', version: '>= 1.10.0')
  144. dep_lm = cc.find_library('m', required : false)
  145. dep_rt = cc.find_library('rt', required : false)
  146. dep_lua = dependency('lua-5.4', 'lua5.4', 'lua',
  147. version : '>= 5.4',
  148. required : get_option('lua-plugins'))
  149. have_lua = dep_lua.found()
  150. if have_lua
  151. config_h.set('HAVE_LUA', 1)
  152. endif
  153. have_plugins = dep_lua.found()
  154. if have_plugins
  155. config_h.set('HAVE_PLUGINS', 1)
  156. endif
  157. autoload_plugins = get_option('autoload-plugins')
  158. if autoload_plugins
  159. config_h.set('AUTOLOAD_PLUGINS', 1)
  160. endif
  161. summary({
  162. 'Plugins enabled' : have_plugins,
  163. 'Autoload plugins' : autoload_plugins,
  164. 'Lua Plugin support' : have_lua,
  165. },
  166. section : 'Plugins',
  167. bool_yn : true)
  168. # Include directories
  169. includes_include = include_directories('include')
  170. includes_src = include_directories('src')
  171. ############ mtdev configuration ############
  172. have_mtdev = get_option('mtdev')
  173. if have_mtdev
  174. config_h.set('HAVE_MTDEV', 1)
  175. dep_mtdev = dependency('mtdev', version : '>= 1.1.0')
  176. else
  177. dep_mtdev = declare_dependency()
  178. endif
  179. ############ libwacom configuration ############
  180. have_libwacom = get_option('libwacom')
  181. if have_libwacom
  182. config_h.set('HAVE_LIBWACOM', 1)
  183. dep_libwacom = dependency('libwacom', version : '>= 0.27')
  184. if cc.has_header_symbol('libwacom/libwacom.h', 'WACOM_BUTTON_DIAL_MODESWITCH',
  185. dependencies : dep_libwacom)
  186. config_h.set('HAVE_LIBWACOM_BUTTON_DIAL_MODESWITCH', '1')
  187. endif
  188. if cc.has_function('libwacom_get_button_modeswitch_mode',
  189. dependencies: dep_libwacom)
  190. config_h.set('HAVE_LIBWACOM_BUTTON_MODESWITCH_MODE', '1')
  191. endif
  192. if cc.has_function('libwacom_stylus_is_generic',
  193. dependencies: dep_libwacom)
  194. config_h.set('HAVE_LIBWACOM_STYLUS_IS_GENERIC', '1')
  195. endif
  196. else
  197. dep_libwacom = declare_dependency()
  198. endif
  199. ############ udev bits ############
  200. executable('libinput-device-group',
  201. 'udev/libinput-device-group.c',
  202. dependencies : [dep_udev, dep_libwacom],
  203. include_directories : [includes_src, includes_include],
  204. install : true,
  205. install_tag : 'runtime',
  206. install_dir : dir_udev_callouts)
  207. executable('libinput-fuzz-extract',
  208. 'udev/libinput-fuzz-extract.c',
  209. 'src/util-strings.c',
  210. 'src/util-prop-parsers.c',
  211. dependencies : [dep_udev, dep_libevdev, dep_lm],
  212. include_directories : [includes_src, includes_include],
  213. install : true,
  214. install_tag : 'runtime',
  215. install_dir : dir_udev_callouts)
  216. executable('libinput-fuzz-to-zero',
  217. 'udev/libinput-fuzz-to-zero.c',
  218. dependencies : [dep_udev, dep_libevdev],
  219. include_directories : [includes_src, includes_include],
  220. install : true,
  221. install_tag : 'runtime',
  222. install_dir : dir_udev_callouts)
  223. udev_rules_config = configuration_data()
  224. udev_rules_config.set('UDEV_TEST_PATH', dir_udev_callouts + '/')
  225. configure_file(input : 'udev/80-libinput-device-groups.rules.in',
  226. output : '80-libinput-device-groups.rules',
  227. install_dir : dir_udev_rules,
  228. configuration : udev_rules_config)
  229. configure_file(input : 'udev/90-libinput-fuzz-override.rules.in',
  230. output : '90-libinput-fuzz-override.rules',
  231. install_dir : dir_udev_rules,
  232. configuration : udev_rules_config)
  233. litest_udev_rules_config = configuration_data()
  234. litest_udev_rules_config.set('UDEV_TEST_PATH', meson.current_build_dir() + '/')
  235. litest_groups_rules_file = configure_file(input : 'udev/80-libinput-device-groups.rules.in',
  236. output : '80-libinput-device-groups-litest.rules',
  237. configuration : litest_udev_rules_config)
  238. litest_fuzz_override_file = configure_file(input : 'udev/90-libinput-fuzz-override.rules.in',
  239. output : '90-libinput-fuzz-override-litest.rules',
  240. configuration : litest_udev_rules_config)
  241. ############ Check for leftover udev rules ########
  242. # This test should be defined first so we don't waste time testing anything
  243. # else if we're about to fail anyway. ninja test will execute tests in the
  244. # order of them defined in meson.build
  245. if get_option('tests')
  246. test('leftover-rules',
  247. find_program('test/check-leftover-udev-rules.sh'),
  248. is_parallel : false,
  249. suite : ['all'])
  250. endif
  251. ############ libepoll-shim (BSD) ############
  252. if cc.has_header_symbol('sys/epoll.h', 'epoll_create1', prefix : prefix)
  253. # epoll is built-in (Linux, illumos)
  254. dep_libepoll = declare_dependency()
  255. else
  256. # epoll is implemented in userspace by libepoll-shim (FreeBSD)
  257. dir_libepoll = get_option('epoll-dir')
  258. if dir_libepoll == ''
  259. dir_libepoll = get_option('prefix')
  260. endif
  261. includes_epoll = include_directories(dir_libepoll / 'include' / 'libepoll-shim')
  262. dep_libepoll = cc.find_library('epoll-shim', dirs : dir_libepoll / 'lib')
  263. code = '''
  264. #include <sys/epoll.h>
  265. int main(void) { epoll_create1(0); }
  266. '''
  267. if not cc.links(code,
  268. name : 'libepoll-shim check',
  269. dependencies : [dep_libepoll, dep_rt],
  270. include_directories : includes_epoll) # note: wants an include_directories object
  271. error('No built-in epoll or libepoll-shim found.')
  272. endif
  273. dep_libepoll = declare_dependency(
  274. include_directories : includes_epoll,
  275. dependencies : [dep_libepoll, dep_rt])
  276. endif
  277. ############ libinput-util.a ############
  278. # Basic compilation test to make sure the headers include and define all the
  279. # necessary bits.
  280. util_headers = [
  281. 'util-backtrace.h',
  282. 'util-bits.h',
  283. 'util-input-event.h',
  284. 'util-list.h',
  285. 'util-files.h',
  286. 'util-macros.h',
  287. 'util-matrix.h',
  288. 'util-prop-parsers.h',
  289. 'util-ratelimit.h',
  290. 'util-stringbuf.h',
  291. 'util-strings.h',
  292. 'util-time.h',
  293. ]
  294. foreach h: util_headers
  295. c = configuration_data()
  296. c.set_quoted('FILE', h)
  297. testfile = configure_file(input : 'test/test-util-includes.c.in',
  298. output : 'test-util-includes-@0@.c'.format(h),
  299. configuration : c)
  300. executable('test-build-@0@'.format(h),
  301. testfile,
  302. include_directories : [includes_src, includes_include],
  303. dependencies: [dep_libevdev],
  304. install : false)
  305. endforeach
  306. src_libinput_util = [
  307. 'src/util-files.c',
  308. 'src/util-list.c',
  309. 'src/util-ratelimit.c',
  310. 'src/util-strings.c',
  311. 'src/util-prop-parsers.c',
  312. ]
  313. libinput_util = static_library('libinput-util',
  314. src_libinput_util,
  315. dependencies : [dep_udev, dep_libevdev, dep_libwacom],
  316. include_directories : includes_include)
  317. dep_libinput_util = declare_dependency(link_with : libinput_util)
  318. ############ libfilter.a ############
  319. src_libfilter = [
  320. 'src/filter.c',
  321. 'src/filter-custom.c',
  322. 'src/filter-flat.c',
  323. 'src/filter-low-dpi.c',
  324. 'src/filter-mouse.c',
  325. 'src/filter-touchpad.c',
  326. 'src/filter-touchpad-flat.c',
  327. 'src/filter-touchpad-x230.c',
  328. 'src/filter-tablet.c',
  329. 'src/filter-trackpoint.c',
  330. 'src/filter-trackpoint-flat.c',
  331. ]
  332. libfilter = static_library('filter', src_libfilter,
  333. dependencies : [dep_udev, dep_libwacom, dep_libevdev],
  334. include_directories : includes_include)
  335. dep_libfilter = declare_dependency(link_with : libfilter)
  336. ############ libquirks.a #############
  337. libinput_data_path = dir_data
  338. libinput_data_override_path = dir_overrides / 'local-overrides.quirks'
  339. config_h.set_quoted('LIBINPUT_QUIRKS_DIR', dir_data)
  340. config_h.set_quoted('LIBINPUT_QUIRKS_OVERRIDE_FILE', libinput_data_override_path)
  341. config_h.set_quoted('LIBINPUT_QUIRKS_SRCDIR', dir_src_quirks)
  342. install_subdir('quirks',
  343. exclude_files: ['README.md'],
  344. install_dir : dir_data,
  345. strip_directory : true)
  346. src_libquirks = [
  347. 'src/quirks.c',
  348. ]
  349. deps_libquirks = [dep_udev, dep_libwacom, dep_libinput_util]
  350. libquirks = static_library('quirks', src_libquirks,
  351. dependencies : deps_libquirks,
  352. include_directories : includes_include)
  353. dep_libquirks = declare_dependency(link_with : libquirks)
  354. # Create /etc/libinput
  355. install_emptydir(dir_etc / 'libinput')
  356. ############ libinput.so ############
  357. if get_option('internal-event-debugging')
  358. config_h.set('EVENT_DEBUGGING', 1)
  359. endif
  360. config_h.set_quoted('LIBINPUT_PLUGIN_LIBDIR', dir_lib / 'libinput' / 'plugins')
  361. config_h.set_quoted('LIBINPUT_PLUGIN_ETCDIR', dir_etc / 'libinput' / 'plugins')
  362. install_headers('src/libinput.h')
  363. src_libinput = src_libfilter + [
  364. 'src/libinput.c',
  365. 'src/libinput-plugin.c',
  366. 'src/libinput-plugin-button-debounce.c',
  367. 'src/libinput-plugin-mouse-wheel.c',
  368. 'src/libinput-plugin-mouse-wheel-lowres.c',
  369. 'src/libinput-plugin-tablet-double-tool.c',
  370. 'src/libinput-plugin-tablet-eraser-button.c',
  371. 'src/libinput-plugin-tablet-forced-tool.c',
  372. 'src/libinput-plugin-tablet-proximity-timer.c',
  373. 'src/libinput-private-config.c',
  374. 'src/evdev.c',
  375. 'src/evdev-fallback.c',
  376. 'src/evdev-plugin.c',
  377. 'src/evdev-totem.c',
  378. 'src/evdev-middle-button.c',
  379. 'src/evdev-mt-touchpad.c',
  380. 'src/evdev-mt-touchpad-tap.c',
  381. 'src/evdev-mt-touchpad-thumb.c',
  382. 'src/evdev-mt-touchpad-buttons.c',
  383. 'src/evdev-mt-touchpad-edge-scroll.c',
  384. 'src/evdev-mt-touchpad-gestures.c',
  385. 'src/evdev-tablet.c',
  386. 'src/evdev-tablet-pad.c',
  387. 'src/evdev-tablet-pad-leds.c',
  388. 'src/path-seat.c',
  389. 'src/udev-seat.c',
  390. 'src/timer.c',
  391. 'src/util-libinput.c',
  392. ]
  393. if have_mtdev
  394. src_libinput += ['src/libinput-plugin-mtdev.c']
  395. endif
  396. if dep_lua.found()
  397. src_libinput += [
  398. 'src/libinput-plugin-lua.c',
  399. ]
  400. endif
  401. deps_libinput = [
  402. dep_mtdev,
  403. dep_udev,
  404. dep_libevdev,
  405. dep_libepoll,
  406. dep_lm,
  407. dep_rt,
  408. dep_libwacom,
  409. dep_libinput_util,
  410. dep_libquirks,
  411. dep_lua,
  412. ]
  413. libinput_version_h_config = configuration_data()
  414. libinput_version_h_config.set('LIBINPUT_VERSION_MAJOR', libinput_version[0])
  415. libinput_version_h_config.set('LIBINPUT_VERSION_MINOR', libinput_version[1])
  416. libinput_version_h_config.set('LIBINPUT_VERSION_MICRO', libinput_version[2])
  417. libinput_version_h_config.set('LIBINPUT_VERSION', meson.project_version())
  418. libinput_version_h = configure_file(
  419. input : 'src/libinput-version.h.in',
  420. output : 'libinput-version.h',
  421. configuration : libinput_version_h_config,
  422. )
  423. mapfile = dir_src / 'libinput.sym'
  424. version_flag = '-Wl,--version-script,@0@'.format(mapfile)
  425. lib_libinput = shared_library('input',
  426. src_libinput,
  427. include_directories : [include_directories('.'), includes_include],
  428. dependencies : deps_libinput,
  429. version : libinput_so_version,
  430. link_args : version_flag,
  431. link_depends : mapfile,
  432. install : true
  433. )
  434. dep_libinput = declare_dependency(
  435. link_with : lib_libinput,
  436. dependencies : deps_libinput)
  437. meson.override_dependency('libinput', dep_libinput)
  438. pkgconfig.generate(
  439. filebase : 'libinput',
  440. name : 'Libinput',
  441. description : 'Input device library',
  442. version : meson.project_version(),
  443. libraries : lib_libinput,
  444. requires_private : dep_udev,
  445. variables : [
  446. 'plugindir=${libdir}/libinput/plugins'
  447. ]
  448. )
  449. git_version_h = vcs_tag(command : ['git', 'describe'],
  450. fallback : 'unknown',
  451. input : 'src/libinput-git-version.h.in',
  452. output :'libinput-git-version.h')
  453. subdir('plugins')
  454. ############ documentation ############
  455. if get_option('documentation')
  456. subdir('doc/api')
  457. subdir('doc/user')
  458. endif
  459. ############ shell completion #########
  460. subdir('completion/zsh')
  461. ############ libinput-util-libinput.a ############
  462. # This one needs libinput itself
  463. src_libinput_util_libinput = [
  464. 'src/util-libinput.c'
  465. ]
  466. libinput_util_libinput = static_library('libinput-util-libinput',
  467. src_libinput_util_libinput,
  468. dependencies : [dep_libevdev, dep_libinput_util, dep_libinput],
  469. include_directories : includes_include)
  470. dep_libinput_util_libinput = declare_dependency(link_with : libinput_util_libinput)
  471. ############ tools ############
  472. libinput_tool_path = dir_libexec
  473. config_h.set_quoted('LIBINPUT_TOOL_PATH', libinput_tool_path)
  474. tools_shared_sources = [ 'tools/shared.c' ]
  475. deps_tools_shared = [ dep_libinput, dep_libevdev, dep_libinput_util_libinput ]
  476. lib_tools_shared = static_library('tools_shared',
  477. tools_shared_sources,
  478. include_directories : [includes_src, includes_include],
  479. dependencies : deps_tools_shared)
  480. dep_tools_shared = declare_dependency(link_with : lib_tools_shared,
  481. dependencies : deps_tools_shared)
  482. deps_tools = [ dep_tools_shared, dep_libinput ]
  483. libinput_debug_events_sources = [
  484. 'tools/libinput-debug-events.c',
  485. libinput_version_h,
  486. ]
  487. executable('libinput-debug-events',
  488. libinput_debug_events_sources,
  489. dependencies : deps_tools,
  490. include_directories : [includes_src, includes_include],
  491. install_dir : libinput_tool_path,
  492. install_tag : 'bin',
  493. install : true
  494. )
  495. libinput_debug_tablet_sources = [ 'tools/libinput-debug-tablet.c' ]
  496. executable('libinput-debug-tablet',
  497. libinput_debug_tablet_sources,
  498. dependencies : deps_tools,
  499. include_directories : [includes_src, includes_include],
  500. install_dir : libinput_tool_path,
  501. install_tag : 'bin',
  502. install : true)
  503. libinput_debug_tablet_pad_sources = [ 'tools/libinput-debug-tablet-pad.c' ]
  504. executable('libinput-debug-tablet-pad',
  505. libinput_debug_tablet_pad_sources,
  506. dependencies : deps_tools,
  507. include_directories : [includes_src, includes_include],
  508. install_dir : libinput_tool_path,
  509. install_tag : 'bin',
  510. install : true)
  511. libinput_quirks_sources = [ 'tools/libinput-quirks.c' ]
  512. libinput_quirks = executable('libinput-quirks',
  513. libinput_quirks_sources,
  514. dependencies : [dep_libquirks, dep_tools_shared, dep_libinput],
  515. include_directories : [includes_src, includes_include],
  516. install_dir : libinput_tool_path,
  517. install_tag : 'bin',
  518. install : true
  519. )
  520. test('validate-quirks',
  521. libinput_quirks,
  522. args: ['validate', '--data-dir=@0@'.format(dir_src_quirks)],
  523. suite : ['all']
  524. )
  525. quirks_file_tester = find_program('test/test_quirks_files.py')
  526. test('validate-quirks-files',
  527. quirks_file_tester,
  528. suite : ['all'],
  529. env: ['MESON_SOURCE_ROOT=@0@'.format(meson.project_source_root())],
  530. )
  531. libinput_list_devices_sources = [ 'tools/libinput-list-devices.c' ]
  532. libinput_list_devices = executable('libinput-list-devices',
  533. libinput_list_devices_sources,
  534. dependencies : deps_tools,
  535. include_directories : [includes_src, includes_include],
  536. install_dir : libinput_tool_path,
  537. install_tag : 'bin',
  538. install : true,
  539. )
  540. test('list-devices',
  541. libinput_list_devices,
  542. suite : ['all', 'root', 'hardware'])
  543. libinput_measure_sources = [ 'tools/libinput-measure.c' ]
  544. executable('libinput-measure',
  545. libinput_measure_sources,
  546. dependencies : deps_tools,
  547. include_directories : [includes_src, includes_include],
  548. install_dir : libinput_tool_path,
  549. install_tag : 'bin',
  550. install : true,
  551. )
  552. libinput_analyze_sources = [ 'tools/libinput-analyze.c' ]
  553. executable('libinput-analyze',
  554. libinput_analyze_sources,
  555. dependencies : deps_tools,
  556. include_directories : [includes_src, includes_include],
  557. install_dir : libinput_tool_path,
  558. install_tag : 'bin',
  559. install : true,
  560. )
  561. src_python_tools = files(
  562. 'tools/libinput-analyze-buttons.py',
  563. 'tools/libinput-analyze-per-slot-delta.py',
  564. 'tools/libinput-analyze-recording.py',
  565. 'tools/libinput-analyze-touch-down-state.py',
  566. 'tools/libinput-list-kernel-devices.py',
  567. 'tools/libinput-measure-fuzz.py',
  568. 'tools/libinput-measure-touchpad-size.py',
  569. 'tools/libinput-measure-touchpad-tap.py',
  570. 'tools/libinput-measure-touchpad-pressure.py',
  571. 'tools/libinput-measure-touch-size.py',
  572. 'tools/libinput-replay.py'
  573. )
  574. foreach t : src_python_tools
  575. configure_file(input: t,
  576. output: '@BASENAME@',
  577. copy: true,
  578. install_dir : libinput_tool_path
  579. )
  580. endforeach
  581. libinput_record_sources = [ 'tools/libinput-record.c', git_version_h ]
  582. executable('libinput-record',
  583. libinput_record_sources,
  584. dependencies : deps_tools + [dep_udev],
  585. include_directories : [includes_src, includes_include],
  586. install_dir : libinput_tool_path,
  587. install_tag : 'bin',
  588. install : true,
  589. )
  590. if get_option('debug-gui')
  591. config_h.set('HAVE_DEBUG_GUI', 1)
  592. dep_gtk = dependency('gtk4', version : '>= 4.0', required : false)
  593. if dep_gtk.found()
  594. config_h.set('HAVE_GTK4', 1)
  595. else
  596. dep_gtk = dependency('gtk+-3.0', version : '>= 3.20')
  597. if dep_gtk.found()
  598. config_h.set('HAVE_GTK3', 1)
  599. endif
  600. endif
  601. gtk_targets = dep_gtk.get_variable('targets')
  602. have_gtk_wayland = gtk_targets.contains('wayland')
  603. have_gtk_x11 = gtk_targets.contains('x11')
  604. dep_cairo = dependency('cairo')
  605. dep_glib = dependency('glib-2.0')
  606. dep_x11 = dependency('x11', required : false)
  607. dep_wayland_client = dependency('wayland-client', required : false)
  608. dep_wayland_protocols = dependency('wayland-protocols', required : false)
  609. if have_gtk_x11 and dep_x11.found()
  610. config_h.set('HAVE_GTK_X11', 1)
  611. endif
  612. debug_gui_sources = [ 'tools/libinput-debug-gui.c' ]
  613. if have_gtk_wayland and dep_wayland_client.found() and dep_wayland_protocols.found()
  614. wayland_scanner = find_program('wayland-scanner')
  615. wlproto_dir = dep_wayland_protocols.get_variable('pkgdatadir')
  616. proto_name = 'pointer-constraints-unstable-v1'
  617. input = files(wlproto_dir / 'unstable' / 'pointer-constraints' / '@0@.xml'.format(proto_name))
  618. wayland_headers = custom_target('@0@ client header'.format(proto_name),
  619. input: input,
  620. output: '@0@-client-protocol.h'.format(proto_name),
  621. command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
  622. )
  623. wayland_sources = custom_target('@0@ source'.format(proto_name),
  624. input: input,
  625. output: '@0@-protocol.c'.format(proto_name),
  626. command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
  627. )
  628. debug_gui_sources += [ wayland_headers, wayland_sources ]
  629. config_h.set('HAVE_GTK_WAYLAND', 1)
  630. endif
  631. deps_debug_gui = [
  632. dep_gtk,
  633. dep_cairo,
  634. dep_glib,
  635. dep_wayland_client,
  636. dep_wayland_protocols,
  637. dep_x11,
  638. ] + deps_tools
  639. executable('libinput-debug-gui',
  640. debug_gui_sources,
  641. dependencies : deps_debug_gui,
  642. include_directories : [includes_src, includes_include],
  643. install_dir : libinput_tool_path,
  644. install_tag : 'bin',
  645. install : true
  646. )
  647. src_man += files('tools/libinput-debug-gui.man')
  648. endif
  649. libinput_sources = [ 'tools/libinput-tool.c' ]
  650. libinput_tool = executable('libinput',
  651. libinput_sources,
  652. dependencies : deps_tools,
  653. include_directories : [includes_src, includes_include],
  654. install_tag : 'bin',
  655. install : true
  656. )
  657. ptraccel_debug_sources = [ 'tools/ptraccel-debug.c' ]
  658. executable('ptraccel-debug',
  659. ptraccel_debug_sources,
  660. dependencies : [ dep_libfilter, dep_libinput ],
  661. include_directories : [includes_src, includes_include],
  662. install : false
  663. )
  664. # Don't run the test during a release build because we rely on the magic
  665. # subtool lookup
  666. if is_debug_build
  667. config_tool_option_test = configuration_data()
  668. config_tool_option_test.set('DISABLE_WARNING', 'yes')
  669. config_tool_option_test.set('MESON_ENABLED_DEBUG_GUI', get_option('debug-gui').to_string())
  670. config_tool_option_test.set('MESON_BUILD_ROOT', meson.current_build_dir())
  671. config_tool_option_test.set('TOOL_PATH', libinput_tool.full_path())
  672. tool_option_test = configure_file(input: 'tools/test_tool_option_parsing.py',
  673. output: '@PLAINNAME@',
  674. configuration : config_tool_option_test)
  675. test('tool-option-parsing',
  676. tool_option_test,
  677. args : [tool_option_test],
  678. suite : ['all', 'root'],
  679. timeout : 240)
  680. endif
  681. # the libinput tools check whether we execute from the builddir, this is
  682. # the test to verify that lookup. We test twice, once as normal test
  683. # run from the builddir, once after copying to /tmp
  684. test_builddir_lookup = executable('test-builddir-lookup',
  685. 'test/test-builddir-lookup.c',
  686. dependencies : [ dep_tools_shared],
  687. include_directories : [includes_src, includes_include],
  688. install : false)
  689. test('tools-builddir-lookup',
  690. test_builddir_lookup,
  691. args : ['--builddir-is-set'],
  692. suite : ['all'])
  693. test('tools-builddir-lookup-installed',
  694. find_program('test/helper-copy-and-exec-from-tmp.sh'),
  695. args : [test_builddir_lookup.full_path(), '--builddir-is-null'],
  696. env : ['LD_LIBRARY_PATH=@0@'.format(meson.current_build_dir())],
  697. suite : ['all'],
  698. workdir : '/tmp')
  699. ############ tests ############
  700. summary({
  701. 'Tests enabled' : get_option('tests'),
  702. 'Install tests' : get_option('install-tests'),
  703. },
  704. section : 'Tests',
  705. bool_yn : true)
  706. test('symbols-leak-test',
  707. find_program('test/symbols-leak-test'),
  708. args : [ dir_src / 'libinput.sym', dir_src],
  709. suite : ['all'])
  710. # build-test only
  711. executable('test-build-pedantic',
  712. 'test/build-pedantic.c',
  713. dependencies : [dep_udev],
  714. include_directories : [includes_src, includes_include],
  715. c_args : ['-std=c99', '-pedantic', '-Werror'],
  716. install : false)
  717. # build-test only
  718. executable('test-build-std-gnuc90',
  719. 'test/build-pedantic.c',
  720. dependencies : [dep_udev],
  721. include_directories : [includes_src, includes_include],
  722. c_args : ['-std=gnu89', '-Werror'],
  723. install : false)
  724. # test for linking with the minimal linker flags
  725. executable('test-build-linker',
  726. 'test/build-pedantic.c',
  727. include_directories : [includes_src, includes_include],
  728. dependencies : [ dep_libinput, dep_libinput_util ],
  729. install : false)
  730. # test including from C++ (in case CPP compiler is available)
  731. if add_languages('cpp', native: false, required: false)
  732. executable('test-build-cxx',
  733. 'test/build-cxx.cc',
  734. dependencies : [dep_udev],
  735. include_directories : [includes_src, includes_include],
  736. install : false)
  737. endif
  738. libinput_test_sources = [ 'tools/libinput-test.c' ]
  739. executable('libinput-test',
  740. libinput_test_sources,
  741. dependencies : deps_tools,
  742. include_directories : [includes_src, includes_include],
  743. install_dir : libinput_tool_path,
  744. install_tag : 'tests',
  745. install : true,
  746. )
  747. # This is the test suite runner, we allow disabling that one because of
  748. # dependencies
  749. if get_option('tests')
  750. dep_check = dependency('check', version : '>= 0.9.10', required: false)
  751. gstack = find_program('gstack', required : false)
  752. if gstack.found()
  753. config_h.set('HAVE_GSTACK', 1)
  754. endif
  755. # for inhibit support during test run
  756. dep_libsystemd = dependency('libsystemd', version : '>= 221', required : false)
  757. if dep_libsystemd.found()
  758. config_h.set('HAVE_LIBSYSTEMD', 1)
  759. endif
  760. litest_sources = [
  761. 'src/libinput-private-config.c',
  762. 'test/litest-device-absinfo-override.c',
  763. 'test/litest-device-acer-hawaii-keyboard.c',
  764. 'test/litest-device-acer-hawaii-touchpad.c',
  765. 'test/litest-device-aiptek-tablet.c',
  766. 'test/litest-device-alps-3fg.c',
  767. 'test/litest-device-alps-semi-mt.c',
  768. 'test/litest-device-alps-dualpoint.c',
  769. 'test/litest-device-anker-mouse-kbd.c',
  770. 'test/litest-device-apple-appletouch.c',
  771. 'test/litest-device-apple-internal-keyboard.c',
  772. 'test/litest-device-apple-magicmouse.c',
  773. 'test/litest-device-asus-rog-gladius.c',
  774. 'test/litest-device-atmel-hover.c',
  775. 'test/litest-device-bcm5974.c',
  776. 'test/litest-device-calibrated-touchscreen.c',
  777. 'test/litest-device-cyborg-rat-5.c',
  778. 'test/litest-device-dell-canvas-totem.c',
  779. 'test/litest-device-dell-canvas-totem-touch.c',
  780. 'test/litest-device-elantech-touchpad.c',
  781. 'test/litest-device-elan-tablet.c',
  782. 'test/litest-device-format-string.c',
  783. 'test/litest-device-generic-pressurepad.c',
  784. 'test/litest-device-generic-singletouch.c',
  785. 'test/litest-device-generic-usb-keyboard.c',
  786. 'test/litest-device-generic-usb-touchpad.c',
  787. 'test/litest-device-gpio-keys.c',
  788. 'test/litest-device-huion-pentablet.c',
  789. 'test/litest-device-huion-q620m-dial.c',
  790. 'test/litest-device-hp-wmi-hotkeys.c',
  791. 'test/litest-device-ignored-mouse.c',
  792. 'test/litest-device-keyboard.c',
  793. 'test/litest-device-keyboard-all-codes.c',
  794. 'test/litest-device-keyboard-quirked.c',
  795. 'test/litest-device-keyboard-razer-blackwidow.c',
  796. 'test/litest-device-keyboard-razer-blade-stealth.c',
  797. 'test/litest-device-keyboard-razer-blade-stealth-videoswitch.c',
  798. 'test/litest-device-keypad-slide-switch.c',
  799. 'test/litest-device-lenovo-scrollpoint.c',
  800. 'test/litest-device-lid-switch.c',
  801. 'test/litest-device-lid-switch-surface3.c',
  802. 'test/litest-device-logitech-media-keyboard-elite.c',
  803. 'test/litest-device-logitech-trackball.c',
  804. 'test/litest-device-nexus4-touch-screen.c',
  805. 'test/litest-device-magic-trackpad.c',
  806. 'test/litest-device-mouse.c',
  807. 'test/litest-device-mouse-wheel-tilt.c',
  808. 'test/litest-device-mouse-wheel-hires-disabled.c',
  809. 'test/litest-device-mouse-ps2.c',
  810. 'test/litest-device-mouse-roccat.c',
  811. 'test/litest-device-mouse-low-dpi.c',
  812. 'test/litest-device-mouse-virtual.c',
  813. 'test/litest-device-mouse-wheel-click-angle.c',
  814. 'test/litest-device-mouse-wheel-click-count.c',
  815. 'test/litest-device-ms-nano-transceiver-mouse.c',
  816. 'test/litest-device-ms-surface-cover.c',
  817. 'test/litest-device-ploopy-pavonis-stylus.c',
  818. 'test/litest-device-qemu-usb-tablet.c',
  819. 'test/litest-device-sony-vaio-keys.c',
  820. 'test/litest-device-synaptics-x220.c',
  821. 'test/litest-device-synaptics-hover.c',
  822. 'test/litest-device-synaptics-i2c.c',
  823. 'test/litest-device-synaptics-pressurepad.c',
  824. 'test/litest-device-synaptics-rmi4.c',
  825. 'test/litest-device-synaptics-st.c',
  826. 'test/litest-device-synaptics-t440.c',
  827. 'test/litest-device-synaptics-x1-carbon-3rd.c',
  828. 'test/litest-device-synaptics-phantomclicks.c',
  829. 'test/litest-device-tablet-doubledial.c',
  830. 'test/litest-device-tablet-mode-switch.c',
  831. 'test/litest-device-tablet-rel-dial.c',
  832. 'test/litest-device-thinkpad-extrabuttons.c',
  833. 'test/litest-device-trackpoint.c',
  834. 'test/litest-device-touch-screen.c',
  835. 'test/litest-device-touchpad-palm-threshold-zero.c',
  836. 'test/litest-device-touchscreen-invalid-range.c',
  837. 'test/litest-device-touchscreen-fuzz.c',
  838. 'test/litest-device-touchscreen-mt-tool.c',
  839. 'test/litest-device-uclogic-tablet.c',
  840. 'test/litest-device-wacom-bamboo-2fg-finger.c',
  841. 'test/litest-device-wacom-bamboo-2fg-pad.c',
  842. 'test/litest-device-wacom-bamboo-2fg-pen.c',
  843. 'test/litest-device-wacom-bamboo-16fg-pen.c',
  844. 'test/litest-device-wacom-calibrated-tablet.c',
  845. 'test/litest-device-wacom-cintiq-12wx-pen.c',
  846. 'test/litest-device-wacom-cintiq-13hdt-finger.c',
  847. 'test/litest-device-wacom-cintiq-13hdt-pad.c',
  848. 'test/litest-device-wacom-cintiq-13hdt-pen.c',
  849. 'test/litest-device-wacom-cintiq-24hd-pen.c',
  850. 'test/litest-device-wacom-cintiq-24hdt-pad.c',
  851. 'test/litest-device-wacom-cintiq-pro-16-finger.c',
  852. 'test/litest-device-wacom-cintiq-pro-16-pad.c',
  853. 'test/litest-device-wacom-cintiq-pro-16-pen.c',
  854. 'test/litest-device-wacom-ekr.c',
  855. 'test/litest-device-wacom-hid4800-pen.c',
  856. 'test/litest-device-wacom-intuos3-pad.c',
  857. 'test/litest-device-wacom-intuos5-finger.c',
  858. 'test/litest-device-wacom-intuos5-pad.c',
  859. 'test/litest-device-wacom-intuos5-pen.c',
  860. 'test/litest-device-wacom-isdv4-4200-pen.c',
  861. 'test/litest-device-wacom-isdv4-524c-pen.c',
  862. 'test/litest-device-wacom-isdv4-e6-pen.c',
  863. 'test/litest-device-wacom-isdv4-e6-finger.c',
  864. 'test/litest-device-wacom-mobilestudio-pro-pad.c',
  865. 'test/litest-device-waltop-tablet.c',
  866. 'test/litest-device-wheel-only.c',
  867. 'test/litest-device-xen-virtual-pointer.c',
  868. 'test/litest-device-vmware-virtual-usb-mouse.c',
  869. 'test/litest-device-yubikey.c',
  870. 'test/litest-runner.c',
  871. 'test/litest.c',
  872. 'test/litest-main.c',
  873. ]
  874. if have_mtdev
  875. litest_sources += [
  876. 'test/litest-device-protocol-a-touch-screen.c',
  877. ]
  878. endif
  879. dep_dl = cc.find_library('dl')
  880. deps_litest = [
  881. dep_libinput,
  882. dep_udev,
  883. dep_libevdev,
  884. dep_dl,
  885. dep_lm,
  886. dep_libsystemd,
  887. dep_libquirks,
  888. dep_libinput_util_libinput,
  889. ]
  890. litest_config_h = configuration_data()
  891. litest_config_h.set_quoted('LIBINPUT_DEVICE_GROUPS_RULES_FILE',
  892. meson.current_build_dir() /
  893. '80-libinput-device-groups-litest.rules')
  894. litest_config_h.set_quoted('LIBINPUT_FUZZ_OVERRIDE_UDEV_RULES_FILE',
  895. meson.current_build_dir() /
  896. '90-libinput-fuzz-override-litest.rules')
  897. if dep_check.found()
  898. def_disable_backtrace = '-DLITEST_DISABLE_BACKTRACE_LOGGING'
  899. defs_litest_selftest = [
  900. def_disable_backtrace,
  901. '-Wno-unused',
  902. ]
  903. test_litest_selftest_sources = [
  904. 'test/litest-selftest.c',
  905. 'test/litest-runner.c',
  906. 'test/litest.c',
  907. ]
  908. test_litest_selftest = executable('test-litest-selftest',
  909. test_litest_selftest_sources,
  910. include_directories : [includes_src, includes_include],
  911. dependencies : [deps_litest, dep_check],
  912. c_args : defs_litest_selftest,
  913. install : false)
  914. test('test-litest-selftest',
  915. test_litest_selftest,
  916. suite : ['all'],
  917. timeout : 100)
  918. endif
  919. def_LT_VERSION = '-DLIBINPUT_LT_VERSION="@0@:@1@:@2@"'.format(libinput_lt_c, libinput_lt_r, libinput_lt_a)
  920. test_library_version = executable('test-library-version',
  921. ['test/test-library-version.c'],
  922. c_args : [ def_LT_VERSION ],
  923. install : false)
  924. test('test-library-version',
  925. test_library_version,
  926. suite : ['all'])
  927. test_utils_sources = [
  928. 'test/test-utils.c',
  929. 'test/litest-runner.c',
  930. 'test/litest.c',
  931. ]
  932. test_utils = executable('libinput-test-utils',
  933. test_utils_sources,
  934. include_directories : [includes_src, includes_include],
  935. dependencies : deps_litest,
  936. install_dir : libinput_tool_path,
  937. install : get_option('install-tests'))
  938. test('test-utils',
  939. test_utils,
  940. suite : ['all'])
  941. tests_sources = [
  942. 'test/test-udev.c',
  943. 'test/test-path.c',
  944. 'test/test-pointer.c',
  945. 'test/test-touch.c',
  946. 'test/test-log.c',
  947. 'test/test-tablet.c',
  948. 'test/test-totem.c',
  949. 'test/test-pad.c',
  950. 'test/test-touchpad.c',
  951. 'test/test-touchpad-tap.c',
  952. 'test/test-touchpad-buttons.c',
  953. 'test/test-trackpoint.c',
  954. 'test/test-trackball.c',
  955. 'test/test-misc.c',
  956. 'test/test-keyboard.c',
  957. 'test/test-device.c',
  958. 'test/test-gestures.c',
  959. 'test/test-switch.c',
  960. 'test/test-quirks.c',
  961. ]
  962. if have_plugins and have_lua
  963. tests_sources += ['test/test-plugins-lua.c']
  964. endif
  965. libinput_test_runner_sources = litest_sources + tests_sources
  966. libinput_test_runner = executable('libinput-test-suite',
  967. libinput_test_runner_sources,
  968. include_directories : [includes_src, includes_include],
  969. dependencies : deps_litest,
  970. install_dir : libinput_tool_path,
  971. install : get_option('install-tests'))
  972. src_man += 'test/libinput-test-suite.man'
  973. # When adding new TEST_COLLECTION() macros, add to this list and the CI
  974. # $ git grep TEST_COLLECTION test/test-* | sed -e "s|.*TEST_COLLECTION(\(.*\))|\t\t'\1',|" | sort
  975. collections = [
  976. 'device',
  977. 'gestures',
  978. 'keyboard',
  979. 'log',
  980. 'misc',
  981. 'pad',
  982. 'path',
  983. 'pointer',
  984. 'quirks',
  985. 'switch',
  986. 'tablet',
  987. 'tablet_eraser',
  988. 'tablet_left_handed',
  989. 'tablet_proximity',
  990. 'tablet_tip',
  991. 'totem',
  992. 'touch',
  993. 'touchpad',
  994. 'touchpad_buttons',
  995. 'touchpad_dwt',
  996. 'touchpad_palm',
  997. 'touchpad_tap',
  998. 'touchpad_tap_drag',
  999. 'touchpad_tap_palm',
  1000. 'trackball',
  1001. 'trackpoint',
  1002. 'udev',
  1003. ]
  1004. if have_plugins and have_lua
  1005. collections += ['lua']
  1006. endif
  1007. foreach group : collections
  1008. test('libinput-test-suite-@0@'.format(group),
  1009. libinput_test_runner,
  1010. suite : ['all', 'valgrind', 'root', 'hardware'],
  1011. args : ['--filter-group=@0@'.format(group)],
  1012. is_parallel : false,
  1013. timeout : 1100)
  1014. endforeach
  1015. test('libinput-test-deviceless',
  1016. libinput_test_runner,
  1017. suite : ['all', 'valgrind'],
  1018. args: ['--filter-deviceless'])
  1019. valgrind = find_program('valgrind', required : false)
  1020. if valgrind.found()
  1021. valgrind_env = environment()
  1022. valgrind_suppressions_file = dir_src_test / 'valgrind.suppressions'
  1023. add_test_setup('valgrind',
  1024. exe_wrapper : [ valgrind,
  1025. '--log-file=valgrind.%p.log',
  1026. '--leak-check=full',
  1027. '--gen-suppressions=all',
  1028. '--error-exitcode=3',
  1029. '--suppressions=' + valgrind_suppressions_file ],
  1030. env : valgrind_env,
  1031. timeout_multiplier : 3)
  1032. else
  1033. message('valgrind not found, disabling valgrind test suite')
  1034. endif
  1035. configure_file(output : 'litest-config.h',
  1036. configuration : litest_config_h)
  1037. endif
  1038. ############ man pages ############
  1039. man_config = configuration_data()
  1040. man_config.set('LIBINPUT_VERSION', meson.project_version())
  1041. man_config.set('LIBINPUT_DATA_DIR', dir_data)
  1042. if get_option('install-tests')
  1043. man_config.set('HAVE_INSTALLED_TESTS', '.\"')
  1044. else
  1045. man_config.set('HAVE_INSTALLED_TESTS', '')
  1046. endif
  1047. if get_option('debug-gui')
  1048. man_config.set('HAVE_DEBUG_GUI', '')
  1049. else
  1050. man_config.set('HAVE_DEBUG_GUI', '.\"')
  1051. endif
  1052. src_man += files(
  1053. 'tools/libinput.man',
  1054. 'tools/libinput-analyze.man',
  1055. 'tools/libinput-analyze-buttons.man',
  1056. 'tools/libinput-analyze-per-slot-delta.man',
  1057. 'tools/libinput-analyze-recording.man',
  1058. 'tools/libinput-analyze-touch-down-state.man',
  1059. 'tools/libinput-debug-events.man',
  1060. 'tools/libinput-debug-tablet.man',
  1061. 'tools/libinput-debug-tablet-pad.man',
  1062. 'tools/libinput-list-devices.man',
  1063. 'tools/libinput-list-kernel-devices.man',
  1064. 'tools/libinput-measure.man',
  1065. 'tools/libinput-measure-fuzz.man',
  1066. 'tools/libinput-measure-touchpad-size.man',
  1067. 'tools/libinput-measure-touchpad-tap.man',
  1068. 'tools/libinput-measure-touchpad-pressure.man',
  1069. 'tools/libinput-measure-touch-size.man',
  1070. 'tools/libinput-quirks.man',
  1071. 'tools/libinput-record.man',
  1072. 'tools/libinput-replay.man',
  1073. 'tools/libinput-test.man',
  1074. )
  1075. foreach m : src_man
  1076. configure_file(input : m,
  1077. output : '@BASENAME@.1',
  1078. configuration : man_config,
  1079. install_dir : dir_man1)
  1080. endforeach
  1081. # Same man page for the subtools to stay consistent with the other tools
  1082. configure_file(input : 'tools/libinput-quirks.man',
  1083. output : 'libinput-quirks-list.1',
  1084. configuration : man_config,
  1085. install_dir : dir_man1,
  1086. )
  1087. configure_file(input : 'tools/libinput-quirks.man',
  1088. output : 'libinput-quirks-validate.1',
  1089. configuration : man_config,
  1090. install_dir : dir_man1,
  1091. )
  1092. ############ output files ############
  1093. configure_file(output : 'config.h', configuration : config_h)