Add "PSYNC_" prefix to access specifier macros to avoid conflicts
Also, sync boost.py waf tool with ndn-cxx
Change-Id: I75ed79725706313c3e64913de0fac17e2c182b8c
diff --git a/.waf-tools/boost.py b/.waf-tools/boost.py
index d7e0107..4b2ede5 100644
--- a/.waf-tools/boost.py
+++ b/.waf-tools/boost.py
@@ -56,6 +56,7 @@
BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib']
BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include']
+
BOOST_VERSION_FILE = 'boost/version.hpp'
BOOST_VERSION_CODE = '''
#include <iostream>
@@ -90,13 +91,18 @@
BOOST_LOG_CODE = '''
#include <boost/log/trivial.hpp>
+int main() { BOOST_LOG_TRIVIAL(info) << "boost_log is working"; }
+'''
+
+BOOST_LOG_SETUP_CODE = '''
+#include <boost/log/trivial.hpp>
#include <boost/log/utility/setup/console.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
int main() {
using namespace boost::log;
add_common_attributes();
add_console_log(std::clog, keywords::format = "%Message%");
- BOOST_LOG_TRIVIAL(debug) << "log is working" << std::endl;
+ BOOST_LOG_TRIVIAL(info) << "boost_log_setup is working";
}
'''
@@ -145,7 +151,7 @@
opt.add_option('--boost-abi', type='string', default='', dest='boost_abi',
help='''select libraries with tags (gd for debug, static is automatically added),
see doc Boost, Getting Started, chapter 6.1''')
- opt.add_option('--boost-linkage_autodetect', action="store_true", dest='boost_linkage_autodetect',
+ opt.add_option('--boost-linkage_autodetect', action='store_true', dest='boost_linkage_autodetect',
help="auto-detect boost linkage options (don't get used to it / might break other stuff)")
opt.add_option('--boost-toolset', type='string',
default='', dest='boost_toolset',
@@ -175,7 +181,7 @@
try:
txt = node.read()
except EnvironmentError:
- Logs.error("Could not read the file %r" % node.abspath())
+ Logs.error('Could not read the file %r' % node.abspath())
else:
re_but1 = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.+)"', re.M)
m1 = re_but1.search(txt)
@@ -183,7 +189,7 @@
m2 = re_but2.search(txt)
if m1 and m2:
return (m1.group(1), m2.group(1))
- return self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[d], execute=True, define_ret=True).split(":")
+ return self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[d], execute=True, define_ret=True).split(':')
@conf
def boost_get_includes(self, *k, **kw):
@@ -194,10 +200,10 @@
if self.__boost_get_version_file(d):
return d
if includes:
- self.end_msg('headers not found in %s' % includes)
+ self.end_msg('headers not found in %s' % includes, 'YELLOW')
self.fatal('The configuration failed')
else:
- self.end_msg('headers not found, please provide a --boost-includes argument (see help)')
+ self.end_msg('headers not found, please provide a --boost-includes argument (see help)', 'YELLOW')
self.fatal('The configuration failed')
@@ -240,10 +246,10 @@
break
if not path:
if libs:
- self.end_msg('libs not found in %s' % libs)
+ self.end_msg('libs not found in %s' % libs, 'YELLOW')
self.fatal('The configuration failed')
else:
- self.end_msg('libs not found, please provide a --boost-libs argument (see help)')
+ self.end_msg('libs not found, please provide a --boost-libs argument (see help)', 'YELLOW')
self.fatal('The configuration failed')
self.to_log('Found the boost path in %r with the libraries:' % path)
@@ -313,7 +319,7 @@
libs.append(format_lib_name(file.name))
break
else:
- self.end_msg('lib %s not found in %s' % (lib, path.abspath()))
+ self.end_msg('lib %s not found in %s' % (lib, path.abspath()), 'YELLOW')
self.fatal('The configuration failed')
return libs
@@ -354,7 +360,7 @@
# ... -mt is also the pthreads flag for HP/aCC
# -lpthread: GNU Linux, etc.
# --thread-safe: KAI C++
- if Utils.unversioned_sys_platform() == "sunos":
+ if Utils.unversioned_sys_platform() == 'sunos':
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
@@ -362,23 +368,22 @@
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
- boost_pthread_flags = ["-pthreads", "-lpthread", "-mt", "-pthread"]
+ boost_pthread_flags = ['-pthreads', '-lpthread', '-mt', '-pthread']
else:
- boost_pthread_flags = ["", "-lpthreads", "-Kthread", "-kthread", "-llthread", "-pthread",
- "-pthreads", "-mthreads", "-lpthread", "--thread-safe", "-mt"]
+ boost_pthread_flags = ['', '-lpthreads', '-Kthread', '-kthread', '-llthread', '-pthread',
+ '-pthreads', '-mthreads', '-lpthread', '--thread-safe', '-mt']
for boost_pthread_flag in boost_pthread_flags:
try:
self.env.stash()
self.env['CXXFLAGS_%s' % var] += [boost_pthread_flag]
self.env['LINKFLAGS_%s' % var] += [boost_pthread_flag]
- self.check_cxx(code=PTHREAD_CODE, msg=None, use=var, execute=False)
-
+ self.check_cxx(code=PTHREAD_CODE, msg=None, use=var, execute=False, quiet=True)
self.end_msg(boost_pthread_flag)
return
except self.errors.ConfigurationError:
self.env.revert()
- self.end_msg('None')
+ self.end_msg('none')
@conf
def check_boost(self, *k, **kw):
@@ -403,21 +408,24 @@
var = kw.get('uselib_store', 'BOOST')
- self.find_program('dpkg-architecture', var='DPKG_ARCHITECTURE', mandatory=False)
- if self.env.DPKG_ARCHITECTURE:
- deb_host_multiarch = self.cmd_and_log([self.env.DPKG_ARCHITECTURE[0], '-qDEB_HOST_MULTIARCH'])
- BOOST_LIBS.insert(0, '/usr/lib/%s' % deb_host_multiarch.strip())
+ if not self.env.DONE_FIND_BOOST_COMMON:
+ self.find_program('dpkg-architecture', var='DPKG_ARCHITECTURE', mandatory=False)
+ if self.env.DPKG_ARCHITECTURE:
+ deb_host_multiarch = self.cmd_and_log([self.env.DPKG_ARCHITECTURE[0], '-qDEB_HOST_MULTIARCH'])
+ BOOST_LIBS.insert(0, '/usr/lib/%s' % deb_host_multiarch.strip())
- self.start_msg('Checking boost includes')
- self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
- versions = self.boost_get_version(inc)
- self.env.BOOST_VERSION = versions[0]
- self.env.BOOST_VERSION_NUMBER = int(versions[1])
- self.end_msg("%d.%d.%d" % (int(versions[1]) / 100000,
- int(versions[1]) / 100 % 1000,
- int(versions[1]) % 100))
- if Logs.verbose:
- Logs.pprint('CYAN', ' path : %s' % self.env['INCLUDES_%s' % var])
+ self.start_msg('Checking boost includes')
+ self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
+ versions = self.boost_get_version(inc)
+ self.env.BOOST_VERSION = versions[0]
+ self.env.BOOST_VERSION_NUMBER = int(versions[1])
+ self.end_msg('%d.%d.%d' % (int(versions[1]) / 100000,
+ int(versions[1]) / 100 % 1000,
+ int(versions[1]) % 100))
+ if Logs.verbose:
+ Logs.pprint('CYAN', ' path : %s' % self.env['INCLUDES_%s' % var])
+
+ self.env.DONE_FIND_BOOST_COMMON = True
if not params['lib'] and not params['stlib']:
return
@@ -429,7 +437,7 @@
self.env['STLIBPATH_%s' % var] = [path]
self.env['LIB_%s' % var] = libs
self.env['STLIB_%s' % var] = stlibs
- self.end_msg('ok')
+ self.end_msg(' '.join(libs + stlibs))
if Logs.verbose:
Logs.pprint('CYAN', ' path : %s' % path)
Logs.pprint('CYAN', ' shared libs : %s' % libs)
@@ -450,15 +458,18 @@
self.check_cxx(fragment=BOOST_ERROR_CODE, use=var, execute=False)
if has_lib('thread'):
self.check_cxx(fragment=BOOST_THREAD_CODE, use=var, execute=False)
- if has_lib('log'):
+ if has_lib('log') or has_lib('log_setup'):
if not has_lib('thread'):
self.env['DEFINES_%s' % var] += ['BOOST_LOG_NO_THREADS']
- if has_shlib('log'):
+ if has_shlib('log') or has_shlib('log_setup'):
self.env['DEFINES_%s' % var] += ['BOOST_LOG_DYN_LINK']
- self.check_cxx(fragment=BOOST_LOG_CODE, use=var, execute=False)
+ if has_lib('log_setup'):
+ self.check_cxx(fragment=BOOST_LOG_SETUP_CODE, use=var, execute=False)
+ else:
+ self.check_cxx(fragment=BOOST_LOG_CODE, use=var, execute=False)
if params.get('linkage_autodetect', False):
- self.start_msg("Attempting to detect boost linkage flags")
+ self.start_msg('Attempting to detect boost linkage flags')
toolset = self.boost_get_toolset(kw.get('toolset', ''))
if toolset in ('vc',):
# disable auto-linking feature, causing error LNK1181
@@ -480,10 +491,10 @@
# we attempt to play with some known-to-work CXXFLAGS combinations
for cxxflags in (['/MD', '/EHsc'], []):
self.env.stash()
- self.env["CXXFLAGS_%s" % var] += cxxflags
+ self.env['CXXFLAGS_%s' % var] += cxxflags
try:
try_link()
- self.end_msg("ok: winning cxxflags combination: %s" % (self.env["CXXFLAGS_%s" % var]))
+ self.end_msg('ok: winning cxxflags combination: %s' % (self.env['CXXFLAGS_%s' % var]))
exc = None
break
except Errors.ConfigurationError as e:
@@ -491,17 +502,17 @@
exc = e
if exc is not None:
- self.end_msg("Could not auto-detect boost linking flags combination, you may report it to boost.py author", ex=exc)
+ self.end_msg('Could not auto-detect boost linking flags combination, you may report it to boost.py author', ex=exc)
self.fatal('The configuration failed')
else:
- self.end_msg("Boost linkage flags auto-detection not implemented (needed ?) for this toolchain")
+ self.end_msg('Boost linkage flags auto-detection not implemented (needed ?) for this toolchain')
self.fatal('The configuration failed')
else:
self.start_msg('Checking for boost linkage')
try:
try_link()
except Errors.ConfigurationError as e:
- self.end_msg("Could not link against boost libraries using supplied options")
+ self.end_msg('Could not link against boost libraries using supplied options', 'YELLOW')
self.fatal('The configuration failed')
self.end_msg('ok')
diff --git a/.waf-tools/dependency-checker.py b/.waf-tools/dependency-checker.py
deleted file mode 100644
index 629fbfd..0000000
--- a/.waf-tools/dependency-checker.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# encoding: utf-8
-
-from waflib import Options, Logs
-from waflib.Configure import conf
-
-def addDependencyOptions(self, opt, name, extraHelp=''):
- opt.add_option('--with-%s' % name, type='string', default=None,
- dest='with_%s' % name,
- help='Path to %s, e.g., /usr/local %s' % (name, extraHelp))
-setattr(Options.OptionsContext, "addDependencyOptions", addDependencyOptions)
-
-@conf
-def checkDependency(self, name, **kw):
- root = kw.get('path', getattr(Options.options, 'with_%s' % name))
- kw['msg'] = kw.get('msg', 'Checking for %s library' % name)
- kw['uselib_store'] = kw.get('uselib_store', name.upper())
- kw['define_name'] = kw.get('define_name', 'HAVE_%s' % kw['uselib_store'])
- kw['mandatory'] = kw.get('mandatory', True)
-
- if root:
- isOk = self.check_cxx(includes="%s/include" % root,
- libpath="%s/lib" % root,
- **kw)
- else:
- isOk = self.check_cxx(**kw)
-
- if isOk:
- self.env[kw['define_name']] = True
diff --git a/PSync/consumer.hpp b/PSync/consumer.hpp
index cf803bd..e5b672d 100644
--- a/PSync/consumer.hpp
+++ b/PSync/consumer.hpp
@@ -20,9 +20,9 @@
#ifndef PSYNC_CONSUMER_HPP
#define PSYNC_CONSUMER_HPP
+#include "PSync/detail/access-specifiers.hpp"
#include "PSync/detail/bloom-filter.hpp"
#include "PSync/detail/util.hpp"
-#include "PSync/detail/test-access-control.hpp"
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/util/random.hpp>
@@ -166,7 +166,7 @@
void
onSyncData(const ndn::ConstBufferPtr& bufferPtr);
-PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
ndn::Face& m_face;
ndn::Scheduler m_scheduler;
diff --git a/PSync/detail/test-access-control.hpp b/PSync/detail/access-specifiers.hpp
similarity index 62%
rename from PSync/detail/test-access-control.hpp
rename to PSync/detail/access-specifiers.hpp
index 4aa447d..ad469a6 100644
--- a/PSync/detail/test-access-control.hpp
+++ b/PSync/detail/access-specifiers.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2019, The University of Memphis
*
* This file is part of PSync.
@@ -18,21 +18,21 @@
*
**/
-#ifndef PSYNC_TEST_ACCESS_CONTROL_HPP
-#define PSYNC_TEST_ACCESS_CONTROL_HPP
+#ifndef PSYNC_DETAIL_ACCESS_SPECIFIERS_HPP
+#define PSYNC_DETAIL_ACCESS_SPECIFIERS_HPP
#include "PSync/detail/config.hpp"
-#ifdef WITH_TESTS
-#define VIRTUAL_WITH_TESTS virtual
-#define PUBLIC_WITH_TESTS_ELSE_PROTECTED public
-#define PUBLIC_WITH_TESTS_ELSE_PRIVATE public
-#define PROTECTED_WITH_TESTS_ELSE_PRIVATE protected
+#ifdef PSYNC_WITH_TESTS
+#define PSYNC_VIRTUAL_WITH_TESTS virtual
+#define PSYNC_PUBLIC_WITH_TESTS_ELSE_PROTECTED public
+#define PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE public
+#define PSYNC_PROTECTED_WITH_TESTS_ELSE_PRIVATE protected
#else
-#define VIRTUAL_WITH_TESTS
-#define PUBLIC_WITH_TESTS_ELSE_PROTECTED protected
-#define PUBLIC_WITH_TESTS_ELSE_PRIVATE private
-#define PROTECTED_WITH_TESTS_ELSE_PRIVATE private
+#define PSYNC_VIRTUAL_WITH_TESTS
+#define PSYNC_PUBLIC_WITH_TESTS_ELSE_PROTECTED protected
+#define PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE private
+#define PSYNC_PROTECTED_WITH_TESTS_ELSE_PRIVATE private
#endif
-#endif // PSYNC_TEST_ACCESS_CONTROL_HPP
+#endif // PSYNC_DETAIL_ACCESS_SPECIFIERS_HPP
diff --git a/PSync/full-producer.hpp b/PSync/full-producer.hpp
index ace7813..f51ea7d 100644
--- a/PSync/full-producer.hpp
+++ b/PSync/full-producer.hpp
@@ -108,7 +108,7 @@
void
sendSyncInterest();
-PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
/**
* @brief Process sync interest from other parties
*
diff --git a/PSync/partial-producer.hpp b/PSync/partial-producer.hpp
index 2559af8..782078b 100644
--- a/PSync/partial-producer.hpp
+++ b/PSync/partial-producer.hpp
@@ -93,7 +93,7 @@
void
satisfyPendingSyncInterests(const ndn::Name& prefix);
-PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
/**
* @brief Receive hello interest from consumer and respond with hello data
*
@@ -117,7 +117,7 @@
void
onSyncInterest(const ndn::Name& prefix, const ndn::Interest& interest);
-PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
std::map<ndn::Name, PendingEntryInfo> m_pendingEntries;
ndn::ScopedRegisteredPrefixHandle m_registeredPrefix;
};
diff --git a/PSync/producer-base.hpp b/PSync/producer-base.hpp
index d5e2d4d..6463ea2 100644
--- a/PSync/producer-base.hpp
+++ b/PSync/producer-base.hpp
@@ -20,10 +20,10 @@
#ifndef PSYNC_PRODUCER_BASE_HPP
#define PSYNC_PRODUCER_BASE_HPP
-#include "PSync/detail/iblt.hpp"
+#include "PSync/detail/access-specifiers.hpp"
#include "PSync/detail/bloom-filter.hpp"
+#include "PSync/detail/iblt.hpp"
#include "PSync/detail/util.hpp"
-#include "PSync/detail/test-access-control.hpp"
#include "PSync/segment-publisher.hpp"
#include <ndn-cxx/face.hpp>
@@ -56,7 +56,7 @@
using std::runtime_error::runtime_error;
};
-PUBLIC_WITH_TESTS_ELSE_PROTECTED:
+PSYNC_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
/**
* @brief constructor
*
@@ -113,7 +113,7 @@
void
removeUserNode(const ndn::Name& prefix);
-PUBLIC_WITH_TESTS_ELSE_PROTECTED:
+PSYNC_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
/**
* @brief Update m_prefixes and IBF with the given prefix and seq
*
@@ -129,11 +129,9 @@
updateSeqNo(const ndn::Name& prefix, uint64_t seq);
bool
- isUserNode(const ndn::Name& prefix) {
- if (m_prefixes.find(prefix) == m_prefixes.end()) {
- return false;
- }
- return true;
+ isUserNode(const ndn::Name& prefix) const
+ {
+ return m_prefixes.find(prefix) != m_prefixes.end();
}
/**
@@ -156,7 +154,7 @@
void
onRegisterFailed(const ndn::Name& prefix, const std::string& msg) const;
-PUBLIC_WITH_TESTS_ELSE_PROTECTED:
+PSYNC_PUBLIC_WITH_TESTS_ELSE_PROTECTED:
IBLT m_iblt;
uint32_t m_expectedNumEntries;
// Threshold is used check if the differences are greater
@@ -164,12 +162,12 @@
uint32_t m_threshold;
// prefix and sequence number
- std::map <ndn::Name, uint64_t> m_prefixes;
+ std::map<ndn::Name, uint64_t> m_prefixes;
// Just for looking up hash faster (instead of calculating it again)
// Only used in updateSeqNo, prefix/seqNo is the key
- std::map <ndn::Name, uint32_t> m_prefix2hash;
+ std::map<ndn::Name, uint32_t> m_prefix2hash;
// Value is prefix (and not prefix/seqNo)
- std::map <uint32_t, ndn::Name> m_hash2prefix;
+ std::map<uint32_t, ndn::Name> m_hash2prefix;
ndn::Face& m_face;
ndn::KeyChain m_keyChain;
diff --git a/PSync/segment-publisher.hpp b/PSync/segment-publisher.hpp
index 35354cf..e96e07c 100644
--- a/PSync/segment-publisher.hpp
+++ b/PSync/segment-publisher.hpp
@@ -20,7 +20,7 @@
#ifndef PSYNC_SEGMENT_PUBLISHER_HPP
#define PSYNC_SEGMENT_PUBLISHER_HPP
-#include "PSync/detail/test-access-control.hpp"
+#include "PSync/detail/access-specifiers.hpp"
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/name.hpp>
@@ -71,7 +71,7 @@
ndn::Scheduler m_scheduler;
ndn::KeyChain& m_keyChain;
-PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
ndn::InMemoryStorageFifo m_ims;
};
diff --git a/docs/doxygen.conf.in b/docs/doxygen.conf.in
index 95b2bbe..1c819d0 100644
--- a/docs/doxygen.conf.in
+++ b/docs/doxygen.conf.in
@@ -2050,12 +2050,11 @@
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = DOXYGEN \
- PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE=private \
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(x)= \
- NDN_LOG_INIT(x)= \
- PUBLIC_WITH_TESTS_ELSE_PROTECTED=protected \
- PUBLIC_WITH_TESTS_ELSE_PRIVATE=private \
- PROTECTED_WITH_TESTS_ELSE_PRIVATE=private
+ PSYNC_PUBLIC_WITH_TESTS_ELSE_PROTECTED=protected \
+ PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE=private \
+ PSYNC_PROTECTED_WITH_TESTS_ELSE_PRIVATE=private \
+ PSYNC_VIRTUAL_WITH_TESTS
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
diff --git a/tests/wscript b/tests/wscript
index 65c5eeb..8b3ecbe 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -1,9 +1,6 @@
top = '..'
def build(bld):
- if not bld.env['WITH_TESTS']:
- return
-
bld.program(target='../unit-tests',
name='unit-tests',
source=bld.path.ant_glob('**/*.cpp'),
diff --git a/wscript b/wscript
index 9412e7d..11ae785 100644
--- a/wscript
+++ b/wscript
@@ -1,6 +1,6 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-from waflib import Logs, Utils, Context
+from waflib import Context, Logs, Utils
import os, subprocess
VERSION = '0.1.0'
@@ -13,79 +13,77 @@
'boost', 'doxygen', 'sphinx_build'],
tooldir=['.waf-tools'])
- opt.add_option('--with-examples', action='store_true', default=False,
- help='Build examples')
-
- opt.add_option('--with-tests', action='store_true', default=False,
- help='Build unit tests')
+ optgrp = opt.add_option_group('PSync Options')
+ optgrp.add_option('--with-examples', action='store_true', default=False,
+ help='Build examples')
+ optgrp.add_option('--with-tests', action='store_true', default=False,
+ help='Build unit tests')
def configure(conf):
conf.load(['compiler_c', 'compiler_cxx', 'gnu_dirs',
'default-compiler-flags', 'boost',
'doxygen', 'sphinx_build'])
+ conf.env.WITH_EXAMPLES = conf.options.with_examples
+ conf.env.WITH_TESTS = conf.options.with_tests
+
if 'PKG_CONFIG_PATH' not in os.environ:
os.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env)
+ conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], uselib_store='NDN_CXX')
- conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
- uselib_store='NDN_CXX', mandatory=True)
-
- conf.env['WITH_TESTS'] = conf.options.with_tests
- conf.env['WITH_EXAMPLES'] = conf.options.with_examples
-
- boost_libs = 'system thread log log_setup iostreams'
- if conf.env['WITH_TESTS']:
- conf.define('WITH_TESTS', 1);
- boost_libs += ' unit_test_framework'
+ boost_libs = ['system', 'iostreams']
+ if conf.env.WITH_TESTS:
+ boost_libs.append('unit_test_framework')
conf.check_boost(lib=boost_libs, mt=True)
conf.check_compiler_flags()
+ # Loading "late" to prevent tests from being compiled with profiling flags
conf.load('coverage')
-
conf.load('sanitizers')
# If there happens to be a static library, waf will put the corresponding -L flags
# before dynamic library flags. This can result in compilation failure when the
# system has a different version of the PSync library installed.
- conf.env['STLIBPATH'] = ['.'] + conf.env['STLIBPATH']
+ conf.env.prepend_value('STLIBPATH', ['.'])
- conf.write_config_header('PSync/detail/config.hpp')
+ conf.define_cond('WITH_TESTS', conf.env.WITH_TESTS)
+ # The config header will contain all defines that were added using conf.define()
+ # or conf.define_cond(). Everything that was added directly to conf.env.DEFINES
+ # will not appear in the config header, but will instead be passed directly to the
+ # compiler on the command line.
+ conf.write_config_header('PSync/detail/config.hpp', define_prefix='PSYNC_')
def build(bld):
bld.shlib(
target='PSync',
vnum=VERSION,
cnum=VERSION,
- source = bld.path.ant_glob('PSync/**/*.cpp'),
- use = 'BOOST NDN_CXX',
- includes = '.',
- export_includes='.',
- )
+ source=bld.path.ant_glob('PSync/**/*.cpp'),
+ use='BOOST NDN_CXX',
+ includes='.',
+ export_includes='.')
+
+ if bld.env.WITH_TESTS:
+ bld.recurse('tests')
+
+ if bld.env.WITH_EXAMPLES:
+ bld.recurse('examples')
headers = bld.path.ant_glob('PSync/**/*.hpp')
-
bld.install_files(bld.env['INCLUDEDIR'], headers, relative_trick=True)
bld.install_files('${INCLUDEDIR}/PSync/detail',
bld.path.find_resource('PSync/detail/config.hpp'))
- pc = bld(
- features = "subst",
+ bld(features='subst',
source='PSync.pc.in',
target='PSync.pc',
install_path = '${LIBDIR}/pkgconfig',
PREFIX = bld.env['PREFIX'],
INCLUDEDIR = bld.env['INCLUDEDIR'],
- VERSION = VERSION,
- )
-
- if bld.env['WITH_TESTS']:
- bld.recurse('tests')
-
- if bld.env['WITH_EXAMPLES']:
- bld.recurse('examples')
+ VERSION = VERSION)
def docs(bld):
from waflib import Options