blob: cdceeaa906a1b5a31e89d5302dc7f0ea780be607 [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''')
akmhoque2bb198e2014-02-28 11:46:27 -060011 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''')
akmhoque298385a2014-02-13 14:13:09 -060013
14def configure(conf):
akmhoque2bb198e2014-02-28 11:46:27 -060015 conf.load("compiler_c compiler_cxx boost gnu_dirs c_osx cryptopp")
akmhoque298385a2014-02-13 14:13:09 -060016
17 if conf.options.debug:
18 conf.define ('_DEBUG', 1)
akmhoque85d88332014-02-17 21:11:21 -060019 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)
akmhoque298385a2014-02-13 14:13:09 -060034 else:
akmhoque85d88332014-02-17 21:11:21 -060035 flags = ['-O3', '-g', '-Wno-tautological-compare','-Wno-unused-variable',
36 '-Wno-unused-function', '-Wno-deprecated-declarations']
37 conf.add_supported_cxxflags (cxxflags = flags)
akmhoque2bb198e2014-02-28 11:46:27 -060038 if Utils.unversioned_sys_platform () == "darwin":
39 conf.check_cxx(framework_name='CoreFoundation', uselib_store='OSX_COREFOUNDATION', mandatory=True)
40 conf.check_cxx(framework_name='CoreServices', uselib_store='OSX_CORESERVICES', mandatory=True)
41 conf.check_cxx(framework_name='Security', uselib_store='OSX_SECURITY', define_name='HAVE_SECURITY',
42 use="OSX_COREFOUNDATION", mandatory=True)
43 conf.define('HAVE_OSX_SECURITY', 1)
akmhoque298385a2014-02-13 14:13:09 -060044
akmhoque85d88332014-02-17 21:11:21 -060045 conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'], uselib_store='NDN_CPP', mandatory=True)
46 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 -060047 conf.check_cfg(package='nsync', args=['--cflags', '--libs'], uselib_store='nsync', mandatory=True)
akmhoque2bb198e2014-02-28 11:46:27 -060048 conf.check_cfg(package='sqlite3', args=['--cflags', '--libs'], uselib_store='SQLITE3', mandatory=True)
49 conf.check_cryptopp(path=conf.options.cryptopp_dir, mandatory=True)
50
51 if Utils.unversioned_sys_platform () == "darwin":
52 conf.env['WITH_OSX_KEYCHAIN'] = conf.options.with_osx_keychain
53 if conf.options.with_osx_keychain:
54 conf.define('WITH_OSX_KEYCHAIN', 1)
55 else:
56 conf.env['WITH_OSX_KEYCHAIN'] = False
akmhoque298385a2014-02-13 14:13:09 -060057
58def build (bld):
59 bld (
akmhoque298385a2014-02-13 14:13:09 -060060 features=['cxx', 'cxxprogram'],
61 target="nlsr",
akmhoque2bb198e2014-02-28 11:46:27 -060062 source = bld.path.ant_glob('src/**/*.cpp'),
63 use = 'NDN_CPP BOOST CRYPTOPP SQLITE3 nsync',
64 includes = ". src"
akmhoque298385a2014-02-13 14:13:09 -060065 )
66
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
akmhoque85d88332014-02-17 21:11:21 -060081