diff options
author | Artturin <Artturin@artturin.com> | 2024-05-31 00:04:41 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2024-06-23 12:30:34 +0300 |
commit | c21b886ba8a60cce7fa56e4be40bd7547129fb00 (patch) | |
tree | 92bffea23a0ae1c3995a2d152fc69e6c897e7ffe | |
parent | 24cddb6901d8c0421bcff4daa465e422e2d27f44 (diff) | |
download | meson-c21b886ba8a60cce7fa56e4be40bd7547129fb00.zip meson-c21b886ba8a60cce7fa56e4be40bd7547129fb00.tar.gz meson-c21b886ba8a60cce7fa56e4be40bd7547129fb00.tar.bz2 |
dependencies/boost.py: Allow getting `lib_dir` and `include_dir` via pkg-config
`boost_root` doesn't work if lib and include are in different directories like in the `nix` `boost` package.
The `prefix` checking could probably be removed, in 2019 conan (the
reason why the check was added) had `libdir` and `includedir` in its
generated pkg-config file
https://www.github.com/mesonbuild/meson/issues/5438#issuecomment-498761454
If there's no return then boost isn't found for some reason, further
logic is unnecessary in any case if direct paths are passed.
`roots += [Path(boost_lib_dir), Path(boost_inc_dir)]` did not work
-rw-r--r-- | mesonbuild/dependencies/boost.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py index 02aa1ea..7a46163 100644 --- a/mesonbuild/dependencies/boost.py +++ b/mesonbuild/dependencies/boost.py @@ -653,9 +653,19 @@ class BoostDependency(SystemDependency): try: boost_pc = PkgConfigDependency('boost', self.env, {'required': False}) if boost_pc.found(): - boost_root = boost_pc.get_variable(pkgconfig='prefix') - if boost_root: - roots += [Path(boost_root)] + boost_lib_dir = boost_pc.get_variable(pkgconfig='libdir') + boost_inc_dir = boost_pc.get_variable(pkgconfig='includedir') + if boost_lib_dir and boost_inc_dir: + mlog.debug('Trying to find boost with:') + mlog.debug(f' - boost_includedir = {Path(boost_inc_dir)}') + mlog.debug(f' - boost_librarydir = {Path(boost_lib_dir)}') + + self.detect_split_root(Path(boost_inc_dir), Path(boost_lib_dir)) + return + else: + boost_root = boost_pc.get_variable(pkgconfig='prefix') + if boost_root: + roots += [Path(boost_root)] except DependencyException: pass |