From 77494979237794702027bec7f8afb5f78e4cee47 Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Thu, 1 Feb 2018 12:36:30 -0500 Subject: Move log_fail() out of sub-method. --- mesonbuild/dependencies/misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 542de39..91dedc8 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -151,6 +151,7 @@ class BoostDependency(ExternalDependency): return if self.check_invalid_modules(): + self.log_fail() return mlog.debug('Boost library root dir is', mlog.bold(self.boost_root)) @@ -187,7 +188,6 @@ class BoostDependency(ExternalDependency): if invalid_modules: mlog.log(mlog.red('ERROR:'), 'Invalid Boost modules: ' + ', '.join(invalid_modules)) - self.log_fail() return True else: return False -- cgit v1.1 From a517c657fa44f679ef49de70b4bb04c7b742a51a Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Thu, 1 Feb 2018 12:55:19 -0500 Subject: Compute abi tags for windows also. --- mesonbuild/dependencies/misc.py | 52 +++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 91dedc8..507bc15 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -301,6 +301,46 @@ class BoostDependency(ExternalDependency): modname = modname[3:] return modname + def compiler_tag(self): + tag = None + if mesonlib.for_windows(self.want_cross, self.env): + comp_ts_version = self.env.detect_cpp_compiler(self.want_cross).get_toolset_version() + compiler_ts = comp_ts_version.split('.') + # FIXME - what about other compilers? + tag = 'vc{}{}'.format(compiler_ts[0], compiler_ts[1]) + + tag = '-' + tag + return tag + + def threading_tag(self): + if not self.is_multithreading: + return '' + + if mesonlib.for_darwin(self.want_cross, self.env): + # - Mac: requires -mt for multithreading, so should not fall back to non-mt libraries. + return '-mt' + elif mesonlib.for_windows(self.want_cross, self.env): + # - Windows: requires -mt for multithreading, so should not fall back to non-mt libraries. + return '-mt' + else: + # - Linux: leaves off -mt but libraries are multithreading-aware. + # - Cygwin: leaves off -mt but libraries are multithreading-aware. + return '' + + def version_tag(self): + return self.version.replace('.', '_') + + # FIXME - how to handle different distributions, e.g. for Mac? Currently we handle homebrew and macports, but not fink. + def abi_tag(self): + if mesonlib.for_windows(self.want_cross, self.env): + tag = self.compiler_tag() + self.threading_tag() + if self.is_debug: + tag = tag + '-gd' + tag = tag + self.version_tag() + else: + tag = self.threading_tag() + return tag + def detect_lib_modules_win(self): arch = detect_cpu_family(self.env.coredata.compilers) comp_ts_version = self.env.detect_cpp_compiler(self.want_cross).get_toolset_version() @@ -367,18 +407,6 @@ class BoostDependency(ExternalDependency): fname = os.path.basename(entry) self.lib_modules[self.modname_from_filename(fname)] = [fname] - # - Linux leaves off -mt but libraries are multithreading-aware. - # - Cygwin leaves off -mt but libraries are multithreading-aware. - # - Mac requires -mt for multithreading, so should not fall back - # to non-mt libraries. - def abi_tag(self): - if mesonlib.for_windows(self.want_cross, self.env): - return None - if self.is_multithreading and mesonlib.for_darwin(self.want_cross, self.env): - return '-mt' - else: - return '' - def detect_lib_modules_nix(self): all_found = True for module in self.requested_modules: -- cgit v1.1 From ead02636dce36101b9d556d2903c4c93ca33c92a Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Wed, 7 Feb 2018 13:40:36 -0500 Subject: Try using abi-tag to get libname and globber on windows. --- mesonbuild/dependencies/misc.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 507bc15..7b2fdc2 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -381,6 +381,9 @@ class BoostDependency(ExternalDependency): if self.is_debug: libname = libname + '-gd' libname = libname + "-{}.lib".format(self.version.replace('.', '_')) + mlog.log("original libname: '{}'".format(libname)) + libname = 'lib' + name + self.abi_tag() + '.lib' + mlog.log("abi-tag libname: '{}'".format(libname)) if os.path.isfile(os.path.join(self.libdir, libname)): self.lib_modules[self.modname_from_filename(libname)] = [libname] else: @@ -397,6 +400,9 @@ class BoostDependency(ExternalDependency): if self.is_debug: globber2 = globber2 + '-gd' globber2 = globber2 + '-{}'.format(self.version.replace('.', '_')) + mlog.log("original globber2: '{}'".format(globber2)) + globber2 = globber1 + self.abi_tag() + mlog.log("abi-tag globber2: '{}'".format(globber2)) globber2_matches = glob.glob(os.path.join(self.libdir, globber2 + '.lib')) for entry in globber2_matches: fname = os.path.basename(entry) -- cgit v1.1 From c54af27cd16351c627623180bd7b999b42241447 Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Wed, 7 Feb 2018 15:59:37 -0500 Subject: Add missing dash. --- mesonbuild/dependencies/misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 7b2fdc2..1e59f14 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -328,7 +328,7 @@ class BoostDependency(ExternalDependency): return '' def version_tag(self): - return self.version.replace('.', '_') + return '-' + self.version.replace('.', '_') # FIXME - how to handle different distributions, e.g. for Mac? Currently we handle homebrew and macports, but not fink. def abi_tag(self): -- cgit v1.1 From f62a8aa41308c48c68bedbd108bbf64708e04909 Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Wed, 7 Feb 2018 22:01:54 -0500 Subject: Remove old code and debug messages since abi tags now work. --- mesonbuild/dependencies/misc.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 1e59f14..0b26e65 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -375,15 +375,8 @@ class BoostDependency(ExternalDependency): return for name in self.need_static_link: - libname = "lib{}".format(name) + '-' + compiler - if self.is_multithreading: - libname = libname + '-mt' - if self.is_debug: - libname = libname + '-gd' - libname = libname + "-{}.lib".format(self.version.replace('.', '_')) - mlog.log("original libname: '{}'".format(libname)) + # FIXME - why are we only looking for *.lib? Mingw provides *.dll.a and *.a libname = 'lib' + name + self.abi_tag() + '.lib' - mlog.log("abi-tag libname: '{}'".format(libname)) if os.path.isfile(os.path.join(self.libdir, libname)): self.lib_modules[self.modname_from_filename(libname)] = [libname] else: @@ -394,20 +387,14 @@ class BoostDependency(ExternalDependency): # globber1 applies to a layout=system installation # globber2 applies to a layout=versioned installation globber1 = 'libboost_*' if self.static else 'boost_*' - globber2 = globber1 + '-' + compiler - if self.is_multithreading: - globber2 = globber2 + '-mt' - if self.is_debug: - globber2 = globber2 + '-gd' - globber2 = globber2 + '-{}'.format(self.version.replace('.', '_')) - mlog.log("original globber2: '{}'".format(globber2)) globber2 = globber1 + self.abi_tag() - mlog.log("abi-tag globber2: '{}'".format(globber2)) + # FIXME - why are we only looking for *.lib? Mingw provides *.dll.a and *.a globber2_matches = glob.glob(os.path.join(self.libdir, globber2 + '.lib')) for entry in globber2_matches: fname = os.path.basename(entry) self.lib_modules[self.modname_from_filename(fname)] = [fname] if len(globber2_matches) == 0: + # FIXME - why are we only looking for *.lib? Mingw provides *.dll.a and *.a for entry in glob.glob(os.path.join(self.libdir, globber1 + '.lib')): if self.static: fname = os.path.basename(entry) -- cgit v1.1 From 632d12f2810b9ee6bb494ad554626fc5abe47835 Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Wed, 7 Feb 2018 21:50:15 -0500 Subject: Add the right directory to linker search path. --- mesonbuild/dependencies/misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 0b26e65..078b469 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -463,7 +463,7 @@ class BoostDependency(ExternalDependency): def get_link_args(self): args = [] for dir in self.extra_lib_dirs(): - args += self.compiler.get_linker_search_args(self.libdir) + args += self.compiler.get_linker_search_args(dir) for lib in self.requested_modules: args += self.lib_modules['boost_' + lib] return args -- cgit v1.1 From a47a521b50bb9f705e8fa9476e47ac96d11a010d Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Wed, 7 Feb 2018 21:51:48 -0500 Subject: Correctly check for cross-compilation. --- mesonbuild/dependencies/misc.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 078b469..20c12d7 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -131,7 +131,7 @@ class BoostDependency(ExternalDependency): self.libdir = os.environ['BOOST_LIBRARYDIR'] if self.boost_root is None: - if mesonlib.is_windows(): + if mesonlib.for_windows(self.want_cross, self.env): self.boost_roots = self.detect_win_roots() else: self.boost_roots = self.detect_nix_roots() @@ -141,12 +141,12 @@ class BoostDependency(ExternalDependency): return if self.incdir is None: - if mesonlib.is_windows(): + if mesonlib.for_windows(self.want_cross, self.env): self.incdir = self.detect_win_incdir() else: self.incdir = self.detect_nix_incdir() - if self.incdir is None and mesonlib.is_windows(): + if self.incdir is None and mesonlib.for_windows(self.want_cross, self.env): self.log_fail() return @@ -289,7 +289,7 @@ class BoostDependency(ExternalDependency): self.is_found = True def detect_lib_modules(self): - if mesonlib.is_windows(): + if mesonlib.for_windows(self.want_cross, self.env): return self.detect_lib_modules_win() return self.detect_lib_modules_nix() @@ -417,7 +417,7 @@ class BoostDependency(ExternalDependency): if self.static: libsuffix = 'a' - elif mesonlib.is_osx() and not self.want_cross: + elif mesonlib.for_darwin(self.want_cross, self.env): libsuffix = 'dylib' else: libsuffix = 'so' -- cgit v1.1 From 7a233d01c7792e276b20dd290cb09c529b1c2534 Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Wed, 7 Feb 2018 21:52:49 -0500 Subject: Factor out debug tag. --- mesonbuild/dependencies/misc.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 20c12d7..cbb8e55 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -330,13 +330,14 @@ class BoostDependency(ExternalDependency): def version_tag(self): return '-' + self.version.replace('.', '_') + def debug_tag(self): + return '-gd' if self.is_debug else '' + # FIXME - how to handle different distributions, e.g. for Mac? Currently we handle homebrew and macports, but not fink. def abi_tag(self): if mesonlib.for_windows(self.want_cross, self.env): - tag = self.compiler_tag() + self.threading_tag() - if self.is_debug: - tag = tag + '-gd' - tag = tag + self.version_tag() + # PROBLEM: mingw just uses self.threading_tag() + tag = self.compiler_tag() + self.threading_tag() + self.debug_tag() + self.version_tag() else: tag = self.threading_tag() return tag -- cgit v1.1 From f7862bcd92560b2e05c344297c0da895b8292e6a Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Wed, 7 Feb 2018 21:59:37 -0500 Subject: Add note about mingw-w64 libraries. --- mesonbuild/dependencies/misc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index cbb8e55..1d4432a 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -44,6 +44,10 @@ from .base import ( # - $BOOST_ROOT/boost/*.hpp # - $BOOST_ROOT/lib-/*.lib where arch=32/64 and compiler=msvc-14.1 # +# Note that we should also try to support: +# mingw-w64 / Windows : libboost_-mt.a (location = /mingw64/lib/) +# libboost_-mt.dll.a +# # Library names supported: # - libboost_--mt-gd-x_x.lib (static) # - boost_--mt-gd-x_x.lib|.dll (shared) -- cgit v1.1 From 47ced35b77c474a7ccf9518c99f52d8b85bc1d01 Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Wed, 7 Feb 2018 22:04:59 -0500 Subject: Don't crash if we are not msvc. --- mesonbuild/dependencies/misc.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 1d4432a..e720ec5 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -307,13 +307,15 @@ class BoostDependency(ExternalDependency): def compiler_tag(self): tag = None + compiler = self.env.detect_cpp_compiler(self.want_cross) if mesonlib.for_windows(self.want_cross, self.env): - comp_ts_version = self.env.detect_cpp_compiler(self.want_cross).get_toolset_version() - compiler_ts = comp_ts_version.split('.') - # FIXME - what about other compilers? - tag = 'vc{}{}'.format(compiler_ts[0], compiler_ts[1]) - - tag = '-' + tag + if compiler.get_id() == 'msvc': + comp_ts_version = compiler.get_toolset_version() + compiler_ts = comp_ts_version.split('.') + # FIXME - what about other compilers? + tag = '-vc{}{}'.format(compiler_ts[0], compiler_ts[1]) + else: + tag = '' return tag def threading_tag(self): -- cgit v1.1 From 4babf035e5125bdf48ea5293f53e7d3c0b41a621 Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Wed, 7 Feb 2018 22:05:31 -0500 Subject: Factor our sourceforge dir names, and don't crash on non-msvc. --- mesonbuild/dependencies/misc.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index e720ec5..2a141ad 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -348,20 +348,24 @@ class BoostDependency(ExternalDependency): tag = self.threading_tag() return tag - def detect_lib_modules_win(self): - arch = detect_cpu_family(self.env.coredata.compilers) + def sourceforge_dir(self): + if self.env.detect_cpp_compiler(self.want_cross).get_id() != 'msvc': + return None comp_ts_version = self.env.detect_cpp_compiler(self.want_cross).get_toolset_version() - compiler_ts = comp_ts_version.split('.') - compiler = 'vc{}{}'.format(compiler_ts[0], compiler_ts[1]) + arch = detect_cpu_family(self.env.coredata.compilers) + if arch == 'x86': + return 'lib32-msvc-{}'.format(comp_ts_version) + elif arch == 'x86_64': + return 'lib64-msvc-{}'.format(comp_ts_version) + else: + # Does anyone do Boost cross-compiling to other archs on Windows? + return None + + def detect_lib_modules_win(self): if not self.libdir: # The libdirs in the distributed binaries (from sf) - if arch == 'x86': - lib_sf = 'lib32-msvc-{}'.format(comp_ts_version) - elif arch == 'x86_64': - lib_sf = 'lib64-msvc-{}'.format(comp_ts_version) - else: - # Does anyone do Boost cross-compiling to other archs on Windows? - lib_sf = None + lib_sf = self.sourceforge_dir() + if self.boost_root: roots = [self.boost_root] else: -- cgit v1.1 From 8cf9c7f2683a03caf2a681d01c6a538c14498279 Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Wed, 7 Feb 2018 22:29:28 -0500 Subject: Allow finding boost libraries on windows. --- mesonbuild/dependencies/misc.py | 64 +++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 2a141ad..267c158 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -293,9 +293,15 @@ class BoostDependency(ExternalDependency): self.is_found = True def detect_lib_modules(self): + # Try to find modules using compiler.find_library( ) + if self.find_libraries_with_abi_tags(self.abi_tags()): + return + + # Fall back to the old method if mesonlib.for_windows(self.want_cross, self.env): return self.detect_lib_modules_win() - return self.detect_lib_modules_nix() + else: + return self.detect_lib_modules_nix() def modname_from_filename(self, filename): modname = os.path.basename(filename) @@ -339,14 +345,15 @@ class BoostDependency(ExternalDependency): def debug_tag(self): return '-gd' if self.is_debug else '' + def versioned_abi_tag(self): + return self.compiler_tag() + self.threading_tag() + self.debug_tag() + self.version_tag() + # FIXME - how to handle different distributions, e.g. for Mac? Currently we handle homebrew and macports, but not fink. - def abi_tag(self): + def abi_tags(self): if mesonlib.for_windows(self.want_cross, self.env): - # PROBLEM: mingw just uses self.threading_tag() - tag = self.compiler_tag() + self.threading_tag() + self.debug_tag() + self.version_tag() + return [self.versioned_abi_tag(), self.threading_tag()] else: - tag = self.threading_tag() - return tag + return [self.threading_tag()] def sourceforge_dir(self): if self.env.detect_cpp_compiler(self.want_cross).get_id() != 'msvc': @@ -361,6 +368,33 @@ class BoostDependency(ExternalDependency): # Does anyone do Boost cross-compiling to other archs on Windows? return None + + def find_libraries_with_abi_tag(self, tag): + + # All modules should have the same tag + self.lib_modules = {} + + all_found = True + + for module in self.requested_modules: + libname = 'boost_' + module + tag + + args = self.compiler.find_library(libname, self.env, self.extra_lib_dirs()) + if args is None: + mlog.debug("Couldn\'t find library '{}' for boost module '{}' (ABI tag = '{}')".format(libname, module, tag)) + all_found = False + else: + mlog.debug('Link args for boost module "{}" are {}'.format(module, args)) + self.lib_modules['boost_' + module] = args + + return all_found + + def find_libraries_with_abi_tags(self, tags): + for tag in tags: + if self.find_libraries_with_abi_tag(tag): + return True + return False + def detect_lib_modules_win(self): if not self.libdir: # The libdirs in the distributed binaries (from sf) @@ -387,7 +421,7 @@ class BoostDependency(ExternalDependency): for name in self.need_static_link: # FIXME - why are we only looking for *.lib? Mingw provides *.dll.a and *.a - libname = 'lib' + name + self.abi_tag() + '.lib' + libname = 'lib' + name + self.versioned_abi_tag() + '.lib' if os.path.isfile(os.path.join(self.libdir, libname)): self.lib_modules[self.modname_from_filename(libname)] = [libname] else: @@ -398,7 +432,7 @@ class BoostDependency(ExternalDependency): # globber1 applies to a layout=system installation # globber2 applies to a layout=versioned installation globber1 = 'libboost_*' if self.static else 'boost_*' - globber2 = globber1 + self.abi_tag() + globber2 = globber1 + self.versioned_abi_tag() # FIXME - why are we only looking for *.lib? Mingw provides *.dll.a and *.a globber2_matches = glob.glob(os.path.join(self.libdir, globber2 + '.lib')) for entry in globber2_matches: @@ -412,20 +446,6 @@ class BoostDependency(ExternalDependency): self.lib_modules[self.modname_from_filename(fname)] = [fname] def detect_lib_modules_nix(self): - all_found = True - for module in self.requested_modules: - libname = 'boost_' + module + self.abi_tag() - - args = self.compiler.find_library(libname, self.env, self.extra_lib_dirs()) - if args is None: - mlog.debug('Couldn\'t find library "{}" for boost module "{}"'.format(module, libname)) - all_found = False - else: - mlog.debug('Link args for boost module "{}" are {}'.format(module, args)) - self.lib_modules['boost_' + module] = args - if all_found: - return - if self.static: libsuffix = 'a' elif mesonlib.for_darwin(self.want_cross, self.env): -- cgit v1.1 From b762655e9817cd79f7e5a4670a4e7407f2c29b74 Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Thu, 8 Feb 2018 08:34:50 -0500 Subject: Remove unused import. --- mesonbuild/dependencies/misc.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 267c158..3105300 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -18,7 +18,6 @@ import glob import os import re import shlex -import shutil import sysconfig from pathlib import Path -- cgit v1.1 From 45a7d094cca08ac743218965399ab8c3dbea877f Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Thu, 8 Feb 2018 08:35:01 -0500 Subject: Remove completed TODO notes. --- mesonbuild/dependencies/misc.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 3105300..54ffa54 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -100,13 +100,7 @@ from .base import ( # 2.2. Find boost libraries with unknown suffixes using file-name globbing. # TODO: Unix: Don't assume we know where the boost dir is, rely on -Idir and -Ldir being set. -# TODO: Determine a suffix (e.g. "-mt" or "") and use it. -# TODO: Get_win_link_args( ) and get_link_args( ) -# TODO: Genericize: 'args += ['-L' + dir] => args += self.compiler.get_linker_search_args(dir) # TODO: Allow user to specify suffix in BOOST_SUFFIX, or add specific options like BOOST_DEBUG for 'd' for debug. -# TODO: fix cross: -# is_windows() -> for_windows(self.want_cross, self.env) -# is_osx() and self.want_cross -> for_darwin(self.want_cross, self.env) class BoostDependency(ExternalDependency): def __init__(self, environment, kwargs): -- cgit v1.1 From 80e4ac2d49f6b00e09c58dae83a6cbeb1ad2b082 Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Thu, 8 Feb 2018 08:38:17 -0500 Subject: Don't give up before check for libraries - they could be in search path. --- mesonbuild/dependencies/misc.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 54ffa54..6d13d98 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -133,10 +133,6 @@ class BoostDependency(ExternalDependency): else: self.boost_roots = self.detect_nix_roots() - if self.boost_root is None and not self.boost_roots: - self.log_fail() - return - if self.incdir is None: if mesonlib.for_windows(self.want_cross, self.env): self.incdir = self.detect_win_incdir() @@ -361,7 +357,6 @@ class BoostDependency(ExternalDependency): # Does anyone do Boost cross-compiling to other archs on Windows? return None - def find_libraries_with_abi_tag(self, tag): # All modules should have the same tag -- cgit v1.1 From 8596c36214cdac61ef0fd25b6b68d73f7f834db8 Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Thu, 8 Feb 2018 08:44:05 -0500 Subject: Don't give up - boost could be in search path. --- mesonbuild/dependencies/misc.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 6d13d98..e2f735f 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -139,10 +139,6 @@ class BoostDependency(ExternalDependency): else: self.incdir = self.detect_nix_incdir() - if self.incdir is None and mesonlib.for_windows(self.want_cross, self.env): - self.log_fail() - return - if self.check_invalid_modules(): self.log_fail() return @@ -150,8 +146,10 @@ class BoostDependency(ExternalDependency): mlog.debug('Boost library root dir is', mlog.bold(self.boost_root)) mlog.debug('Boost include directory is', mlog.bold(self.incdir)) - self.lib_modules = {} + # This checks if we can find BOOST headers. self.detect_version() + + self.lib_modules = {} if self.is_found: self.detect_lib_modules() mlog.debug('Boost library directory is', mlog.bold(self.libdir)) -- cgit v1.1 From 52775ecb14c4f5ebdeabd9284c4dd50041f1ac9d Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Thu, 8 Feb 2018 09:31:29 -0500 Subject: Clean up code a bit. --- mesonbuild/dependencies/misc.py | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index e2f735f..c72cc83 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -146,19 +146,16 @@ class BoostDependency(ExternalDependency): mlog.debug('Boost library root dir is', mlog.bold(self.boost_root)) mlog.debug('Boost include directory is', mlog.bold(self.incdir)) - # This checks if we can find BOOST headers. - self.detect_version() + # 1. check if we can find BOOST headers. + self.detect_headers_and_version() - self.lib_modules = {} + # 2. check if we can find BOOST libraries. if self.is_found: self.detect_lib_modules() mlog.debug('Boost library directory is', mlog.bold(self.libdir)) - for m in self.requested_modules: - if 'boost_' + m not in self.lib_modules: - mlog.debug('Requested Boost library {!r} not found'.format(m)) - self.log_fail() - self.is_found = False - return + + # 3. Report success or failure + if self.is_found: self.log_success() else: self.log_fail() @@ -266,7 +263,7 @@ class BoostDependency(ExternalDependency): raise DependencyException('Boost module argument is not a string.') return candidates - def detect_version(self): + def detect_headers_and_version(self): try: version = self.compiler.get_define('BOOST_LIB_VERSION', '#include ', self.env, self.get_compile_args(), []) except mesonlib.EnvironmentException: @@ -280,15 +277,23 @@ class BoostDependency(ExternalDependency): self.is_found = True def detect_lib_modules(self): - # Try to find modules using compiler.find_library( ) - if self.find_libraries_with_abi_tags(self.abi_tags()): - return + self.lib_modules = {} - # Fall back to the old method - if mesonlib.for_windows(self.want_cross, self.env): - return self.detect_lib_modules_win() + # 1. Try to find modules using compiler.find_library( ) + if self.find_libraries_with_abi_tags(self.abi_tags()): + pass + # 2. Fall back to the old method else: - return self.detect_lib_modules_nix() + if mesonlib.for_windows(self.want_cross, self.env): + self.detect_lib_modules_win() + else: + self.detect_lib_modules_nix() + + # 3. Check if we can find the modules + for m in self.requested_modules: + if 'boost_' + m not in self.lib_modules: + mlog.debug('Requested Boost library {!r} not found'.format(m)) + self.is_found = False def modname_from_filename(self, filename): modname = os.path.basename(filename) -- cgit v1.1 From ab377272891a9320ca53d213c15ee44e85755db5 Mon Sep 17 00:00:00 2001 From: Benjamin Redelings Date: Thu, 8 Feb 2018 09:43:50 -0500 Subject: Add comment. --- mesonbuild/dependencies/misc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index c72cc83..8511b46 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -106,6 +106,7 @@ class BoostDependency(ExternalDependency): def __init__(self, environment, kwargs): super().__init__('boost', environment, 'cpp', kwargs) self.need_static_link = ['boost_exception', 'boost_test_exec_monitor'] + # FIXME: is this the right way to find the build type? self.is_debug = environment.cmd_line_options.buildtype.startswith('debug') threading = kwargs.get("threading", "multi") self.is_multithreading = threading == "multi" -- cgit v1.1