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 | 34ebcb7 | 2012-03-08 15:54:55 -0800 | [diff] [blame] | 16 | |
| 17 | if not conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL', mandatory=False): |
| 18 | libcrypto = conf.check_cc(lib='crypto', |
| 19 | header_name='openssl/crypto.h', |
| 20 | define_name='HAVE_SSL', |
| 21 | uselib_store='SSL') |
| 22 | if not conf.get_define ("HAVE_SSL"): |
| 23 | conf.fatal ("Cannot find SSL libraries") |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 24 | |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 25 | conf.load('boost') |
Chaoyi Bian | ee5b884 | 2012-03-07 13:43:27 -0800 | [diff] [blame] | 26 | conf.check_boost(lib='system iostreams test thread') |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 27 | |
Alexander Afanasyev | 34ebcb7 | 2012-03-08 15:54:55 -0800 | [diff] [blame] | 28 | try: |
| 29 | conf.load('doxygen') |
| 30 | except: |
| 31 | pass |
| 32 | |
Alexander Afanasyev | 250a4c4 | 2012-03-07 13:40:18 -0800 | [diff] [blame] | 33 | conf.load('ccnx tinyxml') |
| 34 | conf.check_ccnx (path=conf.options.ccnx_dir) |
| 35 | conf.check_tinyxml (path=conf.options.ccnx_dir) |
Alexander Afanasyev | e76f263 | 2012-03-05 00:18:42 -0800 | [diff] [blame] | 36 | |
Alexander Afanasyev | 250a4c4 | 2012-03-07 13:40:18 -0800 | [diff] [blame] | 37 | conf.define ('STANDALONE', 1) |
Alexander Afanasyev | 87c9b5d | 2012-03-07 17:23:21 -0800 | [diff] [blame] | 38 | if not conf.options.no_debug: |
| 39 | conf.define ('_DEBUG', 1) |
Alexander Afanasyev | 250a4c4 | 2012-03-07 13:40:18 -0800 | [diff] [blame] | 40 | |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 41 | def build (bld): |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 42 | bld.shlib (target=APPNAME, |
| 43 | features=['cxx', 'cxxshlib'], |
| 44 | source = bld.path.ant_glob(['model/sync-*.cc', |
| 45 | 'helper/sync-*.cc']), |
Chaoyi Bian | ee5b884 | 2012-03-07 13:43:27 -0800 | [diff] [blame] | 46 | uselib = 'BOOST BOOST_IOSTREAMS BOOST_THREAD SSL TINYXML CCNX' |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 47 | ) |
Alexander Afanasyev | ec1d4a7 | 2012-03-05 11:06:54 -0800 | [diff] [blame] | 48 | |
Alexander Afanasyev | 150f14d | 2012-03-05 21:24:49 -0800 | [diff] [blame] | 49 | # Unit tests |
Alexander Afanasyev | 1fbdcdd | 2012-03-05 23:14:33 -0800 | [diff] [blame] | 50 | bld.program (target="unit-tests", |
Alexander Afanasyev | 150f14d | 2012-03-05 21:24:49 -0800 | [diff] [blame] | 51 | source = bld.path.ant_glob(['test/**/*.cc']), |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 52 | features=['cxx', 'cxxprogram'], |
Alexander Afanasyev | b71beab | 2012-03-05 21:13:49 -0800 | [diff] [blame] | 53 | use = 'BOOST_TEST sync') |
Alexander Afanasyev | e76f263 | 2012-03-05 00:18:42 -0800 | [diff] [blame] | 54 | |
Alexander Afanasyev | 150f14d | 2012-03-05 21:24:49 -0800 | [diff] [blame] | 55 | # doxygen docs |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 56 | from waflib.Build import BuildContext |
| 57 | class doxy (BuildContext): |
| 58 | cmd = "doxygen" |
| 59 | fun = "doxygen" |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 60 | |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 61 | def doxygen (bld): |
Alexander Afanasyev | 34ebcb7 | 2012-03-08 15:54:55 -0800 | [diff] [blame] | 62 | if not bld.env.DOXYGEN: |
| 63 | bld.fatal ("ERROR: cannot build documentation (`doxygen' is not found in $PATH)") |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 64 | bld (features="doxygen", |
| 65 | doxyfile='doc/doxygen.conf', |
| 66 | output_dir = 'doc') |