meson: add necessary subprojects
Add subprojects for all the direct dependencies of the project such
that the project can be built outside of a Yocto SDK on a typical
Linux development system.
- Update the .gitignore to ignore the subproject source directories.
- Update the .gitignore to ignore alternative build subdirectory
names as is typical with most projects in the openbmc organization.
- Add wrap files for direct dependencies, copied from other
repositories that already have the same dependencies.
- Modify the meson.build dependency for libgpiod so that the C++
bindings are included.
- Add many missing dependencies throughout.
- Sort all dependencies alphabetically for consistency.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I0feb6f0f175e6dba0b00a2c2b666eb0801575734
diff --git a/.gitignore b/.gitignore
index 9800e6b..4180e57 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
-build/
+build*/
+subprojects/*
+!subprojects/*.wrap
*.sw*
tags
diff --git a/cold-redundancy/meson.build b/cold-redundancy/meson.build
index 2595682..4fd465e 100644
--- a/cold-redundancy/meson.build
+++ b/cold-redundancy/meson.build
@@ -4,12 +4,13 @@
'cold_redundancy.cpp',
'util.cpp',
dependencies: [
+ boost,
+ nlohmann_json_dep,
phosphor_dbus_interfaces,
phosphor_logging,
+ pthread,
sdbusplus,
systemd,
- pthread,
- boost,
],
include_directories: [
'.',
diff --git a/meson.build b/meson.build
index a590265..a531922 100644
--- a/meson.build
+++ b/meson.build
@@ -13,6 +13,8 @@
meson_version: '>=0.58.0',
)
+cxx = meson.get_compiler('cpp')
+
build_tests = get_option('tests')
if get_option('oe-sdk').enabled()
@@ -42,7 +44,26 @@
stdplus = dependency('stdplus')
boost = dependency('boost')
fmt = dependency('fmt')
-libgpiodcxx = dependency('libgpiodcxx')
+libgpiodcxx = dependency('libgpiodcxx',
+ default_options: ['bindings=cxx'])
+
+if cxx.has_header('nlohmann/json.hpp')
+ nlohmann_json_dep = declare_dependency()
+else
+ subproject('nlohmann', required: false)
+ nlohmann_json_dep = declare_dependency(
+ include_directories: [
+ 'subprojects/nlohmann-json/single_include',
+ 'subprojects/nlohmann-json/single_include/nlohmann',
+ ]
+ )
+endif
+
+if cxx.has_header('CLI/CLI.hpp')
+ cli11_dep = declare_dependency()
+else
+ cli11_dep = dependency('CLI11')
+endif
systemd = dependency('systemd')
servicedir = systemd.get_variable('systemdsystemunitdir')
@@ -112,6 +133,7 @@
'pmbus.cpp',
'utility.cpp',
dependencies: [
+ nlohmann_json_dep,
phosphor_dbus_interfaces,
phosphor_logging,
sdbusplus,
diff --git a/phosphor-power-sequencer/src/meson.build b/phosphor-power-sequencer/src/meson.build
index 590e10e..3d1c8d0 100644
--- a/phosphor-power-sequencer/src/meson.build
+++ b/phosphor-power-sequencer/src/meson.build
@@ -12,10 +12,11 @@
'ucd90320_monitor.cpp',
dependencies: [
libgpiodcxx,
+ nlohmann_json_dep,
phosphor_logging,
sdbusplus,
sdeventplus,
- stdplus
+ stdplus,
],
link_with: [
libpower
diff --git a/phosphor-power-supply/meson.build b/phosphor-power-supply/meson.build
index a222ac8..da64bd0 100644
--- a/phosphor-power-supply/meson.build
+++ b/phosphor-power-supply/meson.build
@@ -10,11 +10,14 @@
'record_manager.cpp',
'util.cpp',
dependencies: [
- sdbusplus,
- sdeventplus,
+ cli11_dep,
fmt,
libgpiodcxx,
+ nlohmann_json_dep,
phosphor_dbus_interfaces,
+ phosphor_logging,
+ sdbusplus,
+ sdeventplus,
],
include_directories: '..',
install: true,
diff --git a/phosphor-power-supply/test/meson.build b/phosphor-power-supply/test/meson.build
index ce429d5..386a37e 100644
--- a/phosphor-power-supply/test/meson.build
+++ b/phosphor-power-supply/test/meson.build
@@ -6,9 +6,11 @@
dependencies: [
gmock,
gtest,
+ libgpiodcxx,
+ nlohmann_json_dep,
+ phosphor_logging,
sdbusplus,
sdeventplus,
- phosphor_logging,
],
implicit_include_directories: false,
include_directories: [
diff --git a/phosphor-regulators/src/meson.build b/phosphor-regulators/src/meson.build
index 581343f..c448366 100644
--- a/phosphor-regulators/src/meson.build
+++ b/phosphor-regulators/src/meson.build
@@ -45,6 +45,12 @@
'phosphor-regulators',
phosphor_regulators_library_source_files,
implicit_include_directories: false,
+ dependencies: [
+ nlohmann_json_dep,
+ phosphor_dbus_interfaces,
+ phosphor_logging,
+ sdbusplus,
+ ],
include_directories: [
phosphor_regulators_include_directories,
libi2c_inc
@@ -58,10 +64,11 @@
'manager.cpp',
dependencies: [
libi2c_dep,
+ nlohmann_json_dep,
phosphor_logging,
sdbusplus,
sdeventplus,
- stdplus
+ stdplus,
],
link_with: [
phosphor_regulators_library,
@@ -76,7 +83,8 @@
'regsctl',
'regsctl/main.cpp',
dependencies: [
- sdbusplus
+ cli11_dep,
+ sdbusplus,
],
install: true
)
diff --git a/phosphor-regulators/test/meson.build b/phosphor-regulators/test/meson.build
index 3dc46f4..b290cd0 100644
--- a/phosphor-regulators/test/meson.build
+++ b/phosphor-regulators/test/meson.build
@@ -63,7 +63,10 @@
dependencies: [
gmock,
gtest,
- sdbusplus
+ nlohmann_json_dep,
+ phosphor_dbus_interfaces,
+ phosphor_logging,
+ sdbusplus,
],
link_args: dynamic_linker,
build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
diff --git a/power-sequencer/meson.build b/power-sequencer/meson.build
index d5f37cc..ea72127 100644
--- a/power-sequencer/meson.build
+++ b/power-sequencer/meson.build
@@ -30,11 +30,12 @@
'runtime_monitor.cpp',
sequencer_src,
dependencies: [
+ libi2c_dep,
+ nlohmann_json_dep,
phosphor_dbus_interfaces,
phosphor_logging,
sdbusplus,
sdeventplus,
- libi2c_dep,
],
include_directories: '..',
install: true,
diff --git a/power-supply/meson.build b/power-supply/meson.build
index 0273181..4bf1626 100644
--- a/power-supply/meson.build
+++ b/power-supply/meson.build
@@ -6,9 +6,11 @@
'power_supply.cpp',
'record_manager.cpp',
dependencies: [
+ nlohmann_json_dep,
phosphor_dbus_interfaces,
phosphor_logging,
sdbusplus,
+ sdeventplus,
],
include_directories: '..',
install: true,
diff --git a/subprojects/CLI11.wrap b/subprojects/CLI11.wrap
new file mode 100644
index 0000000..2e5a95b
--- /dev/null
+++ b/subprojects/CLI11.wrap
@@ -0,0 +1,6 @@
+[wrap-git]
+url = https://github.com/CLIUtils/CLI11.git
+revision = HEAD
+
+[provide]
+CLI11 = CLI11_dep
diff --git a/subprojects/fmt.wrap b/subprojects/fmt.wrap
new file mode 100644
index 0000000..6847ae5
--- /dev/null
+++ b/subprojects/fmt.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+url = https://github.com/fmtlib/fmt
+revision = HEAD
diff --git a/subprojects/libgpiod.wrap b/subprojects/libgpiod.wrap
new file mode 100644
index 0000000..f650e74
--- /dev/null
+++ b/subprojects/libgpiod.wrap
@@ -0,0 +1,13 @@
+[wrap-file]
+directory = libgpiod-1.6.3
+source_url = https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/snapshot/libgpiod-1.6.3.tar.gz
+source_filename = libgpiod-1.6.3.tar.gz
+source_hash = eb446070be1444fd7d32d32bbca53c2f3bbb0a21193db86198cf6050b7a28441
+patch_filename = libgpiod_1.6.3-1_patch.zip
+patch_url = https://wrapdb.mesonbuild.com/v2/libgpiod_1.6.3-1/get_patch
+patch_hash = 76821c637073679a88f77593c6f7ce65b4b5abf8c998f823fffa13918c8761df
+
+[provide]
+libgpiod = gpiod_dep
+libgpiodcxx = gpiodcxx_dep
+
diff --git a/subprojects/nlohmann-json.wrap b/subprojects/nlohmann-json.wrap
new file mode 100644
index 0000000..a77b7c9
--- /dev/null
+++ b/subprojects/nlohmann-json.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+revision = b3e5cb7f20dcc5c806e418df34324eca60d17d4e
+url = https://github.com/nlohmann/json.git
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-logging.wrap b/subprojects/phosphor-logging.wrap
new file mode 100644
index 0000000..71eee8b
--- /dev/null
+++ b/subprojects/phosphor-logging.wrap
@@ -0,0 +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
new file mode 100644
index 0000000..7b076d0
--- /dev/null
+++ b/subprojects/sdbusplus.wrap
@@ -0,0 +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
new file mode 100644
index 0000000..f871ac0
--- /dev/null
+++ b/subprojects/sdeventplus.wrap
@@ -0,0 +1,6 @@
+[wrap-git]
+url = https://github.com/openbmc/sdeventplus.git
+revision = HEAD
+
+[provide]
+sdeventplus = sdeventplus_dep
diff --git a/subprojects/stdplus.wrap b/subprojects/stdplus.wrap
new file mode 100644
index 0000000..2f8a5f4
--- /dev/null
+++ b/subprojects/stdplus.wrap
@@ -0,0 +1,6 @@
+[wrap-git]
+url = https://github.com/openbmc/stdplus.git
+revision = HEAD
+
+[provide]
+stdplus = stdplus_dep
diff --git a/tools/power-utils/meson.build b/tools/power-utils/meson.build
index 848c42f..d9e8a37 100644
--- a/tools/power-utils/meson.build
+++ b/tools/power-utils/meson.build
@@ -4,9 +4,11 @@
'updater.cpp',
'main.cpp',
dependencies: [
+ cli11_dep,
+ libi2c_dep,
+ nlohmann_json_dep,
phosphor_dbus_interfaces,
phosphor_logging,
- libi2c_dep,
],
include_directories: [libpower_inc, libi2c_inc],
install: true,
diff --git a/tools/power-utils/test/meson.build b/tools/power-utils/test/meson.build
index 9f49857..d5a134f 100644
--- a/tools/power-utils/test/meson.build
+++ b/tools/power-utils/test/meson.build
@@ -6,6 +6,7 @@
'../version.cpp',
dependencies: [
gtest,
+ nlohmann_json_dep,
phosphor_logging,
],
implicit_include_directories: false,
@@ -28,6 +29,7 @@
dependencies: [
gtest,
gmock,
+ nlohmann_json_dep,
phosphor_logging,
],
implicit_include_directories: false,