xref: /openbmc/dbus-sensors/src/meson.build (revision 786efb80)
1conf_data = configuration_data()
2conf_data.set10('VALIDATION_UNSECURE_FEATURE', get_option('validate-unsecure-feature').enabled())
3conf_data.set10('INSECURE_UNRESTRICTED_SENSOR_OVERRIDE', get_option('insecure-sensor-override').enabled())
4configure_file(input: 'dbus-sensor_config.h.in',
5               output: 'dbus-sensor_config.h',
6               configuration: conf_data)
7
8thresholds_a = static_library(
9    'thresholds_a',
10    'Thresholds.cpp',
11    dependencies: default_deps,
12)
13
14thresholds_dep = declare_dependency(
15    link_with: [ thresholds_a ],
16    dependencies: default_deps,
17)
18
19utils_a = static_library(
20    'utils_a',
21    [
22        'FileHandle.cpp',
23        'SensorPaths.cpp',
24        'Utils.cpp',
25    ],
26    dependencies: default_deps,
27)
28
29utils_dep = declare_dependency(
30    link_with: [ utils_a ],
31    dependencies: [ sdbusplus ],
32)
33
34devicemgmt_a = static_library(
35    'devicemgmt_a',
36    [
37        'DeviceMgmt.cpp',
38    ],
39    dependencies: default_deps,
40)
41
42devicemgmt_dep = declare_dependency(
43    link_with: [ devicemgmt_a ],
44    dependencies: default_deps,
45)
46
47pwmsensor_a = static_library(
48    'pwmsensor_a',
49    'PwmSensor.cpp',
50    dependencies: [ default_deps, thresholds_dep ],
51)
52
53pwmsensor_dep = declare_dependency(
54    link_with: [ pwmsensor_a ],
55    dependencies: [ default_deps, thresholds_dep ],
56)
57
58peci_incdirs = []
59if not meson.get_compiler('cpp').has_header('linux/peci-ioctl.h')
60    peci_incdirs = ['../include']
61endif
62
63if get_option('adc').enabled()
64    executable(
65        'adcsensor',
66        'ADCSensor.cpp',
67        'ADCSensorMain.cpp',
68        dependencies: [
69            default_deps,
70            gpiodcxx,
71            thresholds_dep,
72            utils_dep,
73        ],
74        cpp_args: uring_args,
75        install: true,
76    )
77endif
78
79if get_option('intel-cpu').enabled()
80    executable(
81        'intelcpusensor',
82        'IntelCPUSensorMain.cpp',
83        'IntelCPUSensor.cpp',
84        dependencies: [
85            default_deps,
86            gpiodcxx,
87            thresholds_dep,
88            utils_dep,
89        ],
90        include_directories: peci_incdirs,
91        install: true,
92    )
93endif
94
95if get_option('exit-air').enabled()
96    executable(
97        'exitairtempsensor',
98        'ExitAirTempSensor.cpp',
99        dependencies: [
100            default_deps,
101            thresholds_dep,
102            utils_dep,
103        ],
104        cpp_args: uring_args,
105        install: true,
106    )
107endif
108
109if get_option('fan').enabled()
110    executable(
111        'fansensor',
112        'FanMain.cpp',
113        'TachSensor.cpp',
114        'PwmSensor.cpp',
115        dependencies: [
116            default_deps,
117            gpiodcxx,
118            thresholds_dep,
119            utils_dep,
120        ],
121        cpp_args: uring_args,
122        install: true,
123    )
124endif
125
126if get_option('hwmon-temp').enabled()
127    executable(
128        'hwmontempsensor',
129        'HwmonTempMain.cpp',
130        'HwmonTempSensor.cpp',
131        dependencies: [
132            default_deps,
133            devicemgmt_dep,
134            thresholds_dep,
135            utils_dep,
136        ],
137        cpp_args: uring_args,
138        install: true,
139    )
140endif
141
142if get_option('intrusion').enabled()
143    executable(
144        'intrusionsensor',
145        'ChassisIntrusionSensor.cpp',
146        'IntrusionSensorMain.cpp',
147        dependencies: [
148            default_deps,
149            gpiodcxx,
150            i2c,
151            utils_dep,
152        ],
153        cpp_args: uring_args,
154        install: true,
155    )
156endif
157
158if get_option('ipmb').enabled()
159    executable(
160        'ipmbsensor',
161        'IpmbSensor.cpp',
162        'IpmbSDRSensor.cpp',
163        dependencies: [
164            default_deps,
165            thresholds_dep,
166            utils_dep,
167        ],
168        cpp_args: uring_args,
169        install: true,
170    )
171endif
172
173if get_option('mcu').enabled()
174    executable(
175        'mcutempsensor',
176        'MCUTempSensor.cpp',
177        dependencies: [
178            default_deps,
179            i2c,
180            thresholds_dep,
181            utils_dep,
182        ],
183        cpp_args: uring_args,
184        install: true,
185    )
186endif
187
188if get_option('nvme').enabled()
189    nvme_srcs = files('NVMeSensorMain.cpp', 'NVMeSensor.cpp')
190    nvme_srcs += files('NVMeBasicContext.cpp')
191
192    nvme_deps = [ default_deps, i2c, thresholds_dep, utils_dep, threads ]
193
194    executable(
195        'nvmesensor',
196        sources: nvme_srcs,
197        dependencies: nvme_deps,
198        cpp_args: uring_args,
199        install: true,
200    )
201endif
202
203if get_option('psu').enabled()
204    executable(
205        'psusensor',
206        'PSUEvent.cpp',
207        'PSUSensor.cpp',
208        'PSUSensorMain.cpp',
209        dependencies: [
210            default_deps,
211            devicemgmt_dep,
212            pwmsensor_dep,
213            thresholds_dep,
214            utils_dep,
215        ],
216        cpp_args: uring_args,
217        install: true,
218    )
219endif
220
221if get_option('external').enabled()
222    executable(
223        'externalsensor',
224        'ExternalSensor.cpp',
225        'ExternalSensorMain.cpp',
226        dependencies: [
227            default_deps,
228            thresholds_dep,
229            utils_dep,
230        ],
231        cpp_args: uring_args,
232        install: true,
233    )
234endif
235