blob: a08e2b58b4c79ff75ea8d40d903471178a4b9bf8 [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'
Zhenkai Zhubad089c2012-12-28 10:28:27 -08005CCNXLIB='ccnx'
Zhenkai Zhua7e3da72012-12-27 13:45:00 -08006
7from waflib import Build, Logs
8
9def options(opt):
10 opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')
11 opt.add_option('--test', action='store_true',default=False,dest='_test',help='''build unit tests''')
12 opt.load('compiler_c')
13 opt.load('compiler_cxx')
14 opt.load('boost')
15 opt.load('gnu_dirs')
16 opt.load('ccnx protobuf', tooldir=["waf-tools"])
17
18def configure(conf):
19 conf.load("compiler_cxx")
20 conf.load('gnu_dirs')
21
22 if not conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL', mandatory=False):
23 libcrypto = conf.check_cc(lib='crypto',
24 header_name='openssl/crypto.h',
25 define_name='HAVE_SSL',
26 uselib_store='SSL')
27 if not conf.get_define ("HAVE_SSL"):
28 conf.fatal ("Cannot find SSL libraries")
29
30 conf.load('boost')
31
Zhenkai Zhuf3b852f2012-12-27 14:02:00 -080032 conf.check_boost(lib='system test thread')
Zhenkai Zhua7e3da72012-12-27 13:45:00 -080033
34 conf.load ('ccnx')
35 conf.check_ccnx (path=conf.options.ccnx_dir)
36
37 if conf.options.debug:
38 conf.define ('_DEBUG', 1)
39 conf.env.append_value('CXXFLAGS', ['-O0', '-g3'])
40 else:
41 conf.env.append_value('CXXFLAGS', ['-O3', '-g'])
42
43 if conf.options._test:
44 conf.define('_TEST', 1)
45
46 conf.load('protobuf')
47
48def build (bld):
49 bld.post_mode = Build.POST_LAZY
50
51 bld.add_group ("protobuf")
52
53# x = bld (
54# features = ["protobuf"],
55# source = ["model/sync-state.proto"],
56# target = ["model/sync-state.pb"],
57# )
58
59 bld.add_group ("code")
60
61 libccnx = bld (
Zhenkai Zhubad089c2012-12-28 10:28:27 -080062 target=CCNXLIB,
Zhenkai Zhua7e3da72012-12-27 13:45:00 -080063 features=['cxx', 'cxxshlib'],
64 source = [
65 'src/ccnx-wrapper.cpp',
Zhenkai Zhubad089c2012-12-28 10:28:27 -080066 'src/ccnx-pco.cpp',
Zhenkai Zhud4924312012-12-28 11:35:12 -080067 'src/ccnx-tunnel.cpp',
Zhenkai Zhua7e3da72012-12-27 13:45:00 -080068 ],
69 use = 'BOOST BOOST_THREAD SSL CCNX',
70 includes = ['include', ],
71 )
72
73 # Unit tests
74 if bld.get_define("_TEST"):
75 unittests = bld.program (
76 target="unit-tests",
77 source = bld.path.ant_glob(['test/**/*.cc']),
78 features=['cxx', 'cxxprogram'],
79 use = 'BOOST_TEST',
80 includes = ['include', ],
81 )
82
83
84
85