diff options
author | Remko Tronçon <git@el-tramo.be> | 2012-12-23 20:44:59 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-12-23 21:21:03 (GMT) |
commit | fbff232c504d7df20ef5afc97904117d08423a79 (patch) | |
tree | 6740e06116e827b6a135d7b4f9dd035ab666c089 /BuildTools/SCons | |
parent | 40c9a08061f285cbc4754bc135539d46c70e02e9 (diff) | |
download | swift-fbff232c504d7df20ef5afc97904117d08423a79.zip swift-fbff232c504d7df20ef5afc97904117d08423a79.tar.bz2 |
Use CLang by default on Mac OS X.
Change-Id: I8be9527d06698785167b4824db1847c2d7b5362b
Diffstat (limited to 'BuildTools/SCons')
-rw-r--r-- | BuildTools/SCons/SConscript.boot | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot index 3a58d65..1e9770c 100644 --- a/BuildTools/SCons/SConscript.boot +++ b/BuildTools/SCons/SConscript.boot @@ -106,6 +106,20 @@ if env["max_jobs"] : except ImportError : pass +# 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"]) + # Default compiler flags if env.get("distcc", False) : env["ENV"]["HOME"] = os.environ["HOME"] @@ -118,22 +132,16 @@ 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 -env["CXXFLAGS"] = env.get("cxxflags", []) 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"] = [] |