Bump version
[libcxml.git] / wscript
1 from waflib import Context
2
3 APPNAME = 'libcxml'
4 VERSION = '0.15.1devel'
5 API_VERSION = '0.0.0'
6
7 def options(opt):
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')
12
13 def configure(conf):
14     conf.load('compiler_cxx')
15     conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-O2'])
16
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
21
22     if conf.options.target_windows:
23         boost_lib_suffix = '-mt'
24     else:
25         boost_lib_suffix = ''
26
27     conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='LIBXML++', mandatory=True)
28
29     conf.check_cxx(fragment="""
30                    #include <boost/filesystem.hpp>\n
31                    int main() { boost::filesystem::copy_file ("a", "b"); }\n
32                    """,
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')
37
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
42                                   int main() {}
43                                   """,
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')
47
48         conf.recurse('test')
49
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])
54     if v >= 0x022701:
55         conf.env.append_value('CXXFLAGS', '-std=c++11')
56         
57 def build(bld):
58
59     bld(source='libcxml.pc.in',
60         version=VERSION,
61         includedir='%s/include' % bld.env.PREFIX,
62         libs="-L${libdir} -lcxml",
63         install_path='${LIBDIR}/pkgconfig')
64
65     bld.recurse('src')
66     if not bld.env.DISABLE_TESTS:
67         bld.recurse('test')