meson: add subprojects to build

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ia7a24e92715cca5ee890d67d7b645feada4ec68b
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6da54be
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+build*/
+subprojects/*
+!subprojects/*.wrap
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')
diff --git a/subprojects/nlohmann-json.wrap b/subprojects/nlohmann-json.wrap
new file mode 100644
index 0000000..9096612
--- /dev/null
+++ b/subprojects/nlohmann-json.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+url = https://github.com/nlohmann/json.git
+revision = HEAD
diff --git a/subprojects/phosphor-dbus-interfaces.wrap b/subprojects/phosphor-dbus-interfaces.wrap
new file mode 100644
index 0000000..935a8b2
--- /dev/null
+++ b/subprojects/phosphor-dbus-interfaces.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+url = https://github.com/openbmc/phosphor-dbus-interfaces.git
+revision = HEAD
diff --git a/subprojects/phosphor-logging.wrap b/subprojects/phosphor-logging.wrap
new file mode 100644
index 0000000..a039fcf
--- /dev/null
+++ b/subprojects/phosphor-logging.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+url = https://github.com/openbmc/phosphor-logging.git
+revision = HEAD
diff --git a/subprojects/sdbusplus.wrap b/subprojects/sdbusplus.wrap
new file mode 100644
index 0000000..d470130
--- /dev/null
+++ b/subprojects/sdbusplus.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+url = https://github.com/openbmc/sdbusplus.git
+revision = HEAD
diff --git a/subprojects/sdeventplus.wrap b/subprojects/sdeventplus.wrap
new file mode 100644
index 0000000..085bb5e
--- /dev/null
+++ b/subprojects/sdeventplus.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+url = https://github.com/openbmc/sdeventplus.git
+revision = HEAD