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 896e195588bde813ad6e0cc8af7fe1594d37907c (commit) via dc5ea8ee24a81a7b5e9a05232c00a4e85528641c (commit) from 10a48e620ee872e32642ed5ad1e993776be2a694 (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=896e195588bde813ad6e0cc8af7fe1594d37907c commit 896e195588bde813ad6e0cc8af7fe1594d37907c Merge: 10a48e6 dc5ea8e Author: Gregor Jasny <gja...@googlemail.com> AuthorDate: Tue Mar 28 19:52:02 2017 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue Mar 28 15:52:10 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=dc5ea8ee24a81a7b5e9a05232c00a4e85528641c commit dc5ea8ee24a81a7b5e9a05232c00a4e85528641c Author: Gregor Jasny <gja...@googlemail.com> AuthorDate: Tue Mar 28 16:04:02 2017 +0200 Commit: Gregor Jasny <gja...@googlemail.com> CommitDate: Tue Mar 28 21:07:52 2017 +0200 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 6fce8e2..1abbc01 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -298,7 +298,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 39f7b8f..42dd997 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3117,10 +3117,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 | 8 +++++++- Tests/SwiftMix/SwiftMain.swift | 7 +++++++ 4 files changed, 26 insertions(+), 3 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits