dependency: boost: only consult environment at initial stage

... not when getting compiler and link arguments

Would be nice to have some tests, but that requires boost in a
non-standard location.
pull/1820/merge
Wade Berrier 8 years ago committed by Jussi Pakkanen
parent 4a4322064e
commit ad1b487285
  1. 18
      mesonbuild/dependencies/misc.py

@ -35,7 +35,7 @@ class BoostDependency(ExternalDependency):
def __init__(self, environment, kwargs): def __init__(self, environment, kwargs):
super().__init__('boost', environment, 'cpp', kwargs) super().__init__('boost', environment, 'cpp', kwargs)
self.libdir = '' self.libdir = None
try: try:
self.boost_root = os.environ['BOOST_ROOT'] self.boost_root = os.environ['BOOST_ROOT']
if not os.path.isabs(self.boost_root): if not os.path.isabs(self.boost_root):
@ -56,6 +56,9 @@ class BoostDependency(ExternalDependency):
self.incdir = os.environ['BOOST_INCLUDEDIR'] self.incdir = os.environ['BOOST_INCLUDEDIR']
else: else:
self.incdir = '/usr/include' self.incdir = '/usr/include'
if 'BOOST_LIBRARYDIR' in os.environ:
self.libdir = os.environ['BOOST_LIBRARYDIR']
else: else:
self.incdir = os.path.join(self.boost_root, 'include') self.incdir = os.path.join(self.boost_root, 'include')
self.boost_inc_subdir = os.path.join(self.incdir, 'boost') self.boost_inc_subdir = os.path.join(self.incdir, 'boost')
@ -183,7 +186,9 @@ class BoostDependency(ExternalDependency):
if not libdir: if not libdir:
return return
libdir = libdir[0] libdir = libdir[0]
self.libdir = libdir # Don't override what was set in the environment
if self.libdir:
self.libdir = libdir
globber = 'libboost_*-gd-*.lib' if self.static else 'boost_*-gd-*.lib' # FIXME globber = 'libboost_*-gd-*.lib' if self.static else 'boost_*-gd-*.lib' # FIXME
for entry in glob.glob(os.path.join(libdir, globber)): for entry in glob.glob(os.path.join(libdir, globber)):
(_, fname) = os.path.split(entry) (_, fname) = os.path.split(entry)
@ -200,8 +205,8 @@ class BoostDependency(ExternalDependency):
libsuffix = 'so' libsuffix = 'so'
globber = 'libboost_*.{}'.format(libsuffix) globber = 'libboost_*.{}'.format(libsuffix)
if 'BOOST_LIBRARYDIR' in os.environ: if self.libdir:
libdirs = [os.environ['BOOST_LIBRARYDIR']] libdirs = [self.libdir]
elif self.boost_root is None: elif self.boost_root is None:
libdirs = mesonlib.get_library_dirs() libdirs = mesonlib.get_library_dirs()
else: else:
@ -219,6 +224,7 @@ class BoostDependency(ExternalDependency):
def get_win_link_args(self): def get_win_link_args(self):
args = [] args = []
# TODO: should this check self.libdir?
if self.boost_root: if self.boost_root:
args.append('-L' + self.libdir) args.append('-L' + self.libdir)
for module in self.requested_modules: for module in self.requested_modules:
@ -233,8 +239,8 @@ class BoostDependency(ExternalDependency):
args = [] args = []
if self.boost_root: if self.boost_root:
args.append('-L' + os.path.join(self.boost_root, 'lib')) args.append('-L' + os.path.join(self.boost_root, 'lib'))
elif 'BOOST_LIBRARYDIR' in os.environ: elif self.libdir:
args.append('-L' + os.environ['BOOST_LIBRARYDIR']) args.append('-L' + self.libdir)
for module in self.requested_modules: for module in self.requested_modules:
module = BoostDependency.name2lib.get(module, module) module = BoostDependency.name2lib.get(module, module)
libname = 'boost_' + module libname = 'boost_' + module

Loading…
Cancel
Save