3 # Copyright (C) 2016-2017 Carl Hetherington <cth@carlh.net>
5 # This file is part of libcxml.
7 # libcxml is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # libcxml is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with libcxml. If not, see <http://www.gnu.org/licenses/>.
21 from waflib import Context
24 VERSION = '0.15.4devel'
28 opt.load('compiler_cxx')
29 opt.add_option('--target-windows', action='store_true', default=False, help='set up to do a cross-compile to Windows')
30 opt.add_option('--enable-debug', action='store_true', default=False, help='build with debugging information and without optimisation')
31 opt.add_option('--static', action='store_true', default=False, help='build statically')
32 opt.add_option('--disable-tests', action='store_true', default=False, help='disable building of tests')
33 opt.add_option('--force-cpp11', action='store_true', default=False, help='force use of C++11')
36 conf.load('compiler_cxx')
37 if conf.options.enable_debug:
38 conf.env.append_value('CXXFLAGS', '-g')
39 conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-O2'])
40 if conf.options.force_cpp11:
41 conf.env.append_value('CXXFLAGS', ['-std=c++11', '-DBOOST_NO_CXX11_SCOPED_ENUMS'])
43 conf.env.TARGET_WINDOWS = conf.options.target_windows
44 conf.env.STATIC = conf.options.static
45 conf.env.DISABLE_TESTS = conf.options.disable_tests
46 conf.env.API_VERSION = API_VERSION
48 if conf.options.target_windows:
49 boost_lib_suffix = '-mt'
53 conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='LIBXML++', mandatory=True)
54 conf.check_cfg(package='locked_sstream', args='--cflags --libs', uselib_store='LOCKED_SSTREAM', mandatory=True)
56 conf.check_cxx(fragment="""
57 #include <boost/filesystem.hpp>\n
58 int main() { boost::filesystem::copy_file ("a", "b"); }\n
60 msg='Checking for boost filesystem library',
61 libpath='/usr/local/lib',
62 lib=['boost_filesystem%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
63 uselib_store='BOOST_FILESYSTEM')
65 if not conf.options.disable_tests:
66 conf.check_cxx(fragment="""
67 #define BOOST_TEST_MODULE Config test\n
68 #include <boost/test/unit_test.hpp>\n
71 msg='Checking for boost unit testing library',
72 lib=['boost_unit_test_framework%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
73 uselib_store='BOOST_TEST')
79 bld(source='libcxml.pc.in',
81 includedir='%s/include' % bld.env.PREFIX,
82 libs="-L${libdir} -lcxml",
83 install_path='${LIBDIR}/pkgconfig')
86 if not bld.env.DISABLE_TESTS: