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