aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaƂ WikliƄski <mail@sirmike.org>2017-08-19 03:13:29 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-08-20 23:17:12 +0300
commit9154a6473b28f4cb60d23a7bc15ab8b1d223c1bb (patch)
tree0464fbf4f0a16dd104ca69fb7693a8244aa3abe8
parent24ff7da0d2a5dabbe17f5e9c648ef1ef6e2232aa (diff)
downloadmeson-9154a6473b28f4cb60d23a7bc15ab8b1d223c1bb.zip
meson-9154a6473b28f4cb60d23a7bc15ab8b1d223c1bb.tar.gz
meson-9154a6473b28f4cb60d23a7bc15ab8b1d223c1bb.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)