Skip to content

Commit

Permalink
build: require boost >= 1.71.0
Browse files Browse the repository at this point in the history
Refs: #5276
Change-Id: Ib62b24b041e21b2c017cd9c290f7d5dc09003d63
  • Loading branch information
Pesa committed Sep 16, 2023
1 parent b6e10dd commit 2ab04a2
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ main(int argc, char* argv[])
### Command Line Arguments
[Boost.Program\_options](https://www.boost.org/doc/libs/1_65_1/doc/html/program_options.html)
[Boost.Program\_options](https://www.boost.org/doc/libs/1_71_0/doc/html/program_options.html)
is strongly preferred over `getopt(3)` for parsing command line arguments.
10 changes: 7 additions & 3 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ except the object that contains the `main()` function.

For example:

bld(features='cxx',
name='tool-subtool-objects',
```python
def build(bld):
bld.objects(
target='tool-subtool-objects',
source=bld.path.ant_glob('subtool/*.cpp', excl='subtool/main.cpp'),
use='core-objects')

bld(features='cxx cxxprogram',
bld.program(
name='subtool',
target='../../bin/subtool',
source='subtool/main.cpp',
use='tool-subtool-objects')

bld(name='tool-objects',
use='tool-subtool-objects')
```
10 changes: 3 additions & 7 deletions tests/io-fixture.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2022, Regents of the University of California,
* Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
Expand Down Expand Up @@ -28,7 +28,7 @@

#include "tests/clock-fixture.hpp"

#include <boost/asio/io_service.hpp>
#include <boost/asio/io_context.hpp>

namespace ndn::tests {

Expand All @@ -39,17 +39,13 @@ class IoFixture : public ClockFixture
afterTick() final
{
if (m_io.stopped()) {
#if BOOST_VERSION >= 106600
m_io.restart();
#else
m_io.reset();
#endif
}
m_io.poll();
}

protected:
boost::asio::io_service m_io;
boost::asio::io_context m_io;
};

} // namespace ndn::tests
Expand Down
3 changes: 1 addition & 2 deletions tests/peek/ndnpeek.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include <ndn-cxx/util/dummy-client-face.hpp>

#include <boost/mpl/vector.hpp>
#include <boost/test/tools/output_test_stream.hpp>

namespace ndn::peek::tests {
Expand Down Expand Up @@ -129,7 +128,7 @@ class OutputPayloadOnly
BOOST_AUTO_TEST_SUITE(Peek)
BOOST_FIXTURE_TEST_SUITE(TestNdnPeek, NdnPeekFixture)

using OutputChecks = boost::mpl::vector<OutputFull, OutputPayloadOnly>;
using OutputChecks = std::tuple<OutputFull, OutputPayloadOnly>;

BOOST_AUTO_TEST_CASE_TEMPLATE(Default, OutputCheck, OutputChecks)
{
Expand Down
3 changes: 2 additions & 1 deletion tests/ping/integrated.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "tests/key-chain-fixture.hpp"

#include <ndn-cxx/util/dummy-client-face.hpp>
#include <boost/asio/post.hpp>

namespace ndn::ping::tests {

Expand Down Expand Up @@ -53,7 +54,7 @@ class PingIntegratedFixture : public IoFixture, public KeyChainFixture
void
receive(DummyClientFace& face, const Packet& pkt)
{
m_io.post([=, &face] {
boost::asio::post(m_io, [=, &face] {
if (!wantLoss) {
face.receive(pkt);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test-case.t.cpp.sample
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(Test1)
int i = 0;

// For reference of available Boost.Test macros, see
// https://www.boost.org/doc/libs/1_65_1/libs/test/doc/html/boost_test/testing_tools/summary.html
// https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/testing_tools/summary.html

BOOST_REQUIRE_NO_THROW(i = 1);
BOOST_CHECK_EQUAL(i, 1);
Expand Down
2 changes: 1 addition & 1 deletion tests/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ def build(bld):
target=f'{top}/unit-tests',
name='unit-tests',
source=bld.path.ant_glob(['*.cpp'] + [f'{tool}/**/*.cpp' for tool in bld.env.BUILD_TOOLS]),
use=['core-objects'] + [f'{tool}-objects' for tool in bld.env.BUILD_TOOLS],
use=['BOOST_TESTS', 'core-objects'] + [f'{tool}-objects' for tool in bld.env.BUILD_TOOLS],
install_path=None)
10 changes: 6 additions & 4 deletions tools/chunks/catchunks/pipeline-interests.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2016-2022, Regents of the University of California,
* Copyright (c) 2016-2023, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
Expand Down Expand Up @@ -31,7 +31,8 @@
#include "pipeline-interests.hpp"
#include "data-fetcher.hpp"

#include <boost/asio/io_service.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/post.hpp>

namespace ndn::chunks {

Expand Down Expand Up @@ -101,8 +102,9 @@ PipelineInterests::onFailure(const std::string& reason)

cancel();

if (m_onFailure)
m_face.getIoService().post([this, reason] { m_onFailure(reason); });
if (m_onFailure) {
boost::asio::post(m_face.getIoService(), [this, reason] { m_onFailure(reason); });
}
}

void
Expand Down
20 changes: 10 additions & 10 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ def configure(conf):
conf.check_cfg(package='libndn-cxx', args=['libndn-cxx >= 0.8.1', '--cflags', '--libs'],
uselib_store='NDN_CXX', pkg_config_path=pkg_config_path)

boost_libs = ['system', 'program_options']
if conf.env.WITH_TESTS:
boost_libs.append('unit_test_framework')
conf.define('WITH_TESTS', 1)

conf.check_boost(lib=boost_libs, mt=True)
if conf.env.BOOST_VERSION_NUMBER < 106501:
conf.fatal('The minimum supported version of Boost is 1.65.1.\n'
conf.check_boost(lib='program_options', mt=True)
if conf.env.BOOST_VERSION_NUMBER < 107100:
conf.fatal('The minimum supported version of Boost is 1.71.0.\n'
'Please upgrade your distribution or manually install a newer version of Boost.\n'
'For more information, see https://redmine.named-data.net/projects/nfd/wiki/Boost')

if conf.env.WITH_TESTS:
conf.check_boost(lib='unit_test_framework', mt=True, uselib_store='BOOST_TESTS')

conf.recurse('tools')

conf.check_compiler_flags()
Expand All @@ -56,6 +54,8 @@ def configure(conf):
conf.load('coverage')
conf.load('sanitizers')

conf.define_cond('WITH_TESTS', conf.env.WITH_TESTS)

conf.msg('Tools to build', ', '.join(conf.env.BUILD_TOOLS))

def build(bld):
Expand All @@ -69,8 +69,8 @@ def build(bld):

bld.objects(
target='core-objects',
source=bld.path.find_node('core').ant_glob('*.cpp') + ['core/version.cpp'],
use='NDN_CXX BOOST',
source=bld.path.find_dir('core').ant_glob('*.cpp') + ['core/version.cpp'],
use='BOOST NDN_CXX',
includes='.',
export_includes='.')

Expand Down

0 comments on commit 2ab04a2

Please sign in to comment.