build: Reviving support for precompiled headers
This commit also includes an update of ./waf, which has several
improvements. In particular, clang++ is now default compiler on OSX
platform.
This commit also includes reorganization of tests. All unit tests are
now under tests/unit-tests and integrated tests are under
tests/integrated. This change allows small compilation optimization,
partially related to precompiled headers.
Change-Id: I4c171c04d18e9cb83e461264a35b9ed85ea4d50e
diff --git a/tests/wscript b/tests/wscript
index cbe5e88..5a602d3 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -5,21 +5,58 @@
top = '..'
def build(bld):
- unittests = bld.program (
- target="../unit-tests",
- features="cxx cxxprogram",
- source=bld.path.ant_glob(['**/*.cpp'],
- excl=['**/*-osx.cpp', '**/*-sqlite3.cpp']),
+ bld(features=['cxx', 'pch'],
+ name='tests-base',
+ target='tests-base',
+ headers=['../src/common-pch.hpp', 'boost-test.hpp'],
use='ndn-cxx',
includes='.',
+ )
+
+ unit_tests = bld(
+ target="unit-test-objects",
+ name="unit-test-objects",
+ features="cxx",
+ source=bld.path.ant_glob(['unit-tests/**/*.cpp'],
+ excl=['**/*-osx.cpp', '**/*-sqlite3.cpp']),
+ use='tests-base',
+ includes='.',
+ install_path=None,
+ )
+
+ integrated = bld(
+ target="integrated-test-objects",
+ name="integrated-test-objects",
+ features="cxx",
+ source=bld.path.ant_glob(['integrated/**/*.cpp'],
+ excl=['**/*-osx.cpp', '**/*-sqlite3.cpp']),
+ use='tests-base',
+ includes='.',
install_path=None,
)
if bld.env['HAVE_OSX_SECURITY']:
- unittests.source += bld.path.ant_glob('**/*-osx.cpp')
+ unit_tests.source += bld.path.ant_glob('unit-tests/**/*-osx.cpp')
+ integrated.source += bld.path.ant_glob('integrated/**/*-osx.cpp')
# In case we want to make it optional later
- unittests.source += bld.path.ant_glob('**/*-sqlite3.cpp')
+ unit_tests.source += bld.path.ant_glob('unit-tests/**/*-sqlite3.cpp')
+ integrated.source += bld.path.ant_glob('integrated/**/*-sqlite3.cpp')
- if bld.env['WITH_PCH']:
- unittests.pch = "test-all.hpp"
+ unit_test_main = bld(
+ target='unit-tests-main',
+ name='unit-tests-main',
+ features='cxx',
+ source=bld.path.ant_glob(['*.cpp']),
+ use='ndn-cxx',
+ )
+
+ bld(features="cxx cxxprogram",
+ target="../unit-tests",
+ use="unit-test-objects unit-tests-main",
+ install_path=None)
+
+ bld(features="cxx cxxprogram",
+ target="../integrated-tests",
+ use="integrated-test-objects unit-tests-main",
+ install_path=None)