From b89af8b6dd0efc97867be96e91630d8a1c4d3316 Mon Sep 17 00:00:00 2001 From: Wade Berrier Date: Wed, 5 Apr 2017 08:03:46 -0600 Subject: [PATCH] Add support for BOOST_INCLUDEDIR and BOOST_LIBRARYDIR In case they are not decendants of BOOST_ROOT... (Idea copied from CMake FindBoost) Fix for #1562 authors.txt: add myself as requested --- authors.txt | 1 + mesonbuild/dependencies.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/authors.txt b/authors.txt index 50c032b2cae0..8117d454ece9 100644 --- a/authors.txt +++ b/authors.txt @@ -77,3 +77,4 @@ Philipp Ittershagen Dylan Baker Aaron Plattner Jon Turney +Wade Berrier diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py index 7f22ae6aa595..2b110bbfd7ee 100644 --- a/mesonbuild/dependencies.py +++ b/mesonbuild/dependencies.py @@ -598,12 +598,18 @@ def __init__(self, environment, kwargs): self.boost_root = None if self.boost_root is None: if self.want_cross: - raise DependencyException('BOOST_ROOT is needed while cross-compiling') + if 'BOOST_INCLUDEDIR' in os.environ: + self.incdir = os.environ['BOOST_INCLUDEDIR'] + else: + raise DependencyException('BOOST_ROOT or BOOST_INCLUDEDIR is needed while cross-compiling') if mesonlib.is_windows(): self.boost_root = self.detect_win_root() self.incdir = self.boost_root else: - self.incdir = '/usr/include' + if 'BOOST_INCLUDEDIR' in os.environ: + self.incdir = os.environ['BOOST_INCLUDEDIR'] + else: + self.incdir = '/usr/include' else: self.incdir = os.path.join(self.boost_root, 'include') self.boost_inc_subdir = os.path.join(self.incdir, 'boost') @@ -727,7 +733,9 @@ def detect_lib_modules_nix(self): libsuffix = 'so' globber = 'libboost_*.{}'.format(libsuffix) - if self.boost_root is None: + if 'BOOST_LIBRARYDIR' in os.environ: + libdirs = [os.environ['BOOST_LIBRARYDIR']] + elif self.boost_root is None: libdirs = mesonlib.get_library_dirs() else: libdirs = [os.path.join(self.boost_root, 'lib')] @@ -758,6 +766,8 @@ def get_link_args(self): args = [] if self.boost_root: args.append('-L' + os.path.join(self.boost_root, 'lib')) + elif 'BOOST_LIBRARYDIR' in os.environ: + args.append('-L' + os.environ['BOOST_LIBRARYDIR']) for module in self.requested_modules: module = BoostDependency.name2lib.get(module, module) libname = 'boost_' + module