From 80fd7106e8ec0a74ace0919f3c412bb8f5e869f7 Mon Sep 17 00:00:00 2001 From: "Adam C. Foltzer" Date: Thu, 25 May 2017 11:20:29 -0700 Subject: [PATCH 1/3] add support for static flag on Windows Boost dependency --- mesonbuild/dependencies/misc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 3e0b55888..189e7304a 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -1,4 +1,4 @@ -# Copyright 2013-2017 The Meson development team +# Copyright 2013-2017 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -37,6 +37,7 @@ class BoostDependency(Dependency): self.name = 'boost' self.environment = environment self.libdir = '' + self.static = kwargs.get('static', False) if 'native' in kwargs and environment.is_cross_build(): self.want_cross = not kwargs['native'] else: @@ -194,7 +195,7 @@ class BoostDependency(Dependency): return libdir = libdir[0] self.libdir = libdir - globber = '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)): (_, fname) = os.path.split(entry) base = fname.split('_', 1)[1] From b290688ede302fd33969c313c67c8c85649bab7b Mon Sep 17 00:00:00 2001 From: "Adam C. Foltzer" Date: Thu, 25 May 2017 11:30:55 -0700 Subject: [PATCH 2/3] look for static Boost libraries on *nix when requested This was already mostly working before due to how the linker arguments were constructed, but this will now be more resilient to the case where dynamic libraries only are present. --- mesonbuild/dependencies/misc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 189e7304a..35e840ca2 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -203,7 +203,9 @@ class BoostDependency(Dependency): self.lib_modules_mt[modname] = fname def detect_lib_modules_nix(self): - if mesonlib.is_osx() and not self.want_cross: + if self.static: + libsuffix = 'a' + elif mesonlib.is_osx() and not self.want_cross: libsuffix = 'dylib' else: libsuffix = 'so' @@ -221,7 +223,7 @@ class BoostDependency(Dependency): name = lib.split('.')[0].split('_', 1)[-1] # I'm not 100% sure what to do here. Some distros # have modules such as thread only as -mt versions. - if entry.endswith('-mt.so'): + if entry.endswith('-mt.{}'.format(libsuffix)): self.lib_modules_mt[name] = True else: self.lib_modules[name] = True From aff955f99f31cbeacb1885d93b51b296b80de18b Mon Sep 17 00:00:00 2001 From: "Adam C. Foltzer" Date: Thu, 25 May 2017 12:09:32 -0700 Subject: [PATCH 3/3] add static Boost dependency test --- test cases/frameworks/1 boost/meson.build | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test cases/frameworks/1 boost/meson.build b/test cases/frameworks/1 boost/meson.build index 6f9b16fe5..b7ac36d69 100644 --- a/test cases/frameworks/1 boost/meson.build +++ b/test cases/frameworks/1 boost/meson.build @@ -7,15 +7,18 @@ project('boosttest', 'cpp', nolinkdep = dependency('boost', modules: 'utility') linkdep = dependency('boost', modules : ['thread', 'system']) +staticdep = dependency('boost', modules : ['thread', 'system'], static : true) testdep = dependency('boost', modules : 'test') nomoddep = dependency('boost') nolinkexe = executable('nolinkedexe', 'nolinkexe.cc', dependencies : nolinkdep) linkexe = executable('linkedexe', 'linkexe.cc', dependencies : linkdep) +staticexe = executable('linkedexe', 'linkexe.cc', dependencies : staticdep) unitexe = executable('utf', 'unit_test.cpp', dependencies: testdep) nomodexe = executable('nomod', 'nomod.cpp', dependencies : nomoddep) -test('Boost nolinktext', nolinkexe) -test('Boost linktext', linkexe) +test('Boost nolinktest', nolinkexe) +test('Boost linktest', linkexe) +test('Boost statictest', staticexe) test('Boost UTF test', unitexe) test('Boost nomod', nomodexe)