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