[Cmake-commits] CMake branch, next, updated. v3.8.0-rc3-623-gbdc5141

Kitware Robot kwrobot at kitware.com
Wed Mar 29 09:45:02 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  bdc5141f31e33ab4516a46fcee6e612baa583f84 (commit)
       via  77139e320c8ec7f92e1298cc57fea7276faceb12 (commit)
       via  c03141c04cededf6bf31d51627cd8b29c7668495 (commit)
      from  4f7e91331af6c356e91cf01132e2a82cea4bce4a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bdc5141f31e33ab4516a46fcee6e612baa583f84
commit bdc5141f31e33ab4516a46fcee6e612baa583f84
Merge: 4f7e913 77139e3
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Mar 29 13:39:21 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Mar 29 09:39:24 2017 -0400

    Stage topic '16742-swift-3.0'
    
    Topic-id: 23323
    Topic-url: https://gitlab.kitware.com/cmake/cmake/merge_requests/638


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77139e320c8ec7f92e1298cc57fea7276faceb12
commit 77139e320c8ec7f92e1298cc57fea7276faceb12
Author:     Gregor Jasny <gjasny at googlemail.com>
AuthorDate: Wed Mar 29 15:32:01 2017 +0200
Commit:     Gregor Jasny <gjasny at googlemail.com>
CommitDate: Wed Mar 29 15:36:05 2017 +0200

    Swift: Simplify mixed test case to make it version agnostic
    
    Issue: #16742

diff --git a/Tests/SwiftMix/ObjCMain.m b/Tests/SwiftMix/ObjCMain.m
index 5a8700c..20f0bf1 100644
--- a/Tests/SwiftMix/ObjCMain.m
+++ b/Tests/SwiftMix/ObjCMain.m
@@ -1,10 +1,4 @@
 #import "SwiftMix-Swift.h"
 int ObjCMain(int argc, char const* const argv[]) {
-  if ([SwiftMainClass respondsToSelector:@selector(SwiftMain:argv:)]) {
-    return [SwiftMainClass SwiftMain:argc argv:argv];
-  }
-  if ([SwiftMainClass respondsToSelector:@selector(SwiftMainWithArgc:argv:)]) {
-    return [SwiftMainClass SwiftMainWithArgc:argc argv:argv];
-  }
-  return -1;
+  return [SwiftMainClass SwiftMain];
 }
diff --git a/Tests/SwiftMix/SwiftMain.swift b/Tests/SwiftMix/SwiftMain.swift
index 921439a..a4a0a62 100644
--- a/Tests/SwiftMix/SwiftMain.swift
+++ b/Tests/SwiftMix/SwiftMain.swift
@@ -1,19 +1,8 @@
 import Foundation
 
 @objc class SwiftMainClass : NSObject {
-  class func SwiftMain(argc:Int, argv:UnsafePointer<UnsafePointer<CChar>>) -> Int32 {
-    dump("argc: \(argc)")
-#if swift(>=3.0)
-    for i in 0 ..< argc {
-      let argi = String(cString:argv[i]);
-      dump("arg[\(i)]: \(argi)");
-    }
-#else
-    for (var i = 0; i < argc; ++i) {
-      let argi = String.fromCString(argv[i])
-      dump("arg[\(i)]: \(argi)");
-    }
-#endif
+  class func SwiftMain() -> Int32 {
+    dump("Hello World!");
     return 0;
   }
 }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c03141c04cededf6bf31d51627cd8b29c7668495
commit c03141c04cededf6bf31d51627cd8b29c7668495
Author:     Gregor Jasny <gjasny at googlemail.com>
AuthorDate: Tue Mar 28 16:04:02 2017 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Mar 28 16:06:29 2017 -0400

    Swift: Default to Swift 3.0 with Xcode 8.3 and later
    
    Xcode 8.3 has dropped support for Swift 2.3 so that compiler and
    feature detection failed.
    
    Closes #16742

diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index bb34de5..c41a986 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -269,7 +269,13 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
       set(id_toolset "")
     endif()
     if("${lang}" STREQUAL "Swift")
-      set(id_lang_version "SWIFT_VERSION = 2.3;")
+      if(CMAKE_Swift_LANGUAGE_VERSION)
+        set(id_lang_version "SWIFT_VERSION = ${CMAKE_Swift_LANGUAGE_VERSION};")
+      elseif(XCODE_VERSION VERSION_GREATER_EQUAL 8.3)
+        set(id_lang_version "SWIFT_VERSION = 3.0;")
+      else()
+        set(id_lang_version "SWIFT_VERSION = 2.3;")
+      endif()
     else()
       set(id_lang_version "")
     endif()
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 8627cf2..dd771b1 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3075,10 +3075,14 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
                                 this->CreateString(this->GeneratorToolset));
   }
   if (this->GetLanguageEnabled("Swift")) {
-    std::string swiftVersion = "2.3";
+    std::string swiftVersion;
     if (const char* vers = this->CurrentMakefile->GetDefinition(
           "CMAKE_Swift_LANGUAGE_VERSION")) {
       swiftVersion = vers;
+    } else if (this->XcodeVersion >= 83) {
+      swiftVersion = "3.0";
+    } else {
+      swiftVersion = "2.3";
     }
     buildSettings->AddAttribute("SWIFT_VERSION",
                                 this->CreateString(swiftVersion));
diff --git a/Tests/SwiftMix/ObjCMain.m b/Tests/SwiftMix/ObjCMain.m
index 7fa90ae..5a8700c 100644
--- a/Tests/SwiftMix/ObjCMain.m
+++ b/Tests/SwiftMix/ObjCMain.m
@@ -1,4 +1,10 @@
 #import "SwiftMix-Swift.h"
 int ObjCMain(int argc, char const* const argv[]) {
-  return [SwiftMainClass SwiftMain:argc argv:argv];
+  if ([SwiftMainClass respondsToSelector:@selector(SwiftMain:argv:)]) {
+    return [SwiftMainClass SwiftMain:argc argv:argv];
+  }
+  if ([SwiftMainClass respondsToSelector:@selector(SwiftMainWithArgc:argv:)]) {
+    return [SwiftMainClass SwiftMainWithArgc:argc argv:argv];
+  }
+  return -1;
 }
diff --git a/Tests/SwiftMix/SwiftMain.swift b/Tests/SwiftMix/SwiftMain.swift
index 3629ac8..921439a 100644
--- a/Tests/SwiftMix/SwiftMain.swift
+++ b/Tests/SwiftMix/SwiftMain.swift
@@ -3,10 +3,17 @@ import Foundation
 @objc class SwiftMainClass : NSObject {
   class func SwiftMain(argc:Int, argv:UnsafePointer<UnsafePointer<CChar>>) -> Int32 {
     dump("argc: \(argc)")
+#if swift(>=3.0)
+    for i in 0 ..< argc {
+      let argi = String(cString:argv[i]);
+      dump("arg[\(i)]: \(argi)");
+    }
+#else
     for (var i = 0; i < argc; ++i) {
       let argi = String.fromCString(argv[i])
       dump("arg[\(i)]: \(argi)");
     }
+#endif
     return 0;
   }
 }

-----------------------------------------------------------------------

Summary of changes:
 Modules/CMakeDetermineCompilerId.cmake |    8 +++++++-
 Source/cmGlobalXCodeGenerator.cxx      |    6 +++++-
 Tests/SwiftMix/ObjCMain.m              |    2 +-
 Tests/SwiftMix/SwiftMain.swift         |    8 ++------
 4 files changed, 15 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list