blob: 4fb63d46552e56367e5a959b031d813857e4ddc0 [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',
Brandon Wymanca2637e2021-03-04 12:41:21 -06007 'cpp_std=c++17',
8 'buildtype=debugoptimized'
Brad Bishop2d66b512019-09-19 16:36:47 -04009 ],
10 license: 'Apache-2.0',
11 version: '1.0',
12)
13
14build_tests = get_option('tests')
15
16cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
17libevdev = 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
Brad Bishop26373ab2019-09-19 17:18:57 -040029systemd_system_unit_dir = systemd.get_pkgconfig_variable(
30 'systemdsystemunitdir',
31 define_variable: ['prefix', get_option('prefix')])
32
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(
59 udev.get_pkgconfig_variable(
60 'udevdir',
61 define_variable: ['prefix', get_option('prefix')],
62 ),
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')