summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-14 11:27:29 (GMT)
committerTobias Markmann <tm@ayena.de>2016-03-14 16:00:29 (GMT)
commit8cdebcff1d1e8321b070c7e675f9a9709a2b0b81 (patch)
tree2be3bc1fb4636f208e4a872c213b8e18fa1bb45f /BuildTools/SCons/SConstruct
parentfcb5204aeacd6c4bf49223f133df285f22f7cd4b (diff)
downloadswift-8cdebcff1d1e8321b070c7e675f9a9709a2b0b81.zip
swift-8cdebcff1d1e8321b070c7e675f9a9709a2b0b81.tar.bz2
Build all Swift projects as C++11
Added a SCons compiler test so that the build process fails early if C++11 is not supported. Remove C++11 checks as we now default to C++11 and they are not needed anymore. Ignore a Clang warning if building 3rdParty Boost. Test-Information: Tested build and unit tests on OS X 10.11.3. Change-Id: Icbecbd1e25e8d8bbe5f402f75355373a86b5f8a1
Diffstat (limited to 'BuildTools/SCons/SConstruct')
-rw-r--r--BuildTools/SCons/SConstruct39
1 files changed, 37 insertions, 2 deletions
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 3305fd3..173380e 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -68,6 +68,35 @@ def checkObjCHeader(context, header) :
context.Result(ret)
return ret
+def checkForCpp11Support(context) :
+ context.Message('Checking whether the C++ compiler supports C++11... ')
+ result = context.TryLink(
+ """
+#include <memory>
+
+int main(int, char **) {
+ // shared_ptr test
+ std::shared_ptr<int> intPtr = std::make_shared<int>();
+
+ // unique_ptr test
+ std::unique_ptr<int> intPtrUnique = std::unique_ptr<int>(new int(1));
+
+ // auto test
+ auto otherIntPtr = intPtr;
+ std::shared_ptr<int> fooIntPtr = otherIntPtr;
+
+ // lambda test
+ auto someFunction = [](int i){ i = i * i; };
+
+ // nullptr test
+ double* fooDouble = nullptr;
+ return 0;
+}
+""", '.cpp')
+ context.Result(result)
+ return result
+
+
################################################################################
# Platform configuration
################################################################################
@@ -103,13 +132,19 @@ int main(int argc, char* argv[]) {
else :
return -1
-
-conf = Configure(conf_env)
+conf = Configure(conf_env, custom_tests = {
+ 'CheckCpp11Support' : checkForCpp11Support,
+ })
if not conf.CheckCXX() or not conf.CheckCC() :
print "Error: You need a working compiler"
Exit(1)
+if not conf.CheckCpp11Support() :
+ print "Error: You need a compiler with support for the C++11 standard"
+ Exit(1)
+
+
env["HAVE_ZLIB"] = True
zlib_flags = {}
zlib_okay = False