build: DRY dependencies
Nearly everything uses 'sdbusplus' and 'nlohmann-json'. Since
'nlohmann-json' is a header-only library there is no issue with
excessively including it as a dependency. DRY up the dependency
specification by creating a 'default_deps' array that can contain
these.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iad72eeda9b3cbd688eca5dee7df5ebc5dbe3878a
diff --git a/meson.build b/meson.build
index 90ce161..296eddf 100644
--- a/meson.build
+++ b/meson.build
@@ -60,23 +60,28 @@
pkgconfig_define: ['prefix', get_option('prefix')])
threads = dependency('threads')
+default_deps = [
+ nlohmann_json,
+ sdbusplus,
+]
+
thresholds_a = static_library(
'thresholds_a',
'src/Thresholds.cpp',
- dependencies: [ sdbusplus, nlohmann_json ],
+ dependencies: default_deps,
implicit_include_directories: false,
include_directories: 'include',
)
thresholds_dep = declare_dependency(
link_with: [ thresholds_a ],
- dependencies: [ nlohmann_json ],
+ dependencies: default_deps,
)
utils_a = static_library(
'utils_a',
['src/Utils.cpp', 'src/SensorPaths.cpp'],
- dependencies: [ sdbusplus ],
+ dependencies: default_deps,
implicit_include_directories: false,
include_directories: 'include',
)
@@ -89,14 +94,14 @@
pwmsensor_a = static_library(
'pwmsensor_a',
'src/PwmSensor.cpp',
- dependencies: [ sdbusplus, thresholds_dep ],
+ dependencies: [ default_deps, thresholds_dep ],
implicit_include_directories: false,
include_directories: 'include',
)
pwmsensor_dep = declare_dependency(
link_with: [ pwmsensor_a ],
- dependencies: [ sdbusplus, thresholds_dep ],
+ dependencies: [ default_deps, thresholds_dep ],
)
subdir('include')
diff --git a/src/meson.build b/src/meson.build
index 9b6def6..8c398e3 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -9,8 +9,8 @@
'ADCSensor.cpp',
'ADCSensorMain.cpp',
dependencies: [
+ default_deps,
gpiodcxx,
- sdbusplus,
thresholds_dep,
utils_dep,
],
@@ -26,8 +26,8 @@
'CPUSensorMain.cpp',
'CPUSensor.cpp',
dependencies: [
+ default_deps,
gpiodcxx,
- sdbusplus,
thresholds_dep,
utils_dep,
],
@@ -44,7 +44,7 @@
'exitairtempsensor',
'ExitAirTempSensor.cpp',
dependencies: [
- sdbusplus,
+ default_deps,
thresholds_dep,
utils_dep,
],
@@ -61,8 +61,8 @@
'TachSensor.cpp',
'PwmSensor.cpp',
dependencies: [
+ default_deps,
gpiodcxx,
- sdbusplus,
thresholds_dep,
utils_dep,
],
@@ -78,7 +78,7 @@
'HwmonTempMain.cpp',
'HwmonTempSensor.cpp',
dependencies: [
- sdbusplus,
+ default_deps,
thresholds_dep,
utils_dep,
],
@@ -94,9 +94,9 @@
'ChassisIntrusionSensor.cpp',
'IntrusionSensorMain.cpp',
dependencies: [
+ default_deps,
gpiodcxx,
i2c,
- sdbusplus,
utils_dep,
],
implicit_include_directories: false,
@@ -110,7 +110,7 @@
'ipmbsensor',
'IpmbSensor.cpp',
dependencies: [
- sdbusplus,
+ default_deps,
thresholds_dep,
utils_dep,
],
@@ -125,8 +125,8 @@
'mcutempsensor',
'MCUTempSensor.cpp',
dependencies: [
+ default_deps,
i2c,
- sdbusplus,
thresholds_dep,
utils_dep,
],
@@ -144,12 +144,12 @@
'NVMeSensor.cpp',
'NVMeMCTPContext.cpp',
dependencies: [
+ default_deps,
i2c,
mctp,
- sdbusplus,
thresholds_dep,
utils_dep,
- ],
+ ],
implicit_include_directories: false,
include_directories: '../include',
install: true,
@@ -163,8 +163,8 @@
'PSUSensor.cpp',
'PSUSensorMain.cpp',
dependencies: [
+ default_deps,
pwmsensor_dep,
- sdbusplus,
thresholds_dep,
utils_dep,
],
@@ -180,7 +180,7 @@
'ExternalSensor.cpp',
'ExternalSensorMain.cpp',
dependencies: [
- sdbusplus,
+ default_deps,
thresholds_dep,
utils_dep,
],