Skip to content

Commit

Permalink
Add support for BOOST_INCLUDEDIR and BOOST_LIBRARYDIR
Browse files Browse the repository at this point in the history
In case they are not decendants of BOOST_ROOT...

(Idea copied from CMake FindBoost)

Fix for mesonbuild#1562

authors.txt: add myself as requested
  • Loading branch information
wberrier authored and jpakkane committed Apr 8, 2017
1 parent 79208fd commit b89af8b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions authors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ Philipp Ittershagen
Dylan Baker
Aaron Plattner
Jon Turney
Wade Berrier
16 changes: 13 additions & 3 deletions mesonbuild/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b89af8b

Please sign in to comment.