Created
February 21, 2010 05:31
-
-
Save jamesmartin/310152 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example SConstruct File for a Igloo-test project | |
import os.path | |
from os import getcwd | |
# Construct variables for the SUT and test binaries | |
# This is based on the base directory name that SConstruct lives in | |
component_name = os.path.basename(getcwd()) | |
component_tests_name = component_name + "_tests" | |
# Construct the list of source files for the SUT | |
prod_src = Glob('src/*.cpp') + Glob('src/util/*.cpp') | |
# Construct the list of source files for the test program | |
test_src = Glob('tests/*.cpp') + Glob('tests/util/*.cpp') | |
# Define the C++ Includes path | |
# Make sure that igloo is in your project root (or linked) | |
cpp_includes_path = Split(". include include/util igloo") | |
# Create the scons build environment object, with 'CPPPATH' for compiler 'includes' | |
env = Environment( CPPPATH = cpp_includes_path ) | |
# Build the production code (SUT) as a static library | |
prod_lib = env.Library( target = component_name, source = prod_src, ) | |
# Build the executable tests as a normal binary | |
test_executable = env.Program( target = component_tests_name, source = test_src, LIBS=[prod_lib] ) | |
# Run the tests with the command 'scons check' | |
env.Alias("check", test_executable, "./$SOURCE") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment