meson: enable full subproject build
Misc changes to the build process and adding wrap-files so that
the full repository can be built as a meson subproject. This
depends on a few pending changes upstream in phosphor-host-ipmid,
but since that subproject references HEAD it will automatically
resolve as those changes are merged.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Idfe21c8d347c513667d7358af0c4a4ddcf3f181b
diff --git a/meson.build b/meson.build
index 8f93171..9679cc5 100644
--- a/meson.build
+++ b/meson.build
@@ -50,19 +50,31 @@
root_inc = include_directories('.', 'include')
# Dependencies
+sdbusplus_dep = dependency('sdbusplus')
+phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
phosphor_logging_dep = dependency('phosphor-logging')
-sdbusplus_dep = dependency('sdbusplus', required : false, include_type: 'system')
ipmid_dep = dependency('libipmid')
-channellayer_dep = cpp.find_library('channellayer', required: true)
-userlayer_dep = cpp.find_library('userlayer', required: true)
+channellayer_dep = dependency('libchannellayer')
+userlayer_dep = dependency('libuserlayer')
+
+if cpp.has_header_symbol(
+ 'nlohmann/json.hpp',
+ 'nlohmann::json::string_t',
+ required:false)
+ nlohmann_json_dep = declare_dependency()
+else
+ nlohmann_json_dep = dependency('nlohmann-json')
+endif
zfboemcmds_pre = declare_dependency(
include_directories: root_inc,
dependencies: [
+ channellayer_dep,
+ ipmid_dep,
+ nlohmann_json_dep,
+ phosphor_dbus_interfaces_dep,
phosphor_logging_dep,
sdbusplus_dep,
- ipmid_dep,
- channellayer_dep,
userlayer_dep,
])
diff --git a/subprojects/nlohmann-json.wrap b/subprojects/nlohmann-json.wrap
new file mode 100644
index 0000000..a2884b1
--- /dev/null
+++ b/subprojects/nlohmann-json.wrap
@@ -0,0 +1,6 @@
+[wrap-git]
+url = https://github.com/nlohmann/json
+revision = HEAD
+
+[provide]
+nlohmann-json = nlohmann_json_dep
diff --git a/subprojects/phosphor-dbus-interfaces.wrap b/subprojects/phosphor-dbus-interfaces.wrap
new file mode 100644
index 0000000..346aa0c
--- /dev/null
+++ b/subprojects/phosphor-dbus-interfaces.wrap
@@ -0,0 +1,6 @@
+[wrap-git]
+url = https://github.com/openbmc/phosphor-dbus-interfaces.git
+revision = HEAD
+
+[provide]
+phosphor-dbus-interfaces = phosphor_dbus_interfaces_dep
diff --git a/subprojects/phosphor-host-ipmid.wrap b/subprojects/phosphor-host-ipmid.wrap
new file mode 100644
index 0000000..4eb85a2
--- /dev/null
+++ b/subprojects/phosphor-host-ipmid.wrap
@@ -0,0 +1,8 @@
+[wrap-git]
+url = https://github.com/openbmc/phosphor-host-ipmid
+revision = HEAD
+
+[provide]
+libipmid = ipmid_dep
+libchannellayer = channellayer_dep
+libuserlayer = userlayer_dep