blob: ba0a706eabdc1efa919199cc2d85844502ed803c [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 Afanasyev4f9ea482012-03-15 11:57:29 -07008 opt.add_option('--log4cxx',action='store_true',default=False,dest='log4cxx',help='''Compile with log4cxx support''')
Alexander Afanasyeve76f2632012-03-05 00:18:42 -08009 opt.load('compiler_c')
10 opt.load('compiler_cxx')
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080011 opt.load('boost')
12 opt.load('doxygen')
Alexander Afanasyev250a4c42012-03-07 13:40:18 -080013 opt.load('ccnx tinyxml', tooldir=["waf-tools"])
Alexander Afanasyev7a696fb2012-03-01 17:17:22 -080014
Alexander Afanasyev8f25cbb2012-03-01 23:53:40 -080015def configure(conf):
Alexander Afanasyeve76f2632012-03-05 00:18:42 -080016 conf.load("compiler_cxx")
Alexander Afanasyev34ebcb72012-03-08 15:54:55 -080017
18 if not conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL', mandatory=False):
19 libcrypto = conf.check_cc(lib='crypto',
20 header_name='openssl/crypto.h',
21 define_name='HAVE_SSL',
22 uselib_store='SSL')
23 if not conf.get_define ("HAVE_SSL"):
24 conf.fatal ("Cannot find SSL libraries")
Alexander Afanasyev7a696fb2012-03-01 17:17:22 -080025
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080026 conf.load('boost')
Chaoyi Bianee5b8842012-03-07 13:43:27 -080027 conf.check_boost(lib='system iostreams test thread')
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080028
Alexander Afanasyev34ebcb72012-03-08 15:54:55 -080029 try:
30 conf.load('doxygen')
31 except:
32 pass
33
Alexander Afanasyev250a4c42012-03-07 13:40:18 -080034 conf.load('ccnx tinyxml')
35 conf.check_ccnx (path=conf.options.ccnx_dir)
36 conf.check_tinyxml (path=conf.options.ccnx_dir)
Alexander Afanasyeve76f2632012-03-05 00:18:42 -080037
Alexander Afanasyev250a4c42012-03-07 13:40:18 -080038 conf.define ('STANDALONE', 1)
Alexander Afanasyev87c9b5d2012-03-07 17:23:21 -080039 if not conf.options.no_debug:
40 conf.define ('_DEBUG', 1)
Alexander Afanasyev4f9ea482012-03-15 11:57:29 -070041
42 if conf.options.log4cxx:
43 conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX', mandatory=True)
44
Alexander Afanasyev7a696fb2012-03-01 17:17:22 -080045def build (bld):
Alexander Afanasyev4f9ea482012-03-15 11:57:29 -070046 libsync = bld.shlib (target=APPNAME,
47 features=['cxx', 'cxxshlib'],
48 source = bld.path.ant_glob(['model/sync-*.cc',
49 'helper/sync-*.cc']),
50 use = 'BOOST BOOST_IOSTREAMS BOOST_THREAD SSL TINYXML CCNX')
Alexander Afanasyevec1d4a72012-03-05 11:06:54 -080051
Alexander Afanasyev150f14d2012-03-05 21:24:49 -080052 # Unit tests
Alexander Afanasyev4f9ea482012-03-15 11:57:29 -070053 unittests = bld.program (target="unit-tests",
54 source = bld.path.ant_glob(['test/**/*.cc']),
55 features=['cxx', 'cxxprogram'],
56 use = 'BOOST_TEST sync')
57
58 if bld.get_define ("HAVE_LOG4CXX"):
59 libsync.use += ' LOG4CXX'
60 unittests.use += ' LOG4CXX'
Alexander Afanasyeve76f2632012-03-05 00:18:42 -080061
Alexander Afanasyev150f14d2012-03-05 21:24:49 -080062# doxygen docs
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080063from waflib.Build import BuildContext
64class doxy (BuildContext):
65 cmd = "doxygen"
66 fun = "doxygen"
Alexander Afanasyev7a696fb2012-03-01 17:17:22 -080067
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080068def doxygen (bld):
Alexander Afanasyev34ebcb72012-03-08 15:54:55 -080069 if not bld.env.DOXYGEN:
70 bld.fatal ("ERROR: cannot build documentation (`doxygen' is not found in $PATH)")
Alexander Afanasyev182fdc22012-03-05 18:06:52 -080071 bld (features="doxygen",
72 doxyfile='doc/doxygen.conf',
73 output_dir = 'doc')