0.2.0-dev Download ZIP
25 lines ·764 B Raw
| 1 | #!/usr/bin/env python |
| 2 | from misc.utility.scons_hints import * |
| 3 | |
| 4 | import glob |
| 5 | |
| 6 | import test_builders |
| 7 | |
| 8 | Import("env") |
| 9 | |
| 10 | # Sources with tests must be explicitly linked first. |
| 11 | force_link_sources = glob.glob("*/**/*.cpp", recursive=True) |
| 12 | force_link_header = env.CommandNoCache( |
| 13 | "force_link.gen.h", env.Value(force_link_sources), env.Run(test_builders.force_link_builder) |
| 14 | ) |
| 15 | env.Depends(force_link_header, "test_builders.py") |
| 16 | |
| 17 | tests_obj = [] |
| 18 | if env["scu_build"]: |
| 19 | # HACK: SCU setup doesn't support recursive/dynamic setup, so we must manually pass the files. |
| 20 | env.add_source_files(tests_obj, glob.glob(".scu/*.cpp")) |
| 21 | else: |
| 22 | env.add_source_files(tests_obj, glob.glob("*.cpp") + force_link_sources) |
| 23 | |
| 24 | lib = env.add_library("tests", tests_obj) |
| 25 | env.Prepend(LIBS=[lib]) |