aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaƂ WikliƄski <mail@sirmike.org>2017-08-19 03:13:29 +0200
committerNirbheek Chauhan <nirbheek@centricular.com>2017-09-04 16:35:19 +0530
commitaf057ab5c687eb4d98fcc6f50f8a223f767db3a4 (patch)
treee7df327ca54937d358e9787120cd404a598d85cd
parent46209bb68ef9b854944703a7331b5c4e9da13e29 (diff)
downloadmeson-af057ab5c687eb4d98fcc6f50f8a223f767db3a4.zip
meson-af057ab5c687eb4d98fcc6f50f8a223f767db3a4.tar.gz
meson-af057ab5c687eb4d98fcc6f50f8a223f767db3a4.tar.bz2
Find Boost dep when there is an extra lib to link
There are several components in Boost which must be linked with extra libraries. Boost Log is one of them and in special circumstances needs linking with boost_log_setup. http://www.boost.org/doc/libs/1_64_0/libs/log/doc/html/log/detailed/utilities.html#log.detailed.utilities.setup This fix covers the case when there is no source file corresponding to the additional library.
-rw-r--r--mesonbuild/dependencies/misc.py2
-rw-r--r--test cases/frameworks/1 boost/extralib.cpp25
-rw-r--r--test cases/frameworks/1 boost/meson.build7
3 files changed, 33 insertions, 1 deletions
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index e9effc6..0112fd3 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -142,7 +142,7 @@ class BoostDependency(ExternalDependency):
def validate_requested(self):
for m in self.requested_modules:
- if m not in self.src_modules:
+ if m not in self.src_modules and m not in self.lib_modules and m + '-mt' not in self.lib_modules_mt:
msg = 'Requested Boost module {!r} not found'
raise DependencyException(msg.format(m))
diff --git a/test cases/frameworks/1 boost/extralib.cpp b/test cases/frameworks/1 boost/extralib.cpp
new file mode 100644
index 0000000..6a3e9e4
--- /dev/null
+++ b/test cases/frameworks/1 boost/extralib.cpp
@@ -0,0 +1,25 @@
+#include <iostream>
+#include <boost/log/trivial.hpp>
+#include <boost/log/expressions.hpp>
+#include <boost/log/utility/setup/console.hpp>
+#include <boost/log/utility/setup/common_attributes.hpp>
+
+using namespace std;
+namespace logging = boost::log;
+
+void InitLogger() {
+ logging::add_common_attributes();
+ logging::register_simple_formatter_factory<logging::trivial::severity_level, char>("Severity");
+ string log_format = "%TimeStamp% [%Severity%] - %Message%";
+
+ logging::add_console_log(
+ cout,
+ logging::keywords::format = log_format
+ );
+}
+
+int main(int argc, char **argv) {
+ InitLogger();
+ BOOST_LOG_TRIVIAL(trace) << "SOMETHING";
+ return 0;
+}
diff --git a/test cases/frameworks/1 boost/meson.build b/test cases/frameworks/1 boost/meson.build
index 338dd78..6f25f8b 100644
--- a/test cases/frameworks/1 boost/meson.build
+++ b/test cases/frameworks/1 boost/meson.build
@@ -1,6 +1,10 @@
project('boosttest', 'cpp',
default_options : ['cpp_std=c++11'])
+add_project_arguments(['-DBOOST_LOG_DYN_LINK'],
+ language : 'cpp'
+)
+
# We want to have multiple separate configurations of Boost
# within one project. The need to be independent of each other.
# Use one without a library dependency and one with it.
@@ -10,15 +14,18 @@ linkdep = dependency('boost', modules : ['thread', 'system'])
staticdep = dependency('boost', modules : ['thread', 'system'], static : true)
testdep = dependency('boost', modules : 'test')
nomoddep = dependency('boost')
+extralibdep = dependency('boost', modules : ['thread', 'system', 'log_setup', 'log'])
nolinkexe = executable('nolinkedexe', 'nolinkexe.cc', dependencies : nolinkdep)
linkexe = executable('linkedexe', 'linkexe.cc', dependencies : linkdep)
staticexe = executable('staticlinkedexe', 'linkexe.cc', dependencies : staticdep)
unitexe = executable('utf', 'unit_test.cpp', dependencies: testdep)
nomodexe = executable('nomod', 'nomod.cpp', dependencies : nomoddep)
+extralibexe = executable('extralibexe', 'extralib.cpp', dependencies : extralibdep)
test('Boost nolinktest', nolinkexe)
test('Boost linktest', linkexe)
test('Boost statictest', staticexe)
test('Boost UTF test', unitexe)
test('Boost nomod', nomodexe)
+test('Boost extralib test', extralibexe)