summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-08-10 17:18:35 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-08-10 17:18:35 (GMT)
commit1eda0e0025550acde2c0c9c937a29063227201b1 (patch)
treea8401714b4ae7e12c86b6b24113bb53ff9f7baa5 /SConstruct
parent2edf74915432242ba99e7820a7633a06c755c17b (diff)
downloadswift-1eda0e0025550acde2c0c9c937a29063227201b1.zip
swift-1eda0e0025550acde2c0c9c937a29063227201b1.tar.bz2
Migrated all configure flags to SCons.
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct142
1 files changed, 108 insertions, 34 deletions
diff --git a/SConstruct b/SConstruct
index f0a5d4e..1f41d19 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,44 +1,84 @@
-import sys
+import sys, os
-# Default build environment
-env = Environment(CPPPATH = "#")
-env.Dump()
+################################################################################
+# Set up default build environment
+################################################################################
+
+env = Environment(CPPPATH = "#", ENV = {'PATH' : os.environ['PATH']})
+# Pretty output
if ARGUMENTS.get("V") != "1":
- if sys.stdout.isatty() and env["PLATFORM"] != "win32":
- env["CCCOMSTR"] = " \033[0;33;140mCC\033[0m $TARGET"
- env["CXXCOMSTR"] = " \033[0;32;140mCXX\033[0m $TARGET"
- env["LINKCOMSTR"] = " \033[0;31;140mLINK\033[0m $TARGET"
- env["ARCOMSTR"] = " \033[0;31;140mAR\033[0m $TARGET"
- env["RANLIBCOMSTR"] = " \033[0;31;140mRANLIB\033[0m $TARGET"
- env["QT4_RCCCOMSTR"] = " \033[0;34;140mRCC\033[0m $TARGET"
- env["QT4_UICCOMSTR"] = " \033[0;34;140mUIC\033[0m $TARGET"
- env["QT4_MOCFROMHCOMSTR"] = " \033[0;34;140mMOC\033[0m $TARGET"
- env["QT4_MOCFROMCXXCOMSTR"] = " \033[0;34;140mMOC\033[0m $TARGET"
- #Progress(' \033[0;35;140mDEP\033[0m $TARGET\n', overwrite = True)
+ if sys.stdout.isatty() and env["PLATFORM"] != "win32":
+ env["CCCOMSTR"] = " \033[0;33;140mCC\033[0m $TARGET"
+ env["CXXCOMSTR"] = " \033[0;32;140mCXX\033[0m $TARGET"
+ env["LINKCOMSTR"] = " \033[0;31;140mLINK\033[0m $TARGET"
+ env["ARCOMSTR"] = " \033[0;31;140mAR\033[0m $TARGET"
+ env["RANLIBCOMSTR"] = " \033[0;31;140mRANLIB\033[0m $TARGET"
+ env["QT4_RCCCOMSTR"] = " \033[0;34;140mRCC\033[0m $TARGET"
+ env["QT4_UICCOMSTR"] = " \033[0;34;140mUIC\033[0m $TARGET"
+ env["QT4_MOCFROMHCOMSTR"] = " \033[0;34;140mMOC\033[0m $TARGET"
+ env["QT4_MOCFROMCXXCOMSTR"] = " \033[0;34;140mMOC\033[0m $TARGET"
+ env["GENCOMSTR"] = " \033[0;34;140mGEN\033[0m $TARGET"
+ #Progress( " \033[0;35;140mDEP\033[0m $TARGET\n")
+ else :
+ env["CCCOMSTR"] = " CC $TARGET"
+ env["CXXCOMSTR"] = " CXX $TARGET"
+ env["LINKCOMSTR"] = " LINK $TARGET"
+ env["ARCOMSTR"] = " AR $TARGET"
+ env["RANLIBCOMSTR"] = " RANLIB $TARGET"
+ env["QT4_RCCCOMSTR"] = " RCC $TARGET"
+ env["QT4_UICCOMSTR"] = " UIC $TARGET"
+ env["QT4_MOCFROMHCOMSTR"] = " MOC $TARGET"
+ env["QT4_MOCFROMCXXCOMSTR"] = " MOC $TARGET"
+ env["GENCOMSTR"] = " GEN $TGENGET"
+ #Progress(' DEP $TARGET\n')
+
+# Default compiler flags
+if int(ARGUMENTS.get("optimize", 0)) == 1 :
+ if env["PLATFORM"] == "win32" :
+ env.Append(CCFLAGS = "/O2")
else :
- env["CCCOMSTR"] = " CC $TARGET"
- env["CXXCOMSTR"] = " CXX $TARGET"
- env["LINKCOMSTR"] = " LINK $TARGET"
- env["ARCOMSTR"] = " AR $TARGET"
- env["RANLIBCOMSTR"] = " RANLIB $TARGET"
- #Progress(' \033[0;35;140mDEP\033[0m $TARGET\n', overwrite = True)
-
-# FIXME: Should check compiler
-if env["PLATFORM"] != "win32" :
- if ARGUMENTS.get("debug", 1) :
- env.Append(CCFLAGS = "-g")
-else :
- if ARGUMENTS.get("debug", 1) :
+ env.Append(CCFLAGS = "-O2")
+
+if int(ARGUMENTS.get("debug", 1)) == 1 :
+ if env["PLATFORM"] == "win32" :
env.Append(CCFLAGS = ["/Zi", "/MDd"])
+ else :
+ env.Append(CCFLAGS = "-g")
+
+if int(ARGUMENTS.get("universal", 0)) == 1 :
+ assert(env["PLATFORM"] == "darwin")
+ env.Append(CCFLAGS = [
+ "-isysroot", "/Developer/SDKs/MacOSX10.4u.sdk",
+ "-arch", "i386",
+ "-arch", "ppc"])
+ env.Append(LINKFLAGS = [
+ "-mmacosx-version-min=10.4",
+ "-Wl", "-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk",
+ "-arch", "i386",
+ "-arch", "ppc"])
+
+if int(ARGUMENTS.get("warnings", 1)) == 1 :
+ if env["PLATFORM"] == "win32" :
+ env.Append(CCFLAGS = ["/Wall"])
+ else :
+ env.Append(CCFLAGS = ["-W", "-Wall"])
+ #env.Append(CCFLAGS = ["-W", "-Wall", "-Wredundant-decls", "-pedantic", "-Wno-long-long", "-Woverloaded-virtual", "-Wundef", "-Wfloat-equal", "-Wold-style-cast"])
+
+if int(ARGUMENTS.get("coverage", 0)) == 1 :
+ assert(env["PLATFORM"] != "win32")
+ env.Append(CCFLAGS = ["-fprofile-arcs", "-ftest-coverage"])
+ env.Append(LINKFLAGS = ["-fprofile-arcs", "-ftest-coverage"])
+
+if env["PLATFORM"] == "win32" :
env.Append(CCFLAGS = "/EHsc")
if env["PLATFORM"] == "darwin" :
env.Append(FRAMEWORKS = "AppKit")
-print "Platform: " + env["PLATFORM"]
Export("env")
+
################################################################################
# Platform configuration
################################################################################
@@ -75,22 +115,56 @@ if conf.CheckCHeader("expat.h") and conf.CheckLib("expat") :
conf.Finish()
+bundledExpat = False
if not env.get("HAVE_EXPAT", 0) :
print "Expat or LibXML not found. Using bundled Expat"
SConscript("3rdParty/Expat/SConscript")
env["HAVE_EXPAT"] = 1
+ bundledExpat = True
################################################################################
# Project files
################################################################################
+# Third-party modules
SConscript([
"3rdParty/CppUnit/SConscript",
"3rdParty/Boost/SConscript",
"3rdParty/LibIDN/SConscript",
- "3rdParty/SQLite/SConscript",
- "Swiften/SConscript",
- "Swift/SConscript",
- "QA/UnitTest/SConscript",
- ])
+ "3rdParty/SQLite/SConscript"])
+
+# Swiften
+SConscript("Swiften/SConscript")
+
+# Projects
+for dir in os.listdir(".") :
+ if dir in ["QA", "Swiften"] :
+ continue
+ sconscript = os.path.join(dir, "SConscript")
+ if os.path.isfile(sconscript) :
+ SConscript(sconscript)
+
+# QA
+SConscript("QA/SConscript")
+
+
+################################################################################
+# Print summary
+################################################################################
+
+print
+print " Build Configuration"
+print " -------------------"
+
+parsers = []
+if env.get("HAVE_LIBXML", 0):
+ parsers.append("LibXML")
+if env.get("HAVE_EXPAT", 0):
+ parsers.append("Expat")
+ if bundledExpat:
+ parsers.append("(Bundled)")
+print " XML Parsers: " + ' '.join(parsers)
+
+print " TLS Support: " + ("OpenSSL" if env["HAVE_OPENSSL"] else "Disabled")
+print