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