| # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| # tools/example-tool.cpp is a self-contained tool with a main() function |
| # and is built as build/bin/example-tool. |
| # These tools cannot be unit-tested. |
| for tool in bld.path.ant_glob('*.cpp'): |
| name = tool.change_ext('').path_from(bld.path.get_bld()) |
| target='../bin/%s' % name, |
| # tools/example-tool/**/*.cpp is compiled and linked into build/bin/example-tool. |
| # tools/example-tool/main.cpp must exist and must contain the main() function. |
| # All other objects are collected into 'tools-objects' and can be unit-tested. |
| for subdir in bld.path.ant_glob('*', dir=True, src=False): |
| mainFile = subdir.find_node('main.cpp') |
| continue # not a C++ tool |
| name = subdir.path_from(bld.path) |
| srcFiles = subdir.ant_glob('**/*.cpp', excl=['main.cpp']) |
| srcObjects = 'tool-%s-objects' % name |
| bld.objects(target=srcObjects, |
| testableObjects.append(srcObjects) |
| target='../bin/%s' % name, |
| use='ndns-objects ' + srcObjects) |
| bld.objects(target='tools-objects', |