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: If0797ab803bbc5b254487e2050c69deceb829976
diff --git a/meson.build b/meson.build
index 8003366..48c7c27 100644
--- a/meson.build
+++ b/meson.build
@@ -27,38 +27,20 @@
cpp = meson.get_compiler('cpp')
build_tests = get_option('tests')
-gpiodcxx = dependency(
- 'libgpiodcxx',
- fallback: ['libgpiod', 'gpiodcxx_dep'],
+gpiodcxx = dependency('libgpiodcxx',
default_options: ['bindings=cxx'],
)
# i2c-tools doesn't ship a pkg-config file for libi2c
i2c = meson.get_compiler('cpp').find_library('i2c')
-sdbusplus = dependency(
- 'sdbusplus',
- fallback: [
- 'sdbusplus',
- 'sdbusplus_dep'
- ],
-)
-
-phosphor_logging_dep = dependency(
- 'phosphor-logging',
- fallback: ['phosphor-logging', 'phosphor_logging_dep'],
-)
+sdbusplus = dependency('sdbusplus')
+phosphor_logging_dep = dependency('phosphor-logging')
if cpp.has_header('nlohmann/json.hpp')
nlohmann_json = declare_dependency()
else
- subproject('nlohmann-json')
- nlohmann_json = declare_dependency(
- include_directories: include_directories(
- 'subprojects/nlohmann-json/single_include',
- 'subprojects/nlohmann-json/single_include/nlohmann',
- )
- )
+ nlohmann_json = dependency('nlohmann_json')
endif
systemd = dependency('systemd')
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-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..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