blob: ce05b4b4ec6bbf50fde1b58aae6d083498c00d83 [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
3VERSION='1.0.0'
4APPNAME='nlsr'
5
6from waflib import Configure, Build, Logs
7
8def options(opt):
9 opt.load('compiler_cxx boost')
10 # opt.load('ndnx', tooldir=["waf-tools"])
11
12 syncopt = opt.add_option_group ("nlsr Options")
13
14 syncopt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')
15
16def configure(conf):
17 conf.load('compiler_cxx boost')
18
19 if conf.options.debug:
20 conf.define ('_DEBUG', 1)
21 conf.add_supported_cxxflags (cxxflags = ['-O0',
22 '-Wall',
23 '-Wno-unused-variable',
24 '-g3',
25 '-Wno-unused-private-field', # only clang supports
26 '-fcolor-diagnostics', # only clang supports
27 '-Qunused-arguments', # only clang supports
28 '-Wno-tautological-compare', # suppress warnings from CryptoPP
29 '-Wno-deprecated-declarations'
30 ])
31 else:
32 conf.add_supported_cxxflags (cxxflags = ['-O3',
33 '-g',
34 '-Wno-unused-variable',
35 '-Wno-tautological-compare',
36 '-Wno-unused-function',
37 '-Wno-deprecated-declarations'
38 ])
39
40 conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'], uselib_store='NDNCPP', mandatory=True)
41
42 conf.check_boost(lib='system iostreams thread unit_test_framework', mandatory=True)
43
44 conf.check_cfg(package='ChronoSync', args=['--cflags', '--libs'], uselib_store='ChronoSync', mandatory=True)
45
46
47
48def build (bld):
49 bld (
50 # vnum = "1.0.0",
51 features=['cxx', 'cxxprogram'],
52 target="nlsr",
53 source = bld.path.ant_glob('src/*.cpp'),
54 use = 'BOOST NDNCPP ChronoSync',
55 #cwd = bld.path.find_dir ("src"),
56 #includes = ['src'],
57 )
58
59 #bld.install_files (
60 # dest = "%s/nlsr" % bld.env['INCLUDEDIR'],
61 # files = bld.path.ant_glob(['*.hpp']),
62 # cwd = bld.path.find_dir ("src"),
63 # relative_trick = True,
64 # )
65
66@Configure.conf
67def add_supported_cxxflags(self, cxxflags):
68 """
69 Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
70 """
71 self.start_msg('Checking allowed flags for c++ compiler')
72
73 supportedFlags = []
74 for flag in cxxflags:
75 if self.check_cxx (cxxflags=[flag], mandatory=False):
76 supportedFlags += [flag]
77
78 self.end_msg (' '.join (supportedFlags))
79 self.env.CXXFLAGS += supportedFlags