build: add wrapfiles for dependencies

Update meson.build and add wrapfiles so that all dependencies
are handled as subprojects.  This allows builds completely
outside of bitbake or an SDK.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Id9e46013671d1d407b13549c29c15770c1c6fb2c
diff --git a/.gitignore b/.gitignore
index de8712e..6da54be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 build*/
-subprojects/*/
+subprojects/*
+!subprojects/*.wrap
diff --git a/meson.build b/meson.build
index de28513..8fcb47e 100644
--- a/meson.build
+++ b/meson.build
@@ -17,6 +17,17 @@
     )
 endif
 
+if cpp.has_header('nlomann/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(
     'virtual-sensor',
@@ -24,12 +35,28 @@
         'virtualSensor.cpp',
     ],
     dependencies: [
-        dependency('phosphor-logging'),
-        dependency('sdbusplus'),
-        dependency('phosphor-dbus-interfaces'),
-        dependency('sdeventplus'),
+        dependency(
+            'phosphor-logging',
+            fallback: ['phosphor-logging', 'phosphor_logging_dep'],
+        ),
+        dependency(
+            'sdbusplus',
+            fallback: ['sdbusplus', 'sdbusplus_dep' ],
+        ),
+        dependency(
+            'phosphor-dbus-interfaces',
+            fallback: [
+                'phosphor-dbus-interfaces',
+                'phosphor_dbus_interfaces_dep'
+            ],
+        ),
+        dependency(
+            'sdeventplus',
+            fallback: ['sdeventplus', 'sdeventplus_dep'],
+        ),
         dependency('fmt'),
         exprtk,
+        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