blob: 585b6a9ad5e1f627a2eede5d552e828ff0312749 [file] [log] [blame]
Zhenkai Zhua7e3da72012-12-27 13:45:00 -08001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
3VERSION='0.0.1'
4APPNAME='chronoshare'
5
6from waflib import Build, Logs
7
8def options(opt):
9 opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')
10 opt.add_option('--test', action='store_true',default=False,dest='_test',help='''build unit tests''')
11 opt.load('compiler_c')
12 opt.load('compiler_cxx')
13 opt.load('boost')
14 opt.load('gnu_dirs')
15 opt.load('ccnx protobuf', tooldir=["waf-tools"])
16
17def configure(conf):
18 conf.load("compiler_cxx")
19 conf.load('gnu_dirs')
20
21 if not conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL', mandatory=False):
22 libcrypto = conf.check_cc(lib='crypto',
23 header_name='openssl/crypto.h',
24 define_name='HAVE_SSL',
25 uselib_store='SSL')
26 if not conf.get_define ("HAVE_SSL"):
27 conf.fatal ("Cannot find SSL libraries")
28
29 conf.load('boost')
30
31 conf.check_boost(lib='system iostreams test thread')
32
33 conf.load ('ccnx')
34 conf.check_ccnx (path=conf.options.ccnx_dir)
35
36 if conf.options.debug:
37 conf.define ('_DEBUG', 1)
38 conf.env.append_value('CXXFLAGS', ['-O0', '-g3'])
39 else:
40 conf.env.append_value('CXXFLAGS', ['-O3', '-g'])
41
42 if conf.options._test:
43 conf.define('_TEST', 1)
44
45 conf.load('protobuf')
46
47def build (bld):
48 bld.post_mode = Build.POST_LAZY
49
50 bld.add_group ("protobuf")
51
52# x = bld (
53# features = ["protobuf"],
54# source = ["model/sync-state.proto"],
55# target = ["model/sync-state.pb"],
56# )
57
58 bld.add_group ("code")
59
60 libccnx = bld (
61 target=APPNAME,
62 features=['cxx', 'cxxshlib'],
63 source = [
64 'src/ccnx-wrapper.cpp',
65 'src/ccnx-tunnel.cpp',
66 ],
67 use = 'BOOST BOOST_THREAD SSL CCNX',
68 includes = ['include', ],
69 )
70
71 # Unit tests
72 if bld.get_define("_TEST"):
73 unittests = bld.program (
74 target="unit-tests",
75 source = bld.path.ant_glob(['test/**/*.cc']),
76 features=['cxx', 'cxxprogram'],
77 use = 'BOOST_TEST',
78 includes = ['include', ],
79 )
80
81
82
83