Add support for building with meson
Follow the OpenBMC herd and support a modern, comprehensible build
framework.
To build with meson:
meson build
ninja -C build
OR
bitbake dbus-sensors
Add -Dtests to match de-facto OpenBMC meson usage conventions.
Maintain existing per-sensor config flags; however, do not define
targets when opting out of a sensor class.
One noteable omission is support for subprojects or vendoring.
The OpenBMC CI scripts look for meson.build before looking for
CMakelists so approval of this patch would change the build system
during CI to meson.
meta-phosphor change to update the recipe to meson is also coming
shortly.
Change-Id: I27d8c8f5761850d760428ed813eecd41e8f47c33
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..32b6e85
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,211 @@
+peci_incdirs = []
+if not meson.get_compiler('cpp').has_header('linux/peci-ioctl.h')
+ peci_incdirs = ['../include']
+endif
+
+if get_option('adc').enabled()
+ executable(
+ 'adcsensor',
+ 'ADCSensor.cpp',
+ 'ADCSensorMain.cpp',
+ dependencies: [
+ gpiodcxx,
+ sdbusplus,
+ ],
+ implicit_include_directories: false,
+ include_directories: '../include',
+ install: true,
+ link_with: [
+ thresholds_a,
+ utils_a,
+ ],
+ )
+endif
+
+if get_option('cpu').enabled()
+ executable(
+ 'cpusensor',
+ 'CPUSensorMain.cpp',
+ 'CPUSensor.cpp',
+ dependencies: [
+ gpiodcxx,
+ sdbusplus,
+ ],
+ implicit_include_directories: false,
+ include_directories: [
+ '../include'
+ ] + peci_incdirs,
+ install: true,
+ link_with: [
+ thresholds_a,
+ utils_a,
+ ],
+ )
+endif
+
+if get_option('exit-air').enabled()
+ executable(
+ 'exitairtempsensor',
+ 'ExitAirTempSensor.cpp',
+ dependencies: [
+ sdbusplus,
+ ],
+ implicit_include_directories: false,
+ include_directories: '../include',
+ install: true,
+ link_with: [
+ thresholds_a,
+ utils_a,
+ ],
+ )
+endif
+
+if get_option('fan').enabled()
+ executable(
+ 'fansensor',
+ 'FanMain.cpp',
+ 'TachSensor.cpp',
+ 'PwmSensor.cpp',
+ dependencies: [
+ sdbusplus,
+ gpiodcxx
+ ],
+ implicit_include_directories: false,
+ include_directories: '../include',
+ install: true,
+ link_with: [
+ thresholds_a,
+ utils_a,
+ ],
+ )
+endif
+
+if get_option('hwmon-temp').enabled()
+ executable(
+ 'hwmontempsensor',
+ 'HwmonTempMain.cpp',
+ 'HwmonTempSensor.cpp',
+ dependencies: [
+ sdbusplus,
+ ],
+ implicit_include_directories: false,
+ include_directories: '../include',
+ install: true,
+ link_with: [
+ thresholds_a,
+ utils_a,
+ ],
+ )
+endif
+
+if get_option('intrusion').enabled()
+ executable(
+ 'intrusionsensor',
+ 'ChassisIntrusionSensor.cpp',
+ 'IntrusionSensorMain.cpp',
+ dependencies: [
+ i2c,
+ sdbusplus,
+ gpiodcxx,
+ ],
+ implicit_include_directories: false,
+ include_directories: '../include',
+ install: true,
+ link_with: [
+ utils_a,
+ ],
+ )
+endif
+
+if get_option('ipmb').enabled()
+ executable(
+ 'ipmbsensor',
+ 'IpmbSensor.cpp',
+ dependencies: [
+ sdbusplus,
+ ],
+ implicit_include_directories: false,
+ include_directories: '../include',
+ install: true,
+ link_with: [
+ thresholds_a,
+ utils_a,
+ ],
+ )
+endif
+
+if get_option('mcu-temp').enabled()
+ executable(
+ 'mcutempsensor',
+ 'MCUTempSensor.cpp',
+ dependencies: [
+ i2c,
+ sdbusplus,
+ ],
+ implicit_include_directories: false,
+ include_directories: '../include',
+ install: true,
+ link_with: [
+ utils_a,
+ thresholds_a,
+ ],
+ )
+endif
+
+if get_option('nvme').enabled()
+ executable(
+ 'nvmesensor',
+ 'NVMeSensorMain.cpp',
+ 'NVMeSensor.cpp',
+ dependencies: [
+ i2c,
+ sdbusplus,
+ mctp,
+ ],
+ implicit_include_directories: false,
+ include_directories: '../include',
+ install: true,
+ link_with: [
+ utils_a,
+ thresholds_a,
+ ],
+ )
+endif
+
+if get_option('psu-temp').enabled()
+ executable(
+ 'psutempsensor',
+ 'PSUEvent.cpp',
+ 'PSUSensor.cpp',
+ 'PSUSensorMain.cpp',
+ dependencies: [
+ sdbusplus,
+ ],
+ implicit_include_directories: false,
+ include_directories: '../include',
+ install: true,
+ link_with: [
+ pwmsensor_a,
+ thresholds_a,
+ utils_a,
+ ],
+ )
+endif
+
+if get_option('external').enabled()
+ executable(
+ 'externalsensor',
+ 'ExternalSensor.cpp',
+ 'ExternalSensorMain.cpp',
+ dependencies: [
+ sdbusplus,
+ ],
+ implicit_include_directories: false,
+ include_directories: '../include',
+ install: true,
+ link_with: [
+ thresholds_a,
+ utils_a,
+ ],
+ )
+endif