1 from waflib import Context
4 VERSION = '0.15.0devel'
8 opt.load('compiler_cxx')
9 opt.add_option('--target-windows', action='store_true', default=False, help='set up to do a cross-compile to Windows')
10 opt.add_option('--static', action='store_true', default=False, help='build statically')
11 opt.add_option('--disable-tests', action='store_true', default=False, help='disable building of tests')
14 conf.load('compiler_cxx')
15 conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-O2'])
17 conf.env.TARGET_WINDOWS = conf.options.target_windows
18 conf.env.STATIC = conf.options.static
19 conf.env.DISABLE_TESTS = conf.options.disable_tests
20 conf.env.API_VERSION = API_VERSION
22 if conf.options.target_windows:
23 boost_lib_suffix = '-mt'
27 conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='LIBXML++', mandatory=True)
29 conf.check_cxx(fragment="""
30 #include <boost/filesystem.hpp>\n
31 int main() { boost::filesystem::copy_file ("a", "b"); }\n
33 msg='Checking for boost filesystem library',
34 libpath='/usr/local/lib',
35 lib=['boost_filesystem%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
36 uselib_store='BOOST_FILESYSTEM')
38 if not conf.options.disable_tests:
39 conf.check_cxx(fragment="""
40 #define BOOST_TEST_MODULE Config test\n
41 #include <boost/test/unit_test.hpp>\n
44 msg='Checking for boost unit testing library',
45 lib=['boost_unit_test_framework%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
46 uselib_store='BOOST_TEST')
50 # libxml++ 2.39.1 and later must be built with -std=c++11
51 libxmlpp_version = conf.cmd_and_log(['pkg-config', '--modversion', 'libxml++-2.6'], output=Context.STDOUT, quiet=Context.BOTH)
52 s = libxmlpp_version.split('.')
53 v = (int(s[0]) << 16) | (int(s[1]) << 8) | int(s[2])
55 conf.env.append_value('CXXFLAGS', '-std=c++11')
59 bld(source='libcxml.pc.in',
61 includedir='%s/include' % bld.env.PREFIX,
62 libs="-L${libdir} -lcxml",
63 install_path='${LIBDIR}/pkgconfig')
66 if not bld.env.DISABLE_TESTS: