summaryrefslogtreecommitdiffstats
path: root/Tests/SwiftOnly
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-04-16 12:46:34 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-04-16 12:47:11 (GMT)
commit1c9e514d2838fe7cb4b3c8efc682ae762c6891d8 (patch)
tree39480a698a4d411f5a3f615b3865d9588178c83c /Tests/SwiftOnly
parent211fbe77591e7e1dd70fd278c04cfa9aa7f85257 (diff)
parent56e5cea6008397f83479952d4c59964c32bc35fd (diff)
downloadCMake-1c9e514d2838fe7cb4b3c8efc682ae762c6891d8.zip
CMake-1c9e514d2838fe7cb4b3c8efc682ae762c6891d8.tar.gz
CMake-1c9e514d2838fe7cb4b3c8efc682ae762c6891d8.tar.bz2
Merge topic 'swift-module-libraries'
56e5cea600 Swift: Support module libraries with command-line build systems Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9379
Diffstat (limited to 'Tests/SwiftOnly')
-rw-r--r--Tests/SwiftOnly/CMakeLists.txt11
-rw-r--r--Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt2
-rw-r--r--Tests/SwiftOnly/SwiftPlugin/main.swift3
-rw-r--r--Tests/SwiftOnly/SwiftPlugin/plugin.swift2
4 files changed, 4 insertions, 14 deletions
diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt
index db7caf9..de4c82f 100644
--- a/Tests/SwiftOnly/CMakeLists.txt
+++ b/Tests/SwiftOnly/CMakeLists.txt
@@ -57,16 +57,7 @@ add_dependencies(P SwiftOnly)
add_library(SwiftIface INTERFACE)
target_link_libraries(SwiftOnly PRIVATE SwiftIface)
-# @_alwaysEmitIntoClient ensures that the function body is inserted into the
-# swiftmodule instead of as a symbol in the binary itself. I'm doing this to
-# avoid having to link the executable. There are some flags required in order to
-# link an executable into a library that I didn't see CMake emitting for Swift
-# on macOS. AEIC is the easiest workaround that still tests this functionality.
-# Unfortunately, AEIC was only added recently (~Swift 5.2), so we need to check
-# that it is available before using it.
-if(CMAKE_Swift_COMPILER_VERSION VERSION_GREATER_EQUAL 5.2)
- add_subdirectory("SwiftPlugin")
-endif()
+add_subdirectory("SwiftPlugin")
function(test_cmp0157_default mode)
if(POLICY CMP0157)
diff --git a/Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt b/Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt
index 4069f16..2bfbc8a 100644
--- a/Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt
+++ b/Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt
@@ -1,5 +1,5 @@
add_executable(main main.swift)
set_target_properties(main PROPERTIES ENABLE_EXPORTS TRUE)
-add_library(plugin plugin.swift)
+add_library(plugin MODULE plugin.swift)
target_link_libraries(plugin PRIVATE main)
diff --git a/Tests/SwiftOnly/SwiftPlugin/main.swift b/Tests/SwiftOnly/SwiftPlugin/main.swift
index f5aac51..caba1fb 100644
--- a/Tests/SwiftOnly/SwiftPlugin/main.swift
+++ b/Tests/SwiftOnly/SwiftPlugin/main.swift
@@ -1,4 +1,3 @@
-@_alwaysEmitIntoClient
-public func exported() -> Int { 32 }
+public func exported() -> Int { return 32 }
print(exported())
diff --git a/Tests/SwiftOnly/SwiftPlugin/plugin.swift b/Tests/SwiftOnly/SwiftPlugin/plugin.swift
index e84f248..d00ca33 100644
--- a/Tests/SwiftOnly/SwiftPlugin/plugin.swift
+++ b/Tests/SwiftOnly/SwiftPlugin/plugin.swift
@@ -1,3 +1,3 @@
import main
-public func importing() -> Int { main.exported() + 1 }
+public func importing() -> Int { return main.exported() + 1 }