xref: /openbmc/dbus-sensors/src/meson.build (revision a0c6b5b7)
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('intel-cpu').enabled()
64    peci_dep = meson.get_compiler('cpp').find_library('libpeci', required : false)
65    if not peci_dep.found()
66      cmake = import('cmake')
67      opt = cmake.subproject_options()
68      opt.append_compile_args('c', '-Wno-pedantic')
69      peci_proj = cmake.subproject('libpeci', options : opt)
70      peci_dep = peci_proj.dependency('peci')
71    endif
72endif
73
74if get_option('adc').enabled()
75    executable(
76        'adcsensor',
77        'ADCSensor.cpp',
78        'ADCSensorMain.cpp',
79        dependencies: [
80            default_deps,
81            gpiodcxx,
82            thresholds_dep,
83            utils_dep,
84        ],
85        install: true,
86    )
87endif
88
89if get_option('intel-cpu').enabled()
90    executable(
91        'intelcpusensor',
92        'IntelCPUSensorMain.cpp',
93        'IntelCPUSensor.cpp',
94        dependencies: [
95            default_deps,
96            gpiodcxx,
97            thresholds_dep,
98            utils_dep,
99            peci_dep,
100        ],
101        include_directories: peci_incdirs,
102        install: true,
103    )
104endif
105
106if get_option('exit-air').enabled()
107    executable(
108        'exitairtempsensor',
109        'ExitAirTempSensor.cpp',
110        dependencies: [
111            default_deps,
112            thresholds_dep,
113            utils_dep,
114        ],
115        install: true,
116    )
117endif
118
119if get_option('fan').enabled()
120    executable(
121        'fansensor',
122        'FanMain.cpp',
123        'TachSensor.cpp',
124        'PwmSensor.cpp',
125        dependencies: [
126            default_deps,
127            gpiodcxx,
128            thresholds_dep,
129            utils_dep,
130        ],
131        install: true,
132    )
133endif
134
135if get_option('hwmon-temp').enabled()
136    executable(
137        'hwmontempsensor',
138        'HwmonTempMain.cpp',
139        'HwmonTempSensor.cpp',
140        dependencies: [
141            default_deps,
142            devicemgmt_dep,
143            thresholds_dep,
144            utils_dep,
145        ],
146        install: true,
147    )
148endif
149
150if get_option('intrusion').enabled()
151    executable(
152        'intrusionsensor',
153        'ChassisIntrusionSensor.cpp',
154        'IntrusionSensorMain.cpp',
155        dependencies: [
156            default_deps,
157            gpiodcxx,
158            i2c,
159            utils_dep,
160        ],
161        install: true,
162    )
163endif
164
165if get_option('ipmb').enabled()
166    executable(
167        'ipmbsensor',
168        'IpmbSensor.cpp',
169        'IpmbSDRSensor.cpp',
170        dependencies: [
171            default_deps,
172            thresholds_dep,
173            utils_dep,
174        ],
175        install: true,
176    )
177endif
178
179if get_option('mcu').enabled()
180    executable(
181        'mcutempsensor',
182        'MCUTempSensor.cpp',
183        dependencies: [
184            default_deps,
185            i2c,
186            thresholds_dep,
187            utils_dep,
188        ],
189        install: true,
190    )
191endif
192
193if get_option('nvme').enabled()
194    nvme_srcs = files('NVMeSensorMain.cpp', 'NVMeSensor.cpp')
195    nvme_srcs += files('NVMeBasicContext.cpp')
196
197    nvme_deps = [ default_deps, i2c, thresholds_dep, utils_dep, threads ]
198
199    executable(
200        'nvmesensor',
201        sources: nvme_srcs,
202        dependencies: nvme_deps,
203        install: true,
204    )
205endif
206
207if get_option('psu').enabled()
208    executable(
209        'psusensor',
210        'PSUEvent.cpp',
211        'PSUSensor.cpp',
212        'PSUSensorMain.cpp',
213        dependencies: [
214            default_deps,
215            devicemgmt_dep,
216            pwmsensor_dep,
217            thresholds_dep,
218            utils_dep,
219        ],
220        install: true,
221    )
222endif
223
224if get_option('external').enabled()
225    executable(
226        'externalsensor',
227        'ExternalSensor.cpp',
228        'ExternalSensorMain.cpp',
229        dependencies: [
230            default_deps,
231            thresholds_dep,
232            utils_dep,
233        ],
234        install: true,
235    )
236endif
237