|
Revision 160, 0.7 kB
(checked in by dirk, 2 years ago)
|
Added prototype for UnitTest? system
|
| Line | |
|---|
| 1 |
# |
|---|
| 2 |
# Trivial SCons build file for UnitTest++ |
|---|
| 3 |
# |
|---|
| 4 |
|
|---|
| 5 |
import glob, os |
|---|
| 6 |
import SCons |
|---|
| 7 |
pj = os.path.join |
|---|
| 8 |
|
|---|
| 9 |
base = pj("unittest-cpp","UnitTest++") |
|---|
| 10 |
|
|---|
| 11 |
# Collect the sources. This assumes everything in the directory is needed |
|---|
| 12 |
sources=glob.glob(pj(base, "src", "*.cpp")) |
|---|
| 13 |
if os.name == "nt": |
|---|
| 14 |
os_dir = "Win32" |
|---|
| 15 |
else: |
|---|
| 16 |
os_dir = "Posix" |
|---|
| 17 |
sources += glob.glob(pj(base, "src", os_dir, "*.cpp")) |
|---|
| 18 |
|
|---|
| 19 |
# Build the library |
|---|
| 20 |
StaticLibrary(pj(base,"UnitTest++"), sources) |
|---|
| 21 |
|
|---|
| 22 |
# Build the Tests |
|---|
| 23 |
testsources=glob.glob(pj(base, "src", "tests", "*.cpp")) |
|---|
| 24 |
Program(pj(base, "TestUnitTest++"), testsources, LIBS="UnitTest++", LIBPATH=base) |
|---|
| 25 |
|
|---|
| 26 |
# Run the Test once the program is built |
|---|
| 27 |
def runTest(target, source, env): |
|---|
| 28 |
os.system(str(target[0])) |
|---|
| 29 |
|
|---|
| 30 |
AddPostAction(pj(base, "TestUnitTest++"), runTest) |
|---|