summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-27 19:06:47 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-27 19:06:47 (GMT)
commitaa09a889108c4d0e3c5888ad98958d8f3e12bd3b (patch)
tree3c621ae0a6e2150281be182b37e2837b804adcba /SConstruct
parentc89ef0ffae597ac8c1063732e1d9a2d84703a80c (diff)
downloadswift-aa09a889108c4d0e3c5888ad98958d8f3e12bd3b.zip
swift-aa09a889108c4d0e3c5888ad98958d8f3e12bd3b.tar.bz2
Added MD5 hashing algorithm.
Moved 'hexifying' of hashes into its own class, such that it can be shared between all hashes.
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct4
1 files changed, 4 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index ada5ef2..e4ef041 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,50 +1,51 @@
import sys, os
sys.path.append(Dir("BuildTools/SCons").abspath)
+import SCons.SConf
################################################################################
# Build variables
################################################################################
vars = Variables("config.py")
vars.Add('ccflags', "Extra C(++) compiler flags")
vars.Add('linkflags', "Extra linker flags")
vars.Add(EnumVariable("test", "Compile and run tests", "none", ["none", "all", "unit", "system"]))
vars.Add(BoolVariable("optimize", "Compile with optimizations turned on", "no"))
vars.Add(BoolVariable("debug", "Compile with debug information", "yes" if os.name != "nt" else "no"))
vars.Add(BoolVariable("warnings", "Compile with warnings turned on",
"yes" if os.name != "nt" else "no"))
if os.name != "nt" :
vars.Add(BoolVariable("coverage", "Compile with coverage information", "no"))
if os.name == "posix" :
vars.Add(BoolVariable("valgrind", "Run tests with valgrind", "no"))
if os.name == "mac" :
vars.Add(BoolVariable("universal", "Create universal binaries", "no"))
if os.name == "nt" :
vars.Add(PathVariable("vcredist", "MSVC redistributable dir", "", PathVariable.PathAccept))
if os.name == "nt" :
vars.Add(PackageVariable("bonjour", "Bonjour SDK location", "yes"))
vars.Add(PackageVariable("openssl", "OpenSSL location", "yes"))
vars.Add(PathVariable("qt", "Qt location", "", PathVariable.PathAccept))
################################################################################
# Set up default build & configure environment
################################################################################
env = Environment(CPPPATH = "#", ENV = {'PATH' : os.environ['PATH']}, variables = vars)
Help(vars.GenerateHelpText(env))
env.Alias("dist", ["."])
# Default custom tools
env.Tool("Test", toolpath = ["#/BuildTools/SCons/Tools"])
env.Tool("WriteVal", toolpath = ["#/BuildTools/SCons/Tools"])
env.Tool("BuildVersion", toolpath = ["#/BuildTools/SCons/Tools"])
if env["PLATFORM"] == "darwin" :
env.Tool("Nib", toolpath = ["#/BuildTools/SCons/Tools"])
env.Tool("AppBundle", toolpath = ["#/BuildTools/SCons/Tools"])
if env["PLATFORM"] == "win32" :
env.Tool("WindowsBundle", toolpath = ["#/BuildTools/SCons/Tools"])
# Default compiler flags
env["CCFLAGS"] = env.get("ccflags", [])
@@ -114,96 +115,99 @@ conf_env = env.Clone()
Export("env")
Export("conf_env")
################################################################################
# Extend the default build environment (not affecting the configure env)
#
# Keeping both environments separated mostly because of SCons Issue 2391,
# although it doesn't hurt to separate them (e.g. not have pretty printed
# strings in config.log)
################################################################################
#if env["PLATFORM"] == "win32" :
# env["MSVC_BATCH"] = 1
# Pretty output
def colorize(command, target, color) :
colors = { "red": "31", "green": "32", "yellow": "33", "blue": "34" }
prefix = ""
suffix = ""
if sys.stdout.isatty() and env["PLATFORM"] != "win32":
prefix = "\033[0;" + colors[color] + ";140m"
suffix = "\033[0m"
return " " + prefix + command + suffix + " " + target
if int(ARGUMENTS.get("V", 0)) == 0:
env["CCCOMSTR"] = colorize("CC", "$TARGET", "green")
env["CXXCOMSTR"] = colorize("CXX", "$TARGET", "green")
env["LINKCOMSTR"] = colorize("LINK", "$TARGET", "red")
env["ARCOMSTR"] = colorize("AR", "$TARGET", "red")
env["RANLIBCOMSTR"] = colorize("RANLIB", "$TARGET", "red")
env["QT4_RCCCOMSTR"] = colorize("RCC", "$TARGET", "blue")
env["QT4_UICCOMSTR"] = colorize("UIC", "$TARGET", "blue")
env["QT4_MOCFROMHCOMSTR"] = colorize("MOC", "$TARGET", "blue")
env["QT4_MOCFROMCXXCOMSTR"] = colorize("MOC", "$TARGET", "blue")
env["GENCOMSTR"] = colorize("GEN", "$TARGET", "blue")
env["RCCOMSTR"] = colorize("RC", "$TARGET", "blue")
env["BUNDLECOMSTR"] = colorize("BUNDLE", "$TARGET", "blue")
env["NIBCOMSTR"] = colorize("NIB", "$TARGET", "blue")
env["NSISCOMSTR"] = colorize("NSIS", "$TARGET", "blue")
env["TESTCOMSTR"] = colorize("TEST", "$SOURCE", "yellow")
#Progress(colorize("DEP", "$TARGET", "red")
################################################################################
# Platform configuration
################################################################################
+if ARGUMENTS.get("force-configure", 0) :
+ SCons.SConf.SetCacheMode("force")
+
conf = Configure(conf_env)
if conf.CheckLib("z") :
env.Append(LIBS = "z")
env["ZLIB_FLAGS"] = ""
else :
SConscript("3rdParty/ZLib/SConscript")
if conf.CheckLib("dl") :
env.Append(LIBS = ["dl"])
if conf.CheckLib("c") :
env.Append(LIBS = ["c"])
if conf.CheckLib("resolv") :
env.Append(LIBS = ["resolv"])
# Expat
if conf.CheckCHeader("expat.h") and conf.CheckLib("expat") :
env["HAVE_EXPAT"] = 1
env["EXPAT_FLAGS"] = { "LIBS": ["expat"] }
conf.Finish()
# Xss
env["HAVE_XSS"] = 0
if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
xss_flags = {
"LIBPATH": ["/usr/X11R6/lib"],
"LIBS": ["X11", "Xss"]
}
xss_env = conf_env.Clone()
xss_env.MergeFlags(xss_flags)
conf = Configure(xss_env)
if conf.CheckFunc("XScreenSaverQueryExtension") :
env["HAVE_XSS"] = 1
env["XSS_FLAGS"] = xss_flags
conf.Finish()
# LibXML
conf = Configure(conf_env)
if conf.CheckCHeader("libxml/parser.h") and conf.CheckLib("xml2") :
env["HAVE_LIBXML"] = 1
env["LIBXML_FLAGS"] = { "LIBS": ["xml2"] }
conf.Finish()
if not env.get("HAVE_LIBXML", 0) :
libxml_env = conf_env.Clone()