build: more accurate dependencies on Boost libraries
See also named-data/ndn-cxx@5686c51b87b6a642aa2dc8d93e061caebbb226cc
Change-Id: I44f01b8dad76bf835d05f920a7943eeae3eb8c6f
diff --git a/examples/wscript b/examples/wscript
index 8f9faed..ad0cef9 100644
--- a/examples/wscript
+++ b/examples/wscript
@@ -3,11 +3,11 @@
top = '..'
def build(bld):
+ # List all .cpp files (whole example in one .cpp)
for ex in bld.path.ant_glob('*.cpp'):
name = ex.change_ext('').path_from(bld.path.get_bld())
- bld.program(name='example-%s' % name,
+ bld.program(name=f'example-{name}',
target=name,
source=[ex],
use='NDN_CXX',
- includes='../src',
install_path=None)
diff --git a/tests/wscript b/tests/wscript
index 399409e..1ca51c0 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -5,16 +5,16 @@
def build(bld):
bld.objects(target='tests-base',
source=bld.path.ant_glob('*.cpp'),
- use='repo-objects')
+ use='BOOST_TESTS repo-objects')
bld.program(name='unit-tests',
- target='../unit-tests',
+ target=f'{top}/unit-tests',
source=bld.path.ant_glob('unit/**/*.cpp'),
use='tests-base',
install_path=None)
bld.program(name='integrated-tests',
- target='../integrated-tests',
+ target=f'{top}/integrated-tests',
source=bld.path.ant_glob('integrated/**/*.cpp'),
use='tests-base',
install_path=None)
diff --git a/tools/ndnputfile.cpp b/tools/ndnputfile.cpp
index bed681a..04e85ee 100644
--- a/tools/ndnputfile.cpp
+++ b/tools/ndnputfile.cpp
@@ -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.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -17,8 +17,8 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../src/repo-command-parameter.hpp"
-#include "../src/repo-command-response.hpp"
+#include "repo-command-parameter.hpp"
+#include "repo-command-response.hpp"
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/security/interest-signer.hpp>
diff --git a/tools/repo-ng-ls.cpp b/tools/repo-ng-ls.cpp
index e1a8281..1ce8f2e 100644
--- a/tools/repo-ng-ls.cpp
+++ b/tools/repo-ng-ls.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2023, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -17,7 +17,7 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../src/common.hpp"
+#include "common.hpp"
#include <iostream>
#include <string>
diff --git a/tools/wscript b/tools/wscript
index 8fe7229..a4f1dbe 100644
--- a/tools/wscript
+++ b/tools/wscript
@@ -6,6 +6,6 @@
for tool in bld.path.ant_glob('*.cpp'):
name = tool.change_ext('').path_from(bld.path.get_bld())
bld.program(name=name,
- target='../bin/%s' % name,
+ target=f'{top}/bin/{name}',
source=[tool],
- use='repo-objects')
+ use='BOOST_TOOLS repo-objects')
diff --git a/wscript b/wscript
index 524e9de..8a4d2d4 100644
--- a/wscript
+++ b/wscript
@@ -1,7 +1,7 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-from waflib import Utils
import os
+from waflib import Utils
VERSION = '0.1'
APPNAME = 'ndn-repo-ng'
@@ -39,11 +39,13 @@
conf.check_sqlite3()
- boost_libs = ['system', 'program_options', 'filesystem', 'iostreams']
- if conf.env.WITH_TESTS:
- boost_libs.append('unit_test_framework')
+ conf.check_boost(lib='filesystem program_options', mt=True)
- conf.check_boost(lib=boost_libs, mt=True)
+ if conf.env.WITH_TESTS:
+ conf.check_boost(lib='unit_test_framework', mt=True, uselib_store='BOOST_TESTS')
+
+ if conf.env.WITH_TOOLS:
+ conf.check_boost(lib='iostreams', mt=True, uselib_store='BOOST_TOOLS')
conf.check_compiler_flags()
@@ -53,35 +55,37 @@
conf.define_cond('HAVE_TESTS', conf.env.WITH_TESTS)
conf.define_cond('DISABLE_SQLITE3_FS_LOCKING', not conf.options.with_sqlite_locking)
- conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/repo-ng.conf' % conf.env.SYSCONFDIR)
+ conf.define('DEFAULT_CONFIG_FILE', f'{conf.env.SYSCONFDIR}/ndn/repo-ng.conf')
conf.write_config_header('src/config.hpp')
def build(bld):
- bld.objects(target='repo-objects',
- source=bld.path.ant_glob('src/**/*.cpp',
- excl=['src/main.cpp']),
- use='NDN_CXX BOOST SQLITE3',
- includes='src',
- export_includes='src')
+ bld.objects(
+ target='repo-objects',
+ source=bld.path.ant_glob('src/**/*.cpp', excl=['src/main.cpp']),
+ use='BOOST NDN_CXX SQLITE3',
+ includes='src',
+ export_includes='src')
- bld.program(name='ndn-repo-ng',
- target='bin/ndn-repo-ng',
- source='src/main.cpp',
- use='repo-objects')
-
- if bld.env.WITH_TOOLS:
- bld.recurse('tools')
+ bld.program(
+ name='ndn-repo-ng',
+ target='bin/ndn-repo-ng',
+ source='src/main.cpp',
+ use='repo-objects')
if bld.env.WITH_TESTS:
bld.recurse('tests')
+ if bld.env.WITH_TOOLS:
+ bld.recurse('tools')
+
if bld.env.WITH_EXAMPLES:
bld.recurse('examples')
+ # Install sample config
bld.install_files('${SYSCONFDIR}/ndn', 'repo-ng.conf.sample')
if Utils.unversioned_sys_platform() == 'linux':
bld(features='subst',
- name='repo-ng.service',
+ name='systemd-units',
source='systemd/repo-ng.service.in',
target='systemd/repo-ng.service')