From eadf2fa562b8017b505151a171a8f8ca7796cab6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sun, 17 Apr 2011 12:42:55 +0200
Subject: Added option to build library with tests.


diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 246092d..0ee1d0e 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -212,6 +212,7 @@ env["TEST"] = (env["TEST_TYPE"] != "none") or env.GetOption("clean")
 if env.get("valgrind", 0) :
 	env["TEST_RUNNER"] = "valgrind --suppressions=QA/valgrind.supp -q --leak-check=full --track-origins=yes "
 env["TEST_IGNORE_RESULT"] = "ignore_test_result" in ARGUMENTS
+env["TEST_CREATE_LIBRARIES"] = "create_test_libraries" in ARGUMENTS
 
 # Packaging
 env["DIST"] = "dist" in ARGUMENTS or env.GetOption("clean")
diff --git a/QA/UnitTest/SConscript b/QA/UnitTest/SConscript
index 25e9b05..3876919 100644
--- a/QA/UnitTest/SConscript
+++ b/QA/UnitTest/SConscript
@@ -26,8 +26,11 @@ if env["TEST"] :
 			myenv.Append(CPPDEFINES = ["HAVE_LIBXML"])
 		if env.get("HAVE_EXPAT") :
 			myenv.Append(CPPDEFINES = ["HAVE_EXPAT"])
-		checker = myenv.Program("checker", env["UNITTEST_SOURCES"] + env["UNITTEST_OBJECTS"])
-		for i in ["HOME", "USERPROFILE", "APPDATA"]:
-			if os.environ.get(i, "") :
-				myenv["ENV"][i] = os.environ[i]
-		myenv.Test(checker, is_checker = True)
+		if env["TEST_CREATE_LIBRARIES"] :
+			myenv.StaticLibrary("Swift_UnitTests", env["UNITTEST_SOURCES"] + env["UNITTEST_OBJECTS"])
+		else :
+			checker = myenv.Program("checker", env["UNITTEST_SOURCES"] + env["UNITTEST_OBJECTS"])
+			for i in ["HOME", "USERPROFILE", "APPDATA"]:
+				if os.environ.get(i, "") :
+					myenv["ENV"][i] = os.environ[i]
+			myenv.Test(checker, is_checker = True)
-- 
cgit v0.10.2-6-g49f6