blob: 061fb26065e7f68623b3c67ccdc71e4b00993872 [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
akmhoque85d88332014-02-17 21:11:21 -06003from waflib import Build, Logs, Utils, Task, TaskGen, Configure
akmhoque298385a2014-02-13 14:13:09 -06004
5def options(opt):
akmhoque85d88332014-02-17 21:11:21 -06006 opt.load('compiler_c compiler_cxx gnu_dirs c_osx')
akmhoque2bb198e2014-02-28 11:46:27 -06007 opt.load('boost cryptopp', tooldir=['waf-tools'])
akmhoque298385a2014-02-13 14:13:09 -06008
akmhoque85d88332014-02-17 21:11:21 -06009 opt = opt.add_option_group('Options')
10 opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')
akmhoque298385a2014-02-13 14:13:09 -060011
12def configure(conf):
akmhoque2bb198e2014-02-28 11:46:27 -060013 conf.load("compiler_c compiler_cxx boost gnu_dirs c_osx cryptopp")
akmhoque298385a2014-02-13 14:13:09 -060014
15 if conf.options.debug:
16 conf.define ('_DEBUG', 1)
akmhoque85d88332014-02-17 21:11:21 -060017 flags = ['-O0',
18 '-Wall',
19 # '-Werror',
20 '-Wno-unused-variable',
21 '-g3',
22 '-Wno-unused-private-field', # only clang supports
23 '-fcolor-diagnostics', # only clang supports
24 '-Qunused-arguments', # only clang supports
25 '-Wno-tautological-compare', # suppress warnings from CryptoPP
26 '-Wno-unused-function', # another annoying warning from CryptoPP
27
28 '-Wno-deprecated-declarations',
29 ]
30
31 conf.add_supported_cxxflags (cxxflags = flags)
akmhoque298385a2014-02-13 14:13:09 -060032 else:
akmhoque5a44dd42014-03-12 18:11:32 -050033 flags = ['-O3', '-g','-Wno-unused-variable', '-Wno-tautological-compare',
akmhoque85d88332014-02-17 21:11:21 -060034 '-Wno-unused-function', '-Wno-deprecated-declarations']
35 conf.add_supported_cxxflags (cxxflags = flags)
akmhoque298385a2014-02-13 14:13:09 -060036
akmhoque85d88332014-02-17 21:11:21 -060037 conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'], uselib_store='NDN_CPP', mandatory=True)
38 conf.check_boost(lib='system iostreams thread unit_test_framework log', uselib_store='BOOST', version='1_55', mandatory=True)
akmhoque50fda022014-02-21 17:58:27 -060039 conf.check_cfg(package='nsync', args=['--cflags', '--libs'], uselib_store='nsync', mandatory=True)
akmhoque2bb198e2014-02-28 11:46:27 -060040 conf.check_cfg(package='sqlite3', args=['--cflags', '--libs'], uselib_store='SQLITE3', mandatory=True)
41 conf.check_cryptopp(path=conf.options.cryptopp_dir, mandatory=True)
akmhoque298385a2014-02-13 14:13:09 -060042
43def build (bld):
44 bld (
akmhoque298385a2014-02-13 14:13:09 -060045 features=['cxx', 'cxxprogram'],
46 target="nlsr",
akmhoque2bb198e2014-02-28 11:46:27 -060047 source = bld.path.ant_glob('src/**/*.cpp'),
48 use = 'NDN_CPP BOOST CRYPTOPP SQLITE3 nsync',
49 includes = ". src"
akmhoque298385a2014-02-13 14:13:09 -060050 )
akmhoqueeb764c52014-03-11 16:01:09 -050051 bld.recurse("CertTool")
akmhoque298385a2014-02-13 14:13:09 -060052
akmhoque298385a2014-02-13 14:13:09 -060053@Configure.conf
54def add_supported_cxxflags(self, cxxflags):
55 """
56 Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
57 """
58 self.start_msg('Checking allowed flags for c++ compiler')
59
60 supportedFlags = []
61 for flag in cxxflags:
62 if self.check_cxx (cxxflags=[flag], mandatory=False):
63 supportedFlags += [flag]
64
65 self.end_msg (' '.join (supportedFlags))
66 self.env.CXXFLAGS += supportedFlags