blob: b40793f37aabed2833d2eff7c680b1dc4e204b0f [file] [log] [blame]
Brad Bishop2d66b512019-09-19 16:36:47 -04001project(
2 'phosphor-gpio-monitor',
3 'cpp',
4 default_options: [
5 'warning_level=3',
6 'werror=true',
Patrick Williamsa594dfb2021-10-06 15:35:23 -05007 'cpp_std=c++20',
Brandon Wymanca2637e2021-03-04 12:41:21 -06008 'buildtype=debugoptimized'
Brad Bishop2d66b512019-09-19 16:36:47 -04009 ],
10 license: 'Apache-2.0',
11 version: '1.0',
Patrick Williams0c60faa2023-04-12 08:05:56 -050012 meson_version: '>=0.58.0',
Brad Bishop2d66b512019-09-19 16:36:47 -040013)
14
15build_tests = get_option('tests')
16
17cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
18libevdev = dependency('libevdev')
19libsystemd = dependency('libsystemd')
Vijay Khemka939a6432019-10-09 17:45:45 -070020libgpiod = dependency('libgpiod')
Brad Bishop2d66b512019-09-19 16:36:47 -040021phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
22phosphor_logging = dependency('phosphor-logging')
23sdbusplus = dependency('sdbusplus')
Brad Bishop26373ab2019-09-19 17:18:57 -040024systemd = dependency('systemd')
25
Vijay Khemka939a6432019-10-09 17:45:45 -070026boost_args = ['-DBOOST_ASIO_DISABLE_THREADS',
27 '-DBOOST_ERROR_CODE_HEADER_ONLY',
28 '-DBOOST_SYSTEM_NO_DEPRECATED']
29
Patrick Williams0c60faa2023-04-12 08:05:56 -050030systemd_system_unit_dir = systemd.get_variable(
Brad Bishop26373ab2019-09-19 17:18:57 -040031 'systemdsystemunitdir',
Patrick Williams0c60faa2023-04-12 08:05:56 -050032 pkgconfig_define: ['prefix', get_option('prefix')])
Brad Bishop26373ab2019-09-19 17:18:57 -040033
34configure_file(
35 copy: true,
36 input: 'phosphor-gpio-monitor@.service',
37 install: true,
38 install_dir: systemd_system_unit_dir,
39 output: 'phosphor-gpio-monitor@.service'
40)
41
42configure_file(
43 copy: true,
Vijay Khemkad34bd962019-10-29 12:28:07 -070044 input: 'phosphor-multi-gpio-monitor.service',
45 install: true,
46 install_dir: systemd_system_unit_dir,
47 output: 'phosphor-multi-gpio-monitor.service'
48)
49
50configure_file(
51 copy: true,
Brad Bishop26373ab2019-09-19 17:18:57 -040052 input: 'phosphor-gpio-presence@.service',
53 install: true,
54 install_dir: systemd_system_unit_dir,
55 output: 'phosphor-gpio-presence@.service'
56)
Brad Bishop2d66b512019-09-19 16:36:47 -040057
Alvin Wang58dc2772019-11-06 13:35:13 +080058udev = dependency('udev')
59udev_rules_dir = join_paths(
Patrick Williams0c60faa2023-04-12 08:05:56 -050060 udev.get_variable(
Alvin Wang58dc2772019-11-06 13:35:13 +080061 'udevdir',
Patrick Williams0c60faa2023-04-12 08:05:56 -050062 pkgconfig_define: ['prefix', get_option('prefix')],
Alvin Wang58dc2772019-11-06 13:35:13 +080063 ),
64 'rules.d',
65)
66
67configure_file(
68 copy: true,
69 input: '99-gpio-keys.rules',
70 install: true,
71 install_dir: udev_rules_dir,
72 output: '99-gpio-keys.rules'
73)
74
75
Vijay Khemkad34bd962019-10-29 12:28:07 -070076configure_file(
77 copy: true,
78 input: 'phosphor-multi-gpio-monitor.json',
79 install: true,
80 install_dir: '/usr/share/phosphor-gpio-monitor',
81 output: 'phosphor-multi-gpio-monitor.json'
82)
83
Brad Bishop2d66b512019-09-19 16:36:47 -040084libevdev_o = static_library(
85 'libevdev_o',
86 'evdev.cpp',
87 dependencies: [
88 libevdev,
89 phosphor_dbus_interfaces,
90 phosphor_logging,
91 sdbusplus,
92 ]
93)
94
95libmonitor_o = static_library(
96 'libmonitor_o',
97 'monitor.cpp',
98 dependencies: [
99 libevdev,
100 libsystemd,
101 phosphor_logging,
102 ],
103 link_with: [
104 libevdev_o,
105 ],
106)
107
108phosphor_gpio_monitor = executable(
109 'phosphor-gpio-monitor',
110 'argument.cpp',
111 'mainapp.cpp',
112 dependencies: [
113 libevdev,
114 libsystemd,
115 phosphor_logging,
116 ],
117 install: true,
118 link_with: [
119 libevdev_o,
120 libmonitor_o,
121 ],
122)
123
Vijay Khemka939a6432019-10-09 17:45:45 -0700124executable(
125 'phosphor-multi-gpio-monitor',
126 'gpioMonMain.cpp',
127 'gpioMon.cpp',
128 dependencies: [
129 phosphor_logging,
130 sdbusplus,
131 libgpiod,
132 ],
133 cpp_args: boost_args,
134 install: true,
135)
136
Brad Bishop2d66b512019-09-19 16:36:47 -0400137subdir('gpio-util')
138subdir('presence')
139subdir('test')