src: Reorganizing source code in preparation to merge NRD code
Note that as of this commit, there are several changes in location of
compiled binaries in `build/` folder:
* `nfd` has been moved to `build/bin/nfd`
* `unit-tests` has been split into `unit-tests-core` and `unit-tests-daemon`
Change-Id: I2c830c117879edbaa5457d6423c13f0273285919
Refs: #1486
diff --git a/wscript b/wscript
index 938eed1..39ea4b1 100644
--- a/wscript
+++ b/wscript
@@ -99,19 +99,30 @@
conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/nfd.conf' % conf.env['SYSCONFDIR'])
- conf.write_config_header('daemon/config.hpp')
+ conf.write_config_header('config.hpp')
def build(bld):
+ core = bld(
+ target='core-objects',
+ name='core-objects',
+ features='cxx',
+ source=bld.path.ant_glob(['core/**/*.cpp']),
+ use='BOOST NDN_CPP LIBRT',
+ includes='. core',
+ export_includes='. core',
+ )
+
nfd_objects = bld(
- target='nfd-objects',
- name='nfd-objects',
+ target='daemon-objects',
+ name='daemon-objects',
features='cxx',
source=bld.path.ant_glob(['daemon/**/*.cpp'],
excl=['daemon/face/ethernet-*.cpp',
'daemon/face/unix-*.cpp',
'daemon/main.cpp']),
- use='BOOST NDN_CPP LIBRT',
- includes='. daemon',
+ use='core-objects',
+ includes='daemon',
+ export_includes='daemon',
)
if bld.env['HAVE_LIBPCAP']:
@@ -121,42 +132,20 @@
if bld.env['HAVE_UNIX_SOCKETS']:
nfd_objects.source += bld.path.ant_glob('daemon/face/unix-*.cpp')
- bld(target='nfd',
+ bld(target='bin/nfd',
features='cxx cxxprogram',
source='daemon/main.cpp',
- use='nfd-objects',
- includes='. daemon',
+ use='daemon-objects',
)
for app in bld.path.ant_glob('tools/*.cpp'):
bld(features=['cxx', 'cxxprogram'],
target='bin/%s' % (str(app.change_ext(''))),
source=['tools/%s' % (str(app))],
- includes='. daemon',
- use='nfd-objects LIBRESOLV',
+ use='core-objects LIBRESOLV',
)
- # Unit tests
- if bld.env['WITH_TESTS']:
- unit_tests = bld.program(
- target='unit-tests',
- features='cxx cxxprogram',
- source=bld.path.ant_glob(['tests/**/*.cpp'],
- excl=['tests/face/ethernet.cpp',
- 'tests/face/unix-*.cpp']),
- use='nfd-objects',
- includes='. daemon',
- install_prefix=None,
- )
-
- if bld.env['HAVE_LIBPCAP']:
- unit_tests.source += bld.path.ant_glob('tests/face/ethernet.cpp')
-
- if bld.env['HAVE_UNIX_SOCKETS']:
- unit_tests.source += bld.path.ant_glob('tests/face/unix-*.cpp')
-
- if bld.env['WITH_OTHER_TESTS']:
- bld.recurse("tests-other")
+ bld.recurse("tests")
bld(features="subst",
source='nfd.conf.sample.in',