blob: 61536d41684c98a24ea3f20707723bada5214f37 [file] [log] [blame]
Alexander Afanasyev7a696fb2012-03-01 17:17:22 -08001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
Alexander Afanasyev182fdc22012-03-05 18:06:52 -08003VERSION='0.0.1'
4APPNAME='sync'
5
Alexander Afanasyeve76f2632012-03-05 00:18:42 -08006def options(opt):
Alexander Afanasyev87c9b5d2012-03-07 17:23:21 -08007 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 Afanasyeve76f2632012-03-05 00:18:42 -08008 opt.load('compiler_c')
9 opt.load('compiler_cxx')
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080010 opt.load('boost')
11 opt.load('doxygen')
Alexander Afanasyev250a4c42012-03-07 13:40:18 -080012 opt.load('ccnx tinyxml', tooldir=["waf-tools"])
Alexander Afanasyev7a696fb2012-03-01 17:17:22 -080013
Alexander Afanasyev8f25cbb2012-03-01 23:53:40 -080014def configure(conf):
Alexander Afanasyeve76f2632012-03-05 00:18:42 -080015 conf.load("compiler_cxx")
Alexander Afanasyev34ebcb72012-03-08 15:54:55 -080016
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 Afanasyev7a696fb2012-03-01 17:17:22 -080024
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080025 conf.load('boost')
Chaoyi Bianee5b8842012-03-07 13:43:27 -080026 conf.check_boost(lib='system iostreams test thread')
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080027
Alexander Afanasyev34ebcb72012-03-08 15:54:55 -080028 try:
29 conf.load('doxygen')
30 except:
31 pass
32
Alexander Afanasyev250a4c42012-03-07 13:40:18 -080033 conf.load('ccnx tinyxml')
34 conf.check_ccnx (path=conf.options.ccnx_dir)
35 conf.check_tinyxml (path=conf.options.ccnx_dir)
Alexander Afanasyeve76f2632012-03-05 00:18:42 -080036
Alexander Afanasyev250a4c42012-03-07 13:40:18 -080037 conf.define ('STANDALONE', 1)
Alexander Afanasyev87c9b5d2012-03-07 17:23:21 -080038 if not conf.options.no_debug:
39 conf.define ('_DEBUG', 1)
Alexander Afanasyev250a4c42012-03-07 13:40:18 -080040
Alexander Afanasyev7a696fb2012-03-01 17:17:22 -080041def build (bld):
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080042 bld.shlib (target=APPNAME,
43 features=['cxx', 'cxxshlib'],
44 source = bld.path.ant_glob(['model/sync-*.cc',
45 'helper/sync-*.cc']),
Chaoyi Bianee5b8842012-03-07 13:43:27 -080046 uselib = 'BOOST BOOST_IOSTREAMS BOOST_THREAD SSL TINYXML CCNX'
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080047 )
Alexander Afanasyevec1d4a72012-03-05 11:06:54 -080048
Alexander Afanasyev150f14d2012-03-05 21:24:49 -080049 # Unit tests
Alexander Afanasyev1fbdcdd2012-03-05 23:14:33 -080050 bld.program (target="unit-tests",
Alexander Afanasyev150f14d2012-03-05 21:24:49 -080051 source = bld.path.ant_glob(['test/**/*.cc']),
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080052 features=['cxx', 'cxxprogram'],
Alexander Afanasyevb71beab2012-03-05 21:13:49 -080053 use = 'BOOST_TEST sync')
Alexander Afanasyeve76f2632012-03-05 00:18:42 -080054
Alexander Afanasyev150f14d2012-03-05 21:24:49 -080055# doxygen docs
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080056from waflib.Build import BuildContext
57class doxy (BuildContext):
58 cmd = "doxygen"
59 fun = "doxygen"
Alexander Afanasyev7a696fb2012-03-01 17:17:22 -080060
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080061def doxygen (bld):
Alexander Afanasyev34ebcb72012-03-08 15:54:55 -080062 if not bld.env.DOXYGEN:
63 bld.fatal ("ERROR: cannot build documentation (`doxygen' is not found in $PATH)")
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080064 bld (features="doxygen",
65 doxyfile='doc/doxygen.conf',
66 output_dir = 'doc')