meson: add subprojects to build
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ia7a24e92715cca5ee890d67d7b645feada4ec68b
diff --git a/meson.build b/meson.build
index e117413..240ff40 100644
--- a/meson.build
+++ b/meson.build
@@ -8,16 +8,46 @@
meson_version: '>=0.57.0',
)
+cpp = meson.get_compiler('cpp')
+
+if cpp.has_header('nlohmann/json.hpp')
+ nlohmann_json = declare_dependency()
+else
+ subproject('nlohmann-json')
+ nlohmann_json = declare_dependency(
+ include_directories: [
+ 'subprojects/nlohmann-json/single_include',
+ 'subprojects/nlohmann-json/single_include/nlohmann',
+ ]
+ )
+endif
+
executable(
'health-monitor',
[
'healthMonitor.cpp',
],
dependencies: [
- dependency('phosphor-logging'),
- dependency('sdbusplus'),
- dependency('phosphor-dbus-interfaces'),
- dependency('sdeventplus'),
+ dependency(
+ 'phosphor-dbus-interfaces',
+ fallback: [
+ 'phosphor-dbus-interfaces',
+ 'phosphor_dbus_interfaces_dep',
+ ],
+ ),
+ dependency(
+ 'phosphor-logging',
+ fallback: [ 'phosphor-logging', 'phosphor_logging_dep' ],
+ ),
+ dependency(
+ 'sdbusplus',
+ fallback: [ 'sdbusplus', 'sdbusplus_dep' ],
+ ),
+ dependency(
+ 'sdeventplus',
+ fallback: [ 'sdeventplus', 'sdeventplus_dep' ],
+ ),
+ nlohmann_json,
],
install: true,
install_dir: get_option('bindir')