akmhoque | 099495b | 2014-03-11 16:01:19 -0500 | [diff] [blame^] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | |
| 3 | from waflib import Build, Logs, Utils, Task, TaskGen, Configure |
| 4 | |
| 5 | def options(opt): |
| 6 | opt.load('compiler_c compiler_cxx gnu_dirs c_osx cryptopp boost') |
| 7 | #opt.load('boost cryptopp', tooldir=['waf-tools']) |
| 8 | |
| 9 | opt = opt.add_option_group('Certtool Options') |
| 10 | opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''') |
| 11 | #opt.add_option('--without-osx-keychain', action='store_false', default=True, dest='with_osx_keychain', |
| 12 | # help='''On Darwin, do not use OSX keychain as a default TPM''') |
| 13 | |
| 14 | def configure(conf): |
| 15 | conf.load("compiler_c compiler_cxx gnu_dirs c_osx cryptopp boost") |
| 16 | |
| 17 | if conf.options.debug: |
| 18 | conf.define ('_DEBUG', 1) |
| 19 | flags = ['-O0', |
| 20 | '-Wall', |
| 21 | # '-Werror', |
| 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-unused-function', # another annoying warning from CryptoPP |
| 29 | |
| 30 | '-Wno-deprecated-declarations', |
| 31 | ] |
| 32 | |
| 33 | conf.add_supported_cxxflags (cxxflags = flags) |
| 34 | else: |
| 35 | flags = ['-O3', '-g', '-Wno-tautological-compare','-Wno-unused-variable', |
| 36 | '-Wno-unused-function', '-Wno-deprecated-declarations'] |
| 37 | conf.add_supported_cxxflags (cxxflags = flags) |
| 38 | |
| 39 | conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'], uselib_store='NDN_CPP', mandatory=True) |
| 40 | conf.check_boost(lib='system iostreams thread unit_test_framework log', uselib_store='BOOST', version='1_55', mandatory=True) |
| 41 | conf.check_cfg(package='sqlite3', args=['--cflags', '--libs'], uselib_store='SQLITE3', mandatory=True) |
| 42 | conf.check_cryptopp(path=conf.options.cryptopp_dir, mandatory=True) |
| 43 | |
| 44 | |
| 45 | def build (bld): |
| 46 | bld ( |
| 47 | features=['cxx', 'cxxprogram'], |
| 48 | target="certtool", |
| 49 | source = bld.path.ant_glob('*.cpp'), |
| 50 | use = 'NDN_CPP BOOST CRYPTOPP SQLITE3', |
| 51 | #includes = ". src" |
| 52 | ) |
| 53 | |
| 54 | @Configure.conf |
| 55 | def add_supported_cxxflags(self, cxxflags): |
| 56 | """ |
| 57 | Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable |
| 58 | """ |
| 59 | self.start_msg('Checking allowed flags for c++ compiler') |
| 60 | |
| 61 | supportedFlags = [] |
| 62 | for flag in cxxflags: |
| 63 | if self.check_cxx (cxxflags=[flag], mandatory=False): |
| 64 | supportedFlags += [flag] |
| 65 | |
| 66 | self.end_msg (' '.join (supportedFlags)) |
| 67 | self.env.CXXFLAGS += supportedFlags |