meson: simplify dependencies
Leverage wrapfile `[provide]` directives to simplify the dependency
searching in the meson.build. phosphor-dbus-interfaces now defaults to
enabling all of the project options, so there is no need to manually
specify this either.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I550667da15ce8347acfede53a60516a0428bad2b
diff --git a/extensions/openpower-pels/meson.build b/extensions/openpower-pels/meson.build
index bfa3889..7116668 100644
--- a/extensions/openpower-pels/meson.build
+++ b/extensions/openpower-pels/meson.build
@@ -1,6 +1,5 @@
libpldm_dep = dependency(
'libpldm',
- fallback: ['pldm', 'libpldm_dep'],
default_options: ['libpldm-only=enabled', 'oem-ibm=enabled'],
)
@@ -23,10 +22,7 @@
if cpp.has_header('CLI/CLI.hpp')
CLI11_dep = declare_dependency()
else
- CLI11_dep = dependency(
- 'CLI11',
- fallback: [ 'CLI11', 'CLI11_dep' ],
- )
+ CLI11_dep = dependency('CLI11')
endif
extra_sources = []
diff --git a/meson.build b/meson.build
index f965bcb..86d0499 100644
--- a/meson.build
+++ b/meson.build
@@ -10,28 +10,16 @@
],
version: '1.0.0',
)
+cpp = meson.get_compiler('cpp')
python_prog = find_program('python3', native: true)
systemd_dep = dependency('systemd')
-sdbusplus_dep = dependency('sdbusplus', required: false)
-sdbusplus_proj = dependency('', required: false)
-if not sdbusplus_dep.found() or sdbusplus_dep.type_name() == 'internal'
- sdbusplus_proj = subproject('sdbusplus')
-endif
-if not sdbusplus_dep.found()
- sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep')
-endif
+sdbusplus_dep = dependency('sdbusplus')
+sdbusplusplus_prog = find_program('sdbus++', native: true)
+sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
-pdi_vars = []
-if not get_option('openpower-pel-extension').disabled()
- pdi_vars += ['data_org_open_power=true']
-endif
-pdi_dep = dependency(
- 'phosphor-dbus-interfaces',
- fallback: ['phosphor-dbus-interfaces', 'phosphor_dbus_interfaces_dep'],
- default_options: pdi_vars,
-)
+pdi_dep = dependency('phosphor-dbus-interfaces')
# Find the installed YAML directory, either from a configure option or
# by pulling it from the PDI dependency.
@@ -48,21 +36,7 @@
subdir_done()
endif
-cpp = meson.get_compiler('cpp')
-
-if sdbusplus_proj.found()
- sdbusplusplus_prog = sdbusplus_proj.get_variable('sdbusplusplus_prog')
- sdbuspp_gen_meson_prog = sdbusplus_proj.get_variable(
- 'sdbuspp_gen_meson_prog')
-else
- sdbusplusplus_prog = find_program('sdbus++', native: true)
- sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
-endif
-
-sdeventplus_dep = dependency(
- 'sdeventplus',
- fallback: ['sdeventplus', 'sdeventplus_dep' ],
-)
+sdeventplus_dep = dependency('sdeventplus')
# Get Cereal dependency.
cereal_dep = dependency('cereal', required: false)
diff --git a/subprojects/CLI11.wrap b/subprojects/CLI11.wrap
index e695a9d..2e5a95b 100644
--- a/subprojects/CLI11.wrap
+++ b/subprojects/CLI11.wrap
@@ -1,3 +1,6 @@
[wrap-git]
url = https://github.com/CLIUtils/CLI11.git
revision = HEAD
+
+[provide]
+CLI11 = CLI11_dep
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/pldm.wrap b/subprojects/pldm.wrap
index a49a2eb..f85d293 100644
--- a/subprojects/pldm.wrap
+++ b/subprojects/pldm.wrap
@@ -1,3 +1,6 @@
[wrap-git]
url = https://github.com/openbmc/pldm.git
revision = HEAD
+
+[provide]
+libpldm = libpldm_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
diff --git a/subprojects/sdeventplus.wrap b/subprojects/sdeventplus.wrap
index 085bb5e..f871ac0 100644
--- a/subprojects/sdeventplus.wrap
+++ b/subprojects/sdeventplus.wrap
@@ -1,3 +1,6 @@
[wrap-git]
url = https://github.com/openbmc/sdeventplus.git
revision = HEAD
+
+[provide]
+sdeventplus = sdeventplus_dep