blob: 200ccbf41666b5ce4a60f6204c451298ed2347c6 [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
akmhoque05d5fcf2014-04-15 14:58:45 -05002VERSION='1.0'
3NAME="NLSR"
akmhoque298385a2014-02-13 14:13:09 -06004
akmhoque85d88332014-02-17 21:11:21 -06005from waflib import Build, Logs, Utils, Task, TaskGen, Configure
akmhoque05d5fcf2014-04-15 14:58:45 -05006from waflib.Tools import c_preproc
akmhoque298385a2014-02-13 14:13:09 -06007
8def options(opt):
akmhoque85d88332014-02-17 21:11:21 -06009 opt.load('compiler_c compiler_cxx gnu_dirs c_osx')
akmhoque05d5fcf2014-04-15 14:58:45 -050010 opt.load('boost openssl cryptopp', tooldir=['waf-tools'])
akmhoque298385a2014-02-13 14:13:09 -060011
akmhoque05d5fcf2014-04-15 14:58:45 -050012 opt = opt.add_option_group('NLSR Options')
13
akmhoque85d88332014-02-17 21:11:21 -060014 opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')
akmhoque298385a2014-02-13 14:13:09 -060015
akmhoque05d5fcf2014-04-15 14:58:45 -050016
akmhoque298385a2014-02-13 14:13:09 -060017def configure(conf):
akmhoque05d5fcf2014-04-15 14:58:45 -050018 conf.load("compiler_c compiler_cxx boost gnu_dirs c_osx openssl cryptopp")
19
20 conf.check_openssl()
akmhoque298385a2014-02-13 14:13:09 -060021
22 if conf.options.debug:
23 conf.define ('_DEBUG', 1)
akmhoque85d88332014-02-17 21:11:21 -060024 flags = ['-O0',
25 '-Wall',
26 # '-Werror',
27 '-Wno-unused-variable',
28 '-g3',
29 '-Wno-unused-private-field', # only clang supports
30 '-fcolor-diagnostics', # only clang supports
31 '-Qunused-arguments', # only clang supports
32 '-Wno-tautological-compare', # suppress warnings from CryptoPP
33 '-Wno-unused-function', # another annoying warning from CryptoPP
34
35 '-Wno-deprecated-declarations',
36 ]
37
38 conf.add_supported_cxxflags (cxxflags = flags)
akmhoque298385a2014-02-13 14:13:09 -060039 else:
akmhoque05d5fcf2014-04-15 14:58:45 -050040 flags = ['-O3', '-g', '-Wno-tautological-compare', '-Wno-unused-function', '-Wno-deprecated-declarations']
akmhoque85d88332014-02-17 21:11:21 -060041 conf.add_supported_cxxflags (cxxflags = flags)
akmhoque298385a2014-02-13 14:13:09 -060042
akmhoque05d5fcf2014-04-15 14:58:45 -050043
akmhoque85d88332014-02-17 21:11:21 -060044 conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'], uselib_store='NDN_CPP', mandatory=True)
akmhoque50fda022014-02-21 17:58:27 -060045 conf.check_cfg(package='nsync', args=['--cflags', '--libs'], uselib_store='nsync', mandatory=True)
akmhoque2bb198e2014-02-28 11:46:27 -060046 conf.check_cfg(package='sqlite3', args=['--cflags', '--libs'], uselib_store='SQLITE3', mandatory=True)
47 conf.check_cryptopp(path=conf.options.cryptopp_dir, mandatory=True)
akmhoque05d5fcf2014-04-15 14:58:45 -050048 conf.check_boost(lib='system iostreams thread unit_test_framework log', uselib_store='BOOST', mandatory=True)
49 if conf.env.BOOST_VERSION_NUMBER < 105400:
50 Logs.error ("Minimum required boost version is 1.54.0")
51 Logs.error ("Please upgrade your distribution or install custom boost libraries")
52 return
53
54
55
akmhoque298385a2014-02-13 14:13:09 -060056
57def build (bld):
58 bld (
akmhoque298385a2014-02-13 14:13:09 -060059 features=['cxx', 'cxxprogram'],
60 target="nlsr",
akmhoque2bb198e2014-02-28 11:46:27 -060061 source = bld.path.ant_glob('src/**/*.cpp'),
62 use = 'NDN_CPP BOOST CRYPTOPP SQLITE3 nsync',
63 includes = ". src"
akmhoque298385a2014-02-13 14:13:09 -060064 )
akmhoqueeb764c52014-03-11 16:01:09 -050065 bld.recurse("CertTool")
akmhoque298385a2014-02-13 14:13:09 -060066
akmhoque298385a2014-02-13 14:13:09 -060067@Configure.conf
68def add_supported_cxxflags(self, cxxflags):
69 """
70 Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
71 """
72 self.start_msg('Checking allowed flags for c++ compiler')
73
74 supportedFlags = []
75 for flag in cxxflags:
76 if self.check_cxx (cxxflags=[flag], mandatory=False):
77 supportedFlags += [flag]
78
79 self.end_msg (' '.join (supportedFlags))
80 self.env.CXXFLAGS += supportedFlags