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