build: Always build in C++11 mode.

This commit also embeds CI build scripts and includes waf script update

Change-Id: Ib89dd8040b5e438866315425293b02694b8d85fe
Refs: #1930
This commit is contained in:
Alexander Afanasyev
2014-10-30 15:37:45 -07:00
parent 976c3972c7
commit 740812e0d8
9 changed files with 140 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
.DS*
.waf3-1*
.waf-1*
.lock*
**/*.pyc
build/
Executable
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
for i in `find "$DIR/.jenkins.d" -type f -perm +111 | sort`; do
echo "Run: $i"
$i
done
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -x
set -e
cd /tmp
BUILD="no"
if [ ! -d ndn-cxx ]; then
git clone --depth 1 git://github.com/named-data/ndn-cxx
cd ndn-cxx
BUILD="yes"
else
cd ndn-cxx
INSTALLED_VERSION=`git rev-parse HEAD || echo NONE`
sudo rm -Rf latest-version
git clone --depth 1 git://github.com/named-data/ndn-cxx latest-version
cd latest-version
LATEST_VERSION=`git rev-parse HEAD || echo UNKNOWN`
cd ..
rm -Rf latest-version
if [ "$INSTALLED_VERSION" != "$LATEST_VERSION" ]; then
cd ..
sudo rm -Rf ndn-cxx
git clone --depth 1 git://github.com/named-data/ndn-cxx
cd ndn-cxx
BUILD="yes"
fi
fi
sudo rm -Rf /usr/local/include/ndn-cxx
sudo rm -f /usr/local/lib/libndn-cxx*
sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx*
if [ "$BUILD" = "yes" ]; then
sudo ./waf distclean -j1 --color=yes
fi
./waf configure -j1 --color=yes --without-osx-keychain
./waf -j1 --color=yes
sudo ./waf install -j1 --color=yes
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -x
set -e
sudo ./waf distclean -j1 --color=yes
./waf configure -j1 --color=yes
./waf -j1 --color=yes
sudo ./waf install -j1 --color=yes
+70
View File
@@ -0,0 +1,70 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
from waflib import Logs, Configure
def options(opt):
opt.add_option('--debug', '--with-debug', action='store_true', default=False, dest='debug',
help='''Compile in debugging mode without optimizations (-O0 or -Og)''')
def configure(conf):
areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
defaultFlags = ['-std=c++0x', '-std=c++11',
'-stdlib=libc++', # clang on OSX < 10.9 by default uses gcc's
# libstdc++, which is not C++11 compatible
'-pedantic', '-Wall']
if conf.options.debug:
conf.define('_DEBUG', 1)
defaultFlags += ['-O0',
'-Og', # gcc >= 4.8
'-g3',
'-fcolor-diagnostics', # clang
'-fdiagnostics-color', # gcc >= 4.9
'-Werror',
'-Wno-error=maybe-uninitialized',
]
if areCustomCxxflagsPresent:
missingFlags = [x for x in defaultFlags if x not in conf.env.CXXFLAGS]
if len(missingFlags) > 0:
Logs.warn("Selected debug mode, but CXXFLAGS is set to a custom value '%s'"
% " ".join(conf.env.CXXFLAGS))
Logs.warn("Default flags '%s' are not activated" % " ".join(missingFlags))
else:
conf.add_supported_cxxflags(defaultFlags)
else:
defaultFlags += ['-O2', '-g']
if not areCustomCxxflagsPresent:
conf.add_supported_cxxflags(defaultFlags)
# clang on OSX < 10.9 by default uses gcc's libstdc++, which is not C++11 compatible
conf.add_supported_linkflags(['-stdlib=libc++'])
@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 supported CXXFLAGS')
supportedFlags = []
for flag in cxxflags:
if self.check_cxx(cxxflags=['-Werror', flag], mandatory=False):
supportedFlags += [flag]
self.end_msg(' '.join(supportedFlags))
self.env.CXXFLAGS = supportedFlags + self.env.CXXFLAGS
@Configure.conf
def add_supported_linkflags(self, linkflags):
"""
Check which linkflags are supported by compiler and add them to env.LINKFLAGS variable
"""
self.start_msg('Checking supported LINKFLAGS')
supportedFlags = []
for flag in linkflags:
if self.check_cxx(linkflags=['-Werror', flag], mandatory=False):
supportedFlags += [flag]
self.end_msg(' '.join(supportedFlags))
self.env.LINKFLAGS = supportedFlags + self.env.LINKFLAGS
+2 -2
View File
@@ -36,9 +36,9 @@ public:
, m_logger("NdnTrafficClient")
, m_hasError(false)
, m_hasQuietLogging(false)
, m_face(m_ioService)
, m_interestInterval(getDefaultInterestInterval())
, m_nMaximumInterests(-1)
, m_face(m_ioService)
, m_nInterestsSent(0)
, m_nInterestsReceived(0)
, m_nContentInconsistencies(0)
@@ -777,12 +777,12 @@ public:
private:
std::string m_programName;
Logger m_logger;
std::string m_instanceId;
bool m_hasError;
bool m_hasQuietLogging;
time::milliseconds m_interestInterval;
int m_nMaximumInterests;
Logger m_logger;
std::string m_configurationFile;
boost::asio::io_service m_ioService;
Face m_face;
+7 -6
View File
@@ -414,7 +414,7 @@ public:
run()
{
boost::asio::signal_set signalSet(m_ioService, SIGINT, SIGTERM);
signalSet.async_wait(boost::bind(&NdnTrafficServer::signalHandler, this));
signalSet.async_wait(bind(&NdnTrafficServer::signalHandler, this));
m_logger.initializeLog(m_instanceId);
initializeTrafficConfiguration();
if (m_nMaximumInterests == 0)
@@ -448,19 +448,20 @@ public:
private:
KeyChain m_keyChain;
Logger m_logger;
std::string m_programName;
bool m_hasError;
bool m_hasQuietLogging;
std::string m_instanceId;
time::milliseconds m_contentDelay;
int m_nRegistrationsFailed;
Logger m_logger;
int m_nMaximumInterests;
int m_nInterestsReceived;
time::milliseconds m_contentDelay;
std::string m_instanceId;
std::string m_configurationFile;
boost::asio::io_service m_ioService;
Face m_face;
std::vector<DataTrafficConfiguration> m_trafficPatterns;
int m_nMaximumInterests;
int m_nInterestsReceived;
};
} // namespace ndn
Vendored
BIN
View File
Binary file not shown.
+4 -2
View File
@@ -3,10 +3,12 @@ VERSION='0.1'
APPNAME="ndn-traffic-generator"
def options(opt):
opt.load('compiler_cxx gnu_dirs')
opt.load(['compiler_cxx', 'gnu_dirs'])
opt.load(['default-compiler-flags'], tooldir=['.waf-tools'])
def configure(conf):
conf.load("compiler_cxx gnu_dirs")
conf.load(['compiler_cxx', 'gnu_dirs',
'default-compiler-flags'])
conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
uselib_store='NDN_CXX', mandatory=True)