Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 3 | VERSION='0.0.1' |
| 4 | APPNAME='sync' |
| 5 | |
Alexander Afanasyev | e76f263 | 2012-03-05 00:18:42 -0800 | [diff] [blame] | 6 | def options(opt): |
Alexander Afanasyev | 87c9b5d | 2012-03-07 17:23:21 -0800 | [diff] [blame^] | 7 | opt.add_option('--no-debug',action='store_true',default=False,dest='no_debug',help='''Make an optimized build of the library (remove debugging code)''') |
Alexander Afanasyev | e76f263 | 2012-03-05 00:18:42 -0800 | [diff] [blame] | 8 | opt.load('compiler_c') |
| 9 | opt.load('compiler_cxx') |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 10 | opt.load('boost') |
| 11 | opt.load('doxygen') |
Alexander Afanasyev | 250a4c4 | 2012-03-07 13:40:18 -0800 | [diff] [blame] | 12 | opt.load('ccnx tinyxml', tooldir=["waf-tools"]) |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 13 | |
Alexander Afanasyev | 8f25cbb | 2012-03-01 23:53:40 -0800 | [diff] [blame] | 14 | def configure(conf): |
Alexander Afanasyev | e76f263 | 2012-03-05 00:18:42 -0800 | [diff] [blame] | 15 | conf.load("compiler_cxx") |
Alexander Afanasyev | 8f25cbb | 2012-03-01 23:53:40 -0800 | [diff] [blame] | 16 | conf.check_cfg(atleast_pkgconfig_version='0.20') |
| 17 | conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL') |
Alexander Afanasyev | 250a4c4 | 2012-03-07 13:40:18 -0800 | [diff] [blame] | 18 | # conf.check_cfg(package='libxml-2.0', args=['--cflags', '--libs'], uselib_store='XML') |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 19 | |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 20 | conf.load('boost') |
Chaoyi Bian | ee5b884 | 2012-03-07 13:43:27 -0800 | [diff] [blame] | 21 | conf.check_boost(lib='system iostreams test thread') |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 22 | |
| 23 | conf.load('doxygen') |
Alexander Afanasyev | 250a4c4 | 2012-03-07 13:40:18 -0800 | [diff] [blame] | 24 | conf.load('ccnx tinyxml') |
| 25 | conf.check_ccnx (path=conf.options.ccnx_dir) |
| 26 | conf.check_tinyxml (path=conf.options.ccnx_dir) |
Alexander Afanasyev | e76f263 | 2012-03-05 00:18:42 -0800 | [diff] [blame] | 27 | |
Alexander Afanasyev | 250a4c4 | 2012-03-07 13:40:18 -0800 | [diff] [blame] | 28 | conf.define ('STANDALONE', 1) |
Alexander Afanasyev | 87c9b5d | 2012-03-07 17:23:21 -0800 | [diff] [blame^] | 29 | if not conf.options.no_debug: |
| 30 | conf.define ('_DEBUG', 1) |
Alexander Afanasyev | 250a4c4 | 2012-03-07 13:40:18 -0800 | [diff] [blame] | 31 | |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 32 | def build (bld): |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 33 | bld.shlib (target=APPNAME, |
| 34 | features=['cxx', 'cxxshlib'], |
| 35 | source = bld.path.ant_glob(['model/sync-*.cc', |
| 36 | 'helper/sync-*.cc']), |
Chaoyi Bian | ee5b884 | 2012-03-07 13:43:27 -0800 | [diff] [blame] | 37 | uselib = 'BOOST BOOST_IOSTREAMS BOOST_THREAD SSL TINYXML CCNX' |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 38 | ) |
Alexander Afanasyev | ec1d4a7 | 2012-03-05 11:06:54 -0800 | [diff] [blame] | 39 | |
Alexander Afanasyev | 150f14d | 2012-03-05 21:24:49 -0800 | [diff] [blame] | 40 | # Unit tests |
Alexander Afanasyev | 1fbdcdd | 2012-03-05 23:14:33 -0800 | [diff] [blame] | 41 | bld.program (target="unit-tests", |
Alexander Afanasyev | 150f14d | 2012-03-05 21:24:49 -0800 | [diff] [blame] | 42 | source = bld.path.ant_glob(['test/**/*.cc']), |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 43 | features=['cxx', 'cxxprogram'], |
Alexander Afanasyev | b71beab | 2012-03-05 21:13:49 -0800 | [diff] [blame] | 44 | use = 'BOOST_TEST sync') |
Alexander Afanasyev | e76f263 | 2012-03-05 00:18:42 -0800 | [diff] [blame] | 45 | |
Alexander Afanasyev | 150f14d | 2012-03-05 21:24:49 -0800 | [diff] [blame] | 46 | |
| 47 | # doxygen docs |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 48 | from waflib.Build import BuildContext |
| 49 | class doxy (BuildContext): |
| 50 | cmd = "doxygen" |
| 51 | fun = "doxygen" |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 52 | |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 53 | def doxygen (bld): |
| 54 | bld (features="doxygen", |
| 55 | doxyfile='doc/doxygen.conf', |
| 56 | output_dir = 'doc') |