blob: ec7bb6573175e96bb1632d72e3c8f866ab970a70 [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
Brad Bishop2d66b512019-09-19 16:36:47 -040017libevdev = dependency('libevdev')
18libsystemd = dependency('libsystemd')
Vijay Khemka939a6432019-10-09 17:45:45 -070019libgpiod = dependency('libgpiod')
Brad Bishop2d66b512019-09-19 16:36:47 -040020phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
21phosphor_logging = dependency('phosphor-logging')
22sdbusplus = dependency('sdbusplus')
Brad Bishop26373ab2019-09-19 17:18:57 -040023systemd = dependency('systemd')
24
Vijay Khemka939a6432019-10-09 17:45:45 -070025boost_args = ['-DBOOST_ASIO_DISABLE_THREADS',
26 '-DBOOST_ERROR_CODE_HEADER_ONLY',
27 '-DBOOST_SYSTEM_NO_DEPRECATED']
28
Patrick Williams0c60faa2023-04-12 08:05:56 -050029systemd_system_unit_dir = systemd.get_variable(
Brad Bishop26373ab2019-09-19 17:18:57 -040030 'systemdsystemunitdir',
Patrick Williams0c60faa2023-04-12 08:05:56 -050031 pkgconfig_define: ['prefix', get_option('prefix')])
Brad Bishop26373ab2019-09-19 17:18:57 -040032
33configure_file(
34 copy: true,
35 input: 'phosphor-gpio-monitor@.service',
36 install: true,
37 install_dir: systemd_system_unit_dir,
38 output: 'phosphor-gpio-monitor@.service'
39)
40
41configure_file(
42 copy: true,
Vijay Khemkad34bd962019-10-29 12:28:07 -070043 input: 'phosphor-multi-gpio-monitor.service',
44 install: true,
45 install_dir: systemd_system_unit_dir,
46 output: 'phosphor-multi-gpio-monitor.service'
47)
48
49configure_file(
50 copy: true,
Brad Bishop26373ab2019-09-19 17:18:57 -040051 input: 'phosphor-gpio-presence@.service',
52 install: true,
53 install_dir: systemd_system_unit_dir,
54 output: 'phosphor-gpio-presence@.service'
55)
Brad Bishop2d66b512019-09-19 16:36:47 -040056
Alvin Wang58dc2772019-11-06 13:35:13 +080057udev = dependency('udev')
58udev_rules_dir = join_paths(
Patrick Williams0c60faa2023-04-12 08:05:56 -050059 udev.get_variable(
Alvin Wang58dc2772019-11-06 13:35:13 +080060 'udevdir',
Patrick Williams0c60faa2023-04-12 08:05:56 -050061 pkgconfig_define: ['prefix', get_option('prefix')],
Alvin Wang58dc2772019-11-06 13:35:13 +080062 ),
63 'rules.d',
64)
65
66configure_file(
67 copy: true,
68 input: '99-gpio-keys.rules',
69 install: true,
70 install_dir: udev_rules_dir,
71 output: '99-gpio-keys.rules'
72)
73
74
Vijay Khemkad34bd962019-10-29 12:28:07 -070075configure_file(
76 copy: true,
77 input: 'phosphor-multi-gpio-monitor.json',
78 install: true,
79 install_dir: '/usr/share/phosphor-gpio-monitor',
80 output: 'phosphor-multi-gpio-monitor.json'
81)
82
Brad Bishop2d66b512019-09-19 16:36:47 -040083libevdev_o = static_library(
84 'libevdev_o',
85 'evdev.cpp',
86 dependencies: [
87 libevdev,
88 phosphor_dbus_interfaces,
89 phosphor_logging,
90 sdbusplus,
91 ]
92)
93
94libmonitor_o = static_library(
95 'libmonitor_o',
96 'monitor.cpp',
97 dependencies: [
98 libevdev,
99 libsystemd,
100 phosphor_logging,
101 ],
102 link_with: [
103 libevdev_o,
104 ],
105)
106
107phosphor_gpio_monitor = executable(
108 'phosphor-gpio-monitor',
109 'argument.cpp',
110 'mainapp.cpp',
111 dependencies: [
112 libevdev,
113 libsystemd,
114 phosphor_logging,
115 ],
116 install: true,
117 link_with: [
118 libevdev_o,
119 libmonitor_o,
120 ],
121)
122
Vijay Khemka939a6432019-10-09 17:45:45 -0700123executable(
124 'phosphor-multi-gpio-monitor',
125 'gpioMonMain.cpp',
126 'gpioMon.cpp',
127 dependencies: [
128 phosphor_logging,
129 sdbusplus,
130 libgpiod,
131 ],
132 cpp_args: boost_args,
133 install: true,
134)
135
Brad Bishop2d66b512019-09-19 16:36:47 -0400136subdir('gpio-util')
137subdir('presence')
138subdir('test')