diff options
| -rw-r--r-- | cscript | 6 | ||||
| -rw-r--r-- | test/tests.cc | 1 | ||||
| -rw-r--r-- | wscript | 6 |
3 files changed, 7 insertions, 6 deletions
@@ -24,10 +24,8 @@ def build(target, options): cmd = './waf configure --prefix=%s' % target.directory if target.platform == 'linux': cmd += ' --static' - if target.distro == 'centos': - # Centos builds using static boost, which means tests don't - # build as test/tests.cc defines BOOST_TEST_DYN_LINK - cmd += ' --disable-tests' + if target.distro == 'centos' or (target.distro == 'ubuntu' and target.version == '16.04'): + cmd += ' --static-boost' elif target.platform == 'windows': cmd += f' --target-windows-{target.bits}' diff --git a/test/tests.cc b/test/tests.cc index 4b8efc7..af84962 100644 --- a/test/tests.cc +++ b/test/tests.cc @@ -23,7 +23,6 @@ #include <libxml++/libxml++.h> #include "cxml.h" -#define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE libcxml_test #include <boost/test/unit_test.hpp> @@ -40,6 +40,7 @@ def options(opt): opt.add_option('--target-windows-32', action='store_true', default=False, help='set up to do a cross-compile to Windows 32-bit') opt.add_option('--enable-debug', action='store_true', default=False, help='build with debugging information and without optimisation') opt.add_option('--static', action='store_true', default=False, help='build statically') + opt.add_option('--static-boost', action='store_true', default=False, help='link statically against boost') opt.add_option('--disable-tests', action='store_true', default=False, help='disable building of tests') opt.add_option('--c++17', action='store_true', default=False, help='build with C++17 and libxml++-4.0') @@ -71,6 +72,9 @@ def configure(conf): boost_lib_suffix = '' conf.env.append_value('CXXFLAGS', '-DLIBCXML_POSIX') + if not conf.options.static_boost: + conf.env.append_value('CXXFLAGS', '-DBOOST_TEST_DYN_LINK') + conf.check_cfg(package='libxml++-' + conf.env.XMLPP_API, args='--cflags --libs', uselib_store='LIBXML++', mandatory=True) conf.check_cxx(fragment=""" @@ -86,7 +90,7 @@ def configure(conf): conf.check_cxx(fragment=""" #define BOOST_TEST_MODULE Config test\n #include <boost/test/unit_test.hpp>\n - int main() {} + BOOST_AUTO_TEST_CASE(foo) {} """, msg='Checking for boost unit testing library', lib=['boost_unit_test_framework%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix], |
