
from os import listdir
from os.path import isfile, join, abspath

common_env = Environment()
common_env.Append(CXXFLAGS = '-std=c++11 -Wall -g -O0')

srcDir = '../Main/StackTest/source'
stackSrc = [abspath(join(srcDir, f)) for f in listdir(srcDir) if isfile(join(srcDir, f)) and f[-3:] == '.cc']

# get the headers paths
header_paths = Split("""
	'../Main/Stack/headers'
	'../Main/Qunit/headers'
""")

# adds header folders 
common_env.Append(CPPPATH = header_paths)

# Menu for selecting a specific build or all builds
# if the -c or --clean option is included, the script will clean up
# built and target files
ans=True
print("""
What do you want to build/clean?\n
1. Stack unit tests (using default compiler)
2. Stack unit tests (use clang++ compiler for Clear)
""")

ans=raw_input("Select the module(s) you want to build or clean. ")

if ans=="1":
	print("\nOK, building stack unit tests.")
	common_env.Program ('bin/stackUnitTest', [stackSrc])

if ans=="2":
	print("\nOK, building stack unit tests using clang++.")
	common_env.Replace(CXX = "clang++")
	common_env.Program ('bin/stackUnitTest', [stackSrc])


