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: Ia696d865d344ecc105fc7fb009c8419f8727ee02
diff --git a/meson.build b/meson.build
index abd5d4f..d86b450 100644
--- a/meson.build
+++ b/meson.build
@@ -68,36 +68,20 @@
cpp = meson.get_compiler('cpp')
if get_option('libpldm-only').disabled()
- phosphor_dbus_interfaces = dependency(
- 'phosphor-dbus-interfaces',
- fallback: ['phosphor-dbus-interfaces', 'phosphor_dbus_interfaces_dep'],
- )
- sdbusplus = dependency(
- 'sdbusplus',
- fallback: ['sdbusplus', 'sdbusplus_dep'],
- )
- sdeventplus = dependency(
- 'sdeventplus',
- fallback: ['sdeventplus', 'sdeventplus_dep'],
- )
+ phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
+ sdbusplus = dependency('sdbusplus')
+ sdeventplus = dependency('sdeventplus')
+
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',
- ]
- )
+ nlohmann_json = dependency('nlohmann_json')
endif
+
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
if cpp.has_header_symbol('function2/function2.hpp', 'fu2::unique_function')
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/nlohmann-json.wrap b/subprojects/nlohmann-json.wrap
index 9096612..dbe7d46 100644
--- a/subprojects/nlohmann-json.wrap
+++ b/subprojects/nlohmann-json.wrap
@@ -1,3 +1,6 @@
[wrap-git]
url = https://github.com/nlohmann/json.git
revision = HEAD
+
+[provide]
+nlohmann_json = nlohmann_json_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/sdbusplus.wrap b/subprojects/sdbusplus.wrap
index d470130..7b076d0 100644
--- a/subprojects/sdbusplus.wrap
+++ b/subprojects/sdbusplus.wrap
@@ -1,3 +1,6 @@
[wrap-git]
url = https://github.com/openbmc/sdbusplus.git
revision = HEAD
+
+[provide]
+sdbusplus = sdbusplus_dep
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