summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'BuildTools/SCons/SConscript.boot')
-rw-r--r--BuildTools/SCons/SConscript.boot90
1 files changed, 52 insertions, 38 deletions
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index 361004f..8e8aecf 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -8,12 +8,11 @@ sys.path.append(Dir("#/BuildTools/SCons").abspath)
vars = Variables(os.path.join(Dir("#").abspath, "config.py"))
vars.Add('cc', "C compiler")
vars.Add('cxx', "C++ compiler")
-vars.Add('ccflags', "Extra C(++) compiler flags")
+vars.Add('ccflags', "Extra C/C++/ObjC compiler flags")
+vars.Add('cxxflags', "Extra C++ compiler flags")
vars.Add('link', "Linker")
vars.Add('linkflags', "Extra linker flags")
vars.Add(BoolVariable("ccache", "Use CCache", "no"))
-vars.Add(BoolVariable("distcc", "Use DistCC", "no"))
-vars.Add('distcc_hosts', "DistCC hosts (overrides DISTCC_HOSTS)")
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"))
@@ -58,7 +57,7 @@ vars.Add(PathVariable("docbook_xml", "DocBook XML", None, PathVariable.PathAccep
vars.Add(PathVariable("docbook_xsl", "DocBook XSL", None, PathVariable.PathAccept))
vars.Add(BoolVariable("build_examples", "Build example programs", "yes"))
vars.Add(BoolVariable("enable_variants", "Build in a separate dir under build/, depending on compile flags", "no"))
-vars.Add(BoolVariable("experimental", "Build experimental features", "no"))
+vars.Add(BoolVariable("experimental", "Build experimental features", "yes"))
vars.Add(BoolVariable("set_iterator_debug_level", "Set _ITERATOR_DEBUG_LEVEL=0", "yes"))
################################################################################
@@ -68,6 +67,7 @@ vars.Add(BoolVariable("set_iterator_debug_level", "Set _ITERATOR_DEBUG_LEVEL=0",
env_ENV = {
'PATH' : os.environ['PATH'],
'LD_LIBRARY_PATH' : os.environ.get("LD_LIBRARY_PATH", ""),
+ 'TERM' : os.environ.get("TERM", ""),
}
if "MSVC_VERSION" in ARGUMENTS :
env = Environment(ENV = env_ENV, variables = vars, MSVC_VERSION = ARGUMENTS["MSVC_VERSION"])
@@ -104,33 +104,43 @@ if env["max_jobs"] :
except ImportError :
pass
-# Default compiler flags
-if env.get("distcc", False) :
- env["ENV"]["HOME"] = os.environ["HOME"]
- env["ENV"]["DISTCC_HOSTS"] = os.environ.get("DISTCC_HOSTS", "")
- if "distcc_hosts" in env :
- env["ENV"]["DISTCC_HOSTS"] = env["distcc_hosts"]
- env["CC"] = "distcc gcc"
- env["CXX"] = "distcc g++"
+# Set the default compiler to CLang on OS X, and set the necessary flags
+if env["PLATFORM"] == "darwin" :
+ if "cc" not in env :
+ env["CC"] = "clang"
+ if platform.machine() == "x86_64" :
+ env["CCFLAGS"] = ["-arch", "x86_64"]
+ if "cxx" not in env :
+ env["CXX"] = "clang++"
+ env["CXXFLAGS"] = ["-std=c++11"]
+ if "link" not in env :
+ env["LINK"] = "clang"
+ if platform.machine() == "x86_64" :
+ env.Append(LINKFLAGS = ["-arch", "x86_64"])
+
+# Check whether we are running inside scan-build, and override compiler if so
+if "CCC_ANALYZER_HTML" in os.environ :
+ for key, value in os.environ.items() :
+ if key.startswith("CCC_") or key.startswith("CLANG") :
+ env["ENV"][key] = value
+ env["CC"] = os.environ["CC"]
+ env["CXX"] = os.environ["CXX"]
+
+# Override the compiler with custom variables set at config time
if "cc" in env :
env["CC"] = env["cc"]
if "cxx" in env :
env["CXX"] = env["cxx"]
-ccflags = env.get("ccflags", [])
-if isinstance(ccflags, str) :
- # FIXME: Make the splitting more robust
- env["CCFLAGS"] = ccflags.split(" ")
-else :
- env["CCFLAGS"] = ccflags
if "link" in env :
env["SHLINK"] = env["link"]
env["LINK"] = env["link"]
-linkflags = env.get("linkflags", [])
-if isinstance(linkflags, str) :
- # FIXME: Make the splitting more robust
- env["LINKFLAGS"] = linkflags.split(" ")
-else :
- env["LINKFLAGS"] = linkflags
+for flags_type in ["ccflags", "cxxflags", "linkflags"] :
+ if flags_type in env :
+ if isinstance(env[flags_type], str) :
+ # FIXME: Make the splitting more robust
+ env[flags_type.upper()] = env[flags_type].split(" ")
+ else :
+ env[flags_type.upper()] = env[flags_type]
# This isn't a real flag (yet) AFAIK. Be sure to append it to the CXXFLAGS
# where you need it
env["OBJCCFLAGS"] = []
@@ -146,7 +156,7 @@ if env["target"] == "xcode" and os.environ["CONFIGURATION"] == "Release" :
if env["debug"] :
if env["PLATFORM"] == "win32" :
- env.Append(CCFLAGS = ["/Z7"])
+ env.Append(CCFLAGS = ["/Zi"])
env.Append(LINKFLAGS = ["/DEBUG"])
if env["set_iterator_debug_level"] :
env.Append(CPPDEFINES = ["_ITERATOR_DEBUG_LEVEL=0"])
@@ -213,20 +223,24 @@ if env["PLATFORM"] == "win32" :
#env.Append(CCFLAGS = ["/Wall"])
pass
else :
- env.Append(CXXFLAGS = ["-Wextra", "-Wall", "-Wnon-virtual-dtor", "-Wundef", "-Wold-style-cast", "-Wno-long-long", "-Woverloaded-virtual", "-Wfloat-equal", "-Wredundant-decls"])
+ if "clang" in env["CXX"] :
+ env.Append(CXXFLAGS = [
+ "-Weverything",
+ "-Wno-unknown-warning-option", # To stay compatible between CLang versions
+ "-Wno-weak-vtables", # Virtually none of our elements have outlined methods. This also seems to affect classes in .cpp files, which in turn affects all our tests, which may need fixing in CLang
+ "-Wno-shadow", # Also warns for shadowing on constructor arguments, which we do a lot
+ "-Wno-exit-time-destructors", # Used a lot in e.g. CPPUnit
+ "-Wno-c++98-compat-pedantic", # We do different things that violate this, but they could be fixed
+ "-Wno-global-constructors", # We depend on this for e.g. string constants
+ "-Wno-padded",
+ ])
+ else :
+ env.Append(CXXFLAGS = ["-Wextra", "-Wall", "-Wnon-virtual-dtor", "-Wundef", "-Wold-style-cast", "-Wno-long-long", "-Woverloaded-virtual", "-Wfloat-equal", "-Wredundant-decls", "-Wno-unknown-pragmas"])
+ gccVersion = env.get("CCVERSION", "0.0.0").split(".")
+ if gccVersion >= ["4", "5", "0"] and not "clang" in env["CC"] :
+ env.Append(CXXFLAGS = ["-Wlogical-op"])
if not env.get("allow_warnings", False) :
env.Append(CXXFLAGS = ["-Werror"])
- gccVersion = env.get("CCVERSION", "0.0.0").split(".")
- if gccVersion >= ["4", "5", "0"] and not "clang" in env["CC"] :
- env.Append(CXXFLAGS = ["-Wlogical-op"])
- if "clang" in env["CC"] :
- env.Append(CXXFLAGS = ["-W#warnings", "-Wc++0x-compat", "-Waddress-of-temporary", "-Wambiguous-member-template", "-Warray-bounds", "-Watomic-properties", "-Wbind-to-temporary-copy", "-Wbuiltin-macro-redefined", "-Wc++-compat", "-Wc++0x-extensions", "-Wcomments", "-Wconditional-uninitialized", "-Wconstant-logical-operand", "-Wdeclaration-after-statement", "-Wdeprecated", "-Wdeprecated-implementations", "-Wdeprecated-writable-strings", "-Wduplicate-method-arg", "-Wempty-body", "-Wendif-labels", "-Wenum-compare", "-Wformat=2", "-Wfour-char-constants", "-Wgnu", "-Wincomplete-implementation", "-Winvalid-noreturn", "-Winvalid-offsetof", "-Winvalid-token-paste", "-Wlocal-type-template-args", "-Wmethod-signatures", "-Wmicrosoft", "-Wmissing-declarations", "-Wnon-pod-varargs", "-Wnull-dereference", "-Wout-of-line-declaration", "-Woverlength-strings", "-Wpacked", "-Wpointer-arith", "-Wpointer-sign", "-Wprotocol", "-Wreadonly-setter-attrs", "-Wselector", "-Wshift-overflow", "-Wshift-sign-overflow", "-Wstrict-selector-match", "-Wsuper-class-method-mismatch", "-Wtautological-compare", "-Wtypedef-redefinition", "-Wundeclared-selector", "-Wunknown-warning-option", "-Wunnamed-type-template-args", "-Wunused-exception-parameter", "-Wunused-member-function", "-Wused-but-marked-unused", "-Wvariadic-macros", "-Wno-c++11-extensions"])
-# To enable:
-# "-Wnonfragile-abi2" -> deprecated, is now -Warc-abi i think
-# "-Wheader-hygiene"
-# "-Wnon-gcc",
-# "-Wweak-vtables",
-# "-Wlarge-by-value-copy",
if env.get("coverage", 0) :
assert(env["PLATFORM"] != "win32")
@@ -235,7 +249,7 @@ if env.get("coverage", 0) :
if env["PLATFORM"] == "win32" :
env.Append(LIBS = ["user32", "crypt32", "dnsapi", "iphlpapi", "ws2_32", "wsock32", "Advapi32"])
- env.Append(CCFLAGS = ["/EHsc", "/nologo"])
+ env.Append(CCFLAGS = ["/EHsc", "/nologo", "/Zm256"])
env.Append(LINKFLAGS = ["/INCREMENTAL:no", "/NOLOGO"])
if int(env["MSVS_VERSION"].split(".")[0]) < 10 :
env["LINKCOM"] = [env["LINKCOM"], 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;1']