Can leave Boost modules empty to only use the plain header libraries. Closes #263.

pull/255/head^2
Jussi Pakkanen 9 years ago
parent 2e585856be
commit 325ed6288b
  1. 18
      dependencies.py
  2. 3
      test cases/frameworks/1 boost/meson.build
  3. 18
      test cases/frameworks/1 boost/nomod.cpp

@ -405,9 +405,10 @@ class BoostDependency(Dependency):
self.boost_root = self.detect_win_root() self.boost_root = self.detect_win_root()
self.incdir = os.path.join(self.boost_root, 'boost') self.incdir = os.path.join(self.boost_root, 'boost')
else: else:
self.incdir = '/usr/include/boost' self.incdir = '/usr/include'
else: else:
self.incdir = os.path.join(self.boost_root, 'include/boost') self.incdir = os.path.join(self.boost_root, 'include')
self.boost_inc_subdir = os.path.join(self.incdir, 'boost')
mlog.debug('Boost library root dir is', self.boost_root) mlog.debug('Boost library root dir is', self.boost_root)
self.src_modules = {} self.src_modules = {}
self.lib_modules = {} self.lib_modules = {}
@ -442,13 +443,12 @@ class BoostDependency(Dependency):
args.append('-I' + self.boost_root) args.append('-I' + self.boost_root)
else: else:
args.append('-I' + os.path.join(self.boost_root, 'include')) args.append('-I' + os.path.join(self.boost_root, 'include'))
else:
args.append('-I' + self.incdir)
return args return args
def get_requested(self, kwargs): def get_requested(self, kwargs):
modules = 'modules' candidates = kwargs.get('modules', [])
if not modules in kwargs:
raise DependencyException('Boost dependency must specify "%s" keyword.' % modules)
candidates = kwargs[modules]
if isinstance(candidates, str): if isinstance(candidates, str):
return [candidates] return [candidates]
for c in candidates: for c in candidates:
@ -469,7 +469,7 @@ class BoostDependency(Dependency):
def detect_version(self): def detect_version(self):
try: try:
ifile = open(os.path.join(self.incdir, 'version.hpp')) ifile = open(os.path.join(self.boost_inc_subdir, 'version.hpp'))
except FileNotFoundError: except FileNotFoundError:
self.version = None self.version = None
return return
@ -482,8 +482,8 @@ class BoostDependency(Dependency):
self.version = None self.version = None
def detect_src_modules(self): def detect_src_modules(self):
for entry in os.listdir(self.incdir): for entry in os.listdir(self.boost_inc_subdir):
entry = os.path.join(self.incdir, entry) entry = os.path.join(self.boost_inc_subdir, entry)
if stat.S_ISDIR(os.stat(entry).st_mode): if stat.S_ISDIR(os.stat(entry).st_mode):
self.src_modules[os.path.split(entry)[-1]] = True self.src_modules[os.path.split(entry)[-1]] = True

@ -13,11 +13,14 @@ endif
nolinkdep = dependency('boost', modules: 'utility') nolinkdep = dependency('boost', modules: 'utility')
linkdep = dependency('boost', modules : ['thread', 'system']) linkdep = dependency('boost', modules : ['thread', 'system'])
testdep = dependency('boost', modules : 'test') testdep = dependency('boost', modules : 'test')
nomoddep = dependency('boost')
nolinkexe = executable('nolinkedexe', 'nolinkexe.cc', dependencies : nolinkdep) nolinkexe = executable('nolinkedexe', 'nolinkexe.cc', dependencies : nolinkdep)
linkexe = executable('linkedexe', 'linkexe.cc', dependencies : linkdep) linkexe = executable('linkedexe', 'linkexe.cc', dependencies : linkdep)
unitexe = executable('utf', 'unit_test.cpp', dependencies: testdep) unitexe = executable('utf', 'unit_test.cpp', dependencies: testdep)
nomodexe = executable('nomod', 'nomod.cpp', dependencies : nomoddep)
test('Boost nolinktext', nolinkexe) test('Boost nolinktext', nolinkexe)
test('Boost linktext', linkexe) test('Boost linktext', linkexe)
test('Boost UTF test', unitexe) test('Boost UTF test', unitexe)
test('Boost nomod', nomodexe)

@ -0,0 +1,18 @@
#include<boost/any.hpp>
#include<iostream>
boost::any get_any() {
boost::any foobar = 3;
return foobar;
}
int main(int argc, char **argv) {
boost::any result = get_any();
if(boost::any_cast<int>(result) == 3) {
std::cout << "Everything is fine in the worls.\n";
return 0;
} else {
std::cout << "Mathematics stopped working.\n";
return 1;
}
}
Loading…
Cancel
Save