aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-09-12 13:41:01 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-09-12 13:41:19 +0300
commit325ed6288ba58a8a45f3d31a02ccdb17c05a9bf2 (patch)
tree801b24b2bb0e5113c6f54e2748c77b5e1dfa39c4
parent2e585856be042bf5caa2b45d07557405278ee3ae (diff)
downloadmeson-325ed6288ba58a8a45f3d31a02ccdb17c05a9bf2.zip
meson-325ed6288ba58a8a45f3d31a02ccdb17c05a9bf2.tar.gz
meson-325ed6288ba58a8a45f3d31a02ccdb17c05a9bf2.tar.bz2
Can leave Boost modules empty to only use the plain header libraries. Closes #263.
-rw-r--r--dependencies.py18
-rw-r--r--test cases/frameworks/1 boost/meson.build3
-rw-r--r--test cases/frameworks/1 boost/nomod.cpp18
3 files changed, 30 insertions, 9 deletions
diff --git a/dependencies.py b/dependencies.py
index fc0f219..69e2613 100644
--- a/dependencies.py
+++ b/dependencies.py
@@ -405,9 +405,10 @@ class BoostDependency(Dependency):
self.boost_root = self.detect_win_root()
self.incdir = os.path.join(self.boost_root, 'boost')
else:
- self.incdir = '/usr/include/boost'
+ self.incdir = '/usr/include'
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)
self.src_modules = {}
self.lib_modules = {}
@@ -442,13 +443,12 @@ class BoostDependency(Dependency):
args.append('-I' + self.boost_root)
else:
args.append('-I' + os.path.join(self.boost_root, 'include'))
+ else:
+ args.append('-I' + self.incdir)
return args
def get_requested(self, kwargs):
- modules = 'modules'
- if not modules in kwargs:
- raise DependencyException('Boost dependency must specify "%s" keyword.' % modules)
- candidates = kwargs[modules]
+ candidates = kwargs.get('modules', [])
if isinstance(candidates, str):
return [candidates]
for c in candidates:
@@ -469,7 +469,7 @@ class BoostDependency(Dependency):
def detect_version(self):
try:
- ifile = open(os.path.join(self.incdir, 'version.hpp'))
+ ifile = open(os.path.join(self.boost_inc_subdir, 'version.hpp'))
except FileNotFoundError:
self.version = None
return
@@ -482,8 +482,8 @@ class BoostDependency(Dependency):
self.version = None
def detect_src_modules(self):
- for entry in os.listdir(self.incdir):
- entry = os.path.join(self.incdir, entry)
+ for entry in os.listdir(self.boost_inc_subdir):
+ entry = os.path.join(self.boost_inc_subdir, entry)
if stat.S_ISDIR(os.stat(entry).st_mode):
self.src_modules[os.path.split(entry)[-1]] = True
diff --git a/test cases/frameworks/1 boost/meson.build b/test cases/frameworks/1 boost/meson.build
index ceea811..327d36f 100644
--- a/test cases/frameworks/1 boost/meson.build
+++ b/test cases/frameworks/1 boost/meson.build
@@ -13,11 +13,14 @@ endif
nolinkdep = dependency('boost', modules: 'utility')
linkdep = dependency('boost', modules : ['thread', 'system'])
testdep = dependency('boost', modules : 'test')
+nomoddep = dependency('boost')
nolinkexe = executable('nolinkedexe', 'nolinkexe.cc', dependencies : nolinkdep)
linkexe = executable('linkedexe', 'linkexe.cc', dependencies : linkdep)
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 UTF test', unitexe)
+test('Boost nomod', nomodexe)
diff --git a/test cases/frameworks/1 boost/nomod.cpp b/test cases/frameworks/1 boost/nomod.cpp
new file mode 100644
index 0000000..7b16881
--- /dev/null
+++ b/test cases/frameworks/1 boost/nomod.cpp
@@ -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;
+ }
+}