Jeff Thompson | fa30664 | 2013-06-17 15:06:57 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | VERSION='0.1' |
| 3 | APPNAME='test-project' |
| 4 | |
| 5 | from waflib import Build, Logs, Utils, Task, TaskGen, Configure |
| 6 | |
| 7 | def options(opt): |
| 8 | opt.load('compiler_c compiler_cxx boost ccnx') |
| 9 | |
| 10 | def configure(conf): |
| 11 | conf.load("compiler_c compiler_cxx ccnx") |
| 12 | |
| 13 | conf.add_supported_cxxflags (cxxflags = ['-O0', |
| 14 | '-Wall', |
| 15 | '-Wno-unused-variable', |
| 16 | '-g3', |
| 17 | '-Wno-unused-private-field', |
| 18 | '-fcolor-diagnostics', |
| 19 | '-Qunused-arguments' |
| 20 | ]) |
| 21 | |
| 22 | if not conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL', mandatory=False): |
| 23 | libcrypto = conf.check_cc(lib='crypto', |
| 24 | header_name='openssl/crypto.h', |
| 25 | define_name='HAVE_SSL', |
| 26 | uselib_store='SSL') |
| 27 | else: |
| 28 | conf.define ("HAVE_SSL", 1) |
| 29 | if not conf.get_define ("HAVE_SSL"): |
| 30 | conf.fatal ("Cannot find SSL libraries") |
| 31 | |
| 32 | conf.check_ccnx (path=conf.options.ccnx_dir) |
| 33 | conf.check_cfg(package='libndn.cxx', args=['--cflags', '--libs'], uselib_store='CCNXCPP', mandatory=True) |
| 34 | |
| 35 | conf.load('boost') |
| 36 | conf.check_boost(lib='system test iostreams filesystem thread') |
| 37 | |
| 38 | def build (bld): |
| 39 | bld ( |
| 40 | features = ["cxx", "cxxprogram"], |
| 41 | target = "client", |
| 42 | source = "client.cc", |
| 43 | use = 'BOOST BOOST_THREAD CCNX CCNXCPP', |
| 44 | ) |
| 45 | |
| 46 | bld ( |
| 47 | features = ["cxx", "cxxprogram"], |
| 48 | target = "server", |
| 49 | source = "server.cc", |
| 50 | use = 'BOOST BOOST_THREAD CCNX CCNXCPP', |
| 51 | ) |
| 52 | |
| 53 | @Configure.conf |
| 54 | def 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 |