Missing #include.
[libcxml.git] / wscript
1 APPNAME = 'libcxml'
2 VERSION = '0.11.0devel'
3 API_VERSION = '0.0.0'
4
5 def options(opt):
6     opt.load('compiler_cxx')
7     opt.add_option('--enable-debug', action='store_true', default=False, help='build with debugging information and without optimisation')
8     opt.add_option('--target-windows', action='store_true', default=False, help='set up to do a cross-compile to Windows')
9     opt.add_option('--static', action='store_true', default=False, help='build statically')
10     opt.add_option('--disable-tests', action='store_true', default=False, help='disable building of tests')
11
12 def configure(conf):
13     conf.load('compiler_cxx')
14     conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-O2'])
15
16     if conf.options.enable_debug:
17         conf.env.append_value('CXXFLAGS', '-g')
18     else:
19         conf.env.append_value('CXXFLAGS', '-O2')
20
21     conf.env.TARGET_WINDOWS = conf.options.target_windows
22     conf.env.STATIC = conf.options.static
23     conf.env.DISABLE_TESTS = conf.options.disable_tests
24     conf.env.API_VERSION = API_VERSION
25
26     if conf.options.target_windows:
27         boost_lib_suffix = '-mt'
28     else:
29         boost_lib_suffix = ''
30
31     conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='LIBXML++', mandatory=True)
32
33     conf.check_cxx(fragment="""
34                    #include <boost/filesystem.hpp>\n
35                    int main() { boost::filesystem::copy_file ("a", "b"); }\n
36                    """,
37                    msg='Checking for boost filesystem library',
38                    libpath='/usr/local/lib',
39                    lib=['boost_filesystem%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
40                    uselib_store='BOOST_FILESYSTEM')
41     
42     if not conf.options.disable_tests:
43         conf.check_cxx(fragment="""
44                                   #define BOOST_TEST_MODULE Config test\n
45                                   #include <boost/test/unit_test.hpp>\n
46                                   int main() {}
47                                   """,
48                                   msg='Checking for boost unit testing library',
49                                   lib=['boost_unit_test_framework%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
50                                   uselib_store='BOOST_TEST')
51
52         conf.recurse('test')
53
54 def build(bld):
55
56     bld(source='libcxml.pc.in',
57         version=VERSION,
58         includedir='%s/include' % bld.env.PREFIX,
59         libs="-L${libdir} -lcxml",
60         install_path='${LIBDIR}/pkgconfig')
61
62     bld.recurse('src')
63     if not bld.env.DISABLE_TESTS:
64         bld.recurse('test')