| # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| VERSION='0.1' |
| APPNAME='test-project' |
| |
| from waflib import Build, Logs, Utils, Task, TaskGen, Configure |
| |
| def options(opt): |
| opt.load('compiler_c compiler_cxx boost ccnx') |
| |
| def configure(conf): |
| conf.load("compiler_c compiler_cxx ccnx") |
| |
| conf.add_supported_cxxflags (cxxflags = ['-O0', |
| '-Wall', |
| '-Wno-unused-variable', |
| '-g3', |
| '-Wno-unused-private-field', |
| '-fcolor-diagnostics', |
| '-Qunused-arguments' |
| ]) |
| |
| if not conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL', mandatory=False): |
| libcrypto = conf.check_cc(lib='crypto', |
| header_name='openssl/crypto.h', |
| define_name='HAVE_SSL', |
| uselib_store='SSL') |
| else: |
| conf.define ("HAVE_SSL", 1) |
| if not conf.get_define ("HAVE_SSL"): |
| conf.fatal ("Cannot find SSL libraries") |
| |
| conf.check_ccnx (path=conf.options.ccnx_dir) |
| conf.check_cfg(package='libndn.cxx', args=['--cflags', '--libs'], uselib_store='CCNXCPP', mandatory=True) |
| |
| conf.load('boost') |
| conf.check_boost(lib='system test iostreams filesystem thread') |
| |
| def build (bld): |
| bld ( |
| features = ["cxx", "cxxprogram"], |
| target = "client", |
| source = "client.cc", |
| use = 'BOOST BOOST_THREAD CCNX CCNXCPP', |
| ) |
| |
| bld ( |
| features = ["cxx", "cxxprogram"], |
| target = "server", |
| source = "server.cc", |
| use = 'BOOST BOOST_THREAD CCNX CCNXCPP', |
| ) |
| |
| @Configure.conf |
| def add_supported_cxxflags(self, cxxflags): |
| """ |
| Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable |
| """ |
| self.start_msg('Checking allowed flags for c++ compiler') |
| |
| supportedFlags = [] |
| for flag in cxxflags: |
| if self.check_cxx (cxxflags=[flag], mandatory=False): |
| supportedFlags += [flag] |
| |
| self.end_msg (' '.join (supportedFlags)) |
| self.env.CXXFLAGS += supportedFlags |