meson: simplify dependencies
Leverage wrapfile `[provide]` directives to simplify the dependency
searching in the meson.build.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iba53eac924b7622f8c819c70c64279a2df0d28c4
diff --git a/meson.build b/meson.build
index 0e53730..0825c96 100644
--- a/meson.build
+++ b/meson.build
@@ -19,32 +19,12 @@
libsystemd = dependency('libsystemd', version : '>=221')
-sdbusplus_dep = dependency('sdbusplus', required: false)
-if sdbusplus_dep.found()
- sdbusplusplus_prog = find_program('sdbus++')
- sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson')
-else
- sdbusplus_proj = subproject('sdbusplus', required: true)
- sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep')
- sdbusplusplus_prog = sdbusplus_proj.get_variable('sdbusplusplus_prog')
- sdbuspp_gen_meson_prog = sdbusplus_proj.get_variable(
- 'sdbuspp_gen_meson_prog'
- )
-endif
-phosphor_dbus_interfaces_dep = dependency(
- 'phosphor-dbus-interfaces',
- fallback: [
- 'phosphor-dbus-interfaces',
- 'phosphor_dbus_interfaces_dep'
- ],
-)
-phosphor_logging_dep = dependency(
- 'phosphor-logging',
- fallback: [
- 'phosphor-logging',
- 'phosphor_logging_dep'
- ],
-)
+sdbusplus_dep = dependency('sdbusplus')
+sdbusplusplus_prog = find_program('sdbus++')
+sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson')
+
+phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
+phosphor_logging_dep = dependency('phosphor-logging')
fmt_dep = dependency('fmt', required: false)
if not fmt_dep.found()
diff --git a/subprojects/phosphor-dbus-interfaces.wrap b/subprojects/phosphor-dbus-interfaces.wrap
index 935a8b2..346aa0c 100644
--- a/subprojects/phosphor-dbus-interfaces.wrap
+++ b/subprojects/phosphor-dbus-interfaces.wrap
@@ -1,3 +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-logging.wrap b/subprojects/phosphor-logging.wrap
index a039fcf..71eee8b 100644
--- a/subprojects/phosphor-logging.wrap
+++ b/subprojects/phosphor-logging.wrap
@@ -1,3 +1,6 @@
[wrap-git]
url = https://github.com/openbmc/phosphor-logging.git
revision = HEAD
+
+[provide]
+phosphor-logging = phosphor_logging_dep
diff --git a/subprojects/sdbusplus.wrap b/subprojects/sdbusplus.wrap
index d470130..edd9a31 100644
--- a/subprojects/sdbusplus.wrap
+++ b/subprojects/sdbusplus.wrap
@@ -1,3 +1,7 @@
[wrap-git]
url = https://github.com/openbmc/sdbusplus.git
revision = HEAD
+
+[provide]
+sdbusplus = sdbusplus_dep
+program_names = sdbus++, sdbus++-gen-meson