akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | |
| 3 | VERSION='1.0.0' |
| 4 | APPNAME='nlsr' |
| 5 | |
| 6 | from waflib import Configure, Build, Logs |
| 7 | |
| 8 | def options(opt): |
| 9 | opt.load('compiler_cxx boost') |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 10 | |
| 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 | |
| 15 | def 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 | |
| 47 | def 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', |
akmhoque | c4eb26c | 2014-02-14 11:18:03 -0600 | [diff] [blame^] | 54 | #cwd = bld.path.find_dir ("src"), |
akmhoque | 1ec25f2 | 2014-02-13 14:19:11 -0600 | [diff] [blame] | 55 | includes = ['src'], |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 56 | ) |
| 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 |
| 66 | def 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 |