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