build: Fix boost dependency
Currently local build fails with a message:
"""
src/meson.build:16:14: ERROR: Include dir subprojects/boost_1_78_0/
does not exist
"""
The error is happening because the correct path for the includes should
not be "subprojects/boost_1_79_0/" but "../subprojects/boost_1_79_0/".
But such relative links are deprecated, therefore rewrite boost
dependency with its own packagefile.
Also boost library is required for the project build, therefore drop
"required: false" statement for the dependency.
And since boost is required for the libeStoragedErase, add boost_dep to
its dependencies.
Tested:
"meson setup build && cd build && meson compile" now works without any
issues.
Change-Id: Id0afda7563c944f3afc88cd1f59099794611525e
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
diff --git a/.gitignore b/.gitignore
index cd1bc79..03fff9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/subprojects/*
!/subprojects/*.wrap
!/subprojects/.clang-tidy-ignore
+!/subprojects/packagefiles
# build directory
build*/*
diff --git a/src/erase/meson.build b/src/erase/meson.build
index 57329c2..d8e7acb 100644
--- a/src/erase/meson.build
+++ b/src/erase/meson.build
@@ -11,6 +11,7 @@
phosphor_dbus_interfaces_dep,
phosphor_logging_dep,
stdplus_dep,
+ boost_dep,
],
)
diff --git a/src/meson.build b/src/meson.build
index 4383d72..bbbc165 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -10,13 +10,7 @@
stdplus_dep = dependency('stdplus')
-boost_dep = dependency('boost',version : '>=1.78.0', required : false, include_type: 'system')
-if not boost_dep.found()
- subproject('boost', required: false)
- boost_inc = include_directories('subprojects/boost_1_78_0/', is_system:true)
- boost = declare_dependency(include_directories : boost_inc)
- boost = boost.as_system('system')
-endif
+boost_dep = dependency('boost',version : '>=1.78.0', include_type: 'system')
subdir('erase')
diff --git a/subprojects/boost.wrap b/subprojects/boost.wrap
index 2f7a22f..179e762 100644
--- a/subprojects/boost.wrap
+++ b/subprojects/boost.wrap
@@ -1,4 +1,6 @@
[wrap-file]
+directory = boost_1_78_0
source_url = https://downloads.yoctoproject.org/mirror/sources/boost_1_78_0.tar.bz2
source_hash = 8681f175d4bdb26c52222665793eef08490d7758529330f98d3b29dd0735bccc
source_filename = 1_78_0.tar.bz2
+patch_directory = boost
diff --git a/subprojects/packagefiles/boost/meson.build b/subprojects/packagefiles/boost/meson.build
new file mode 100644
index 0000000..bb0279b
--- /dev/null
+++ b/subprojects/packagefiles/boost/meson.build
@@ -0,0 +1,11 @@
+project('boost',
+ 'cpp',
+ version : '1.78.0',
+ license : 'Boost'
+)
+
+boost_dep = declare_dependency(
+ include_directories : include_directories('.'),
+)
+
+meson.override_dependency('boost', boost_dep)