summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/Swift/RunCMakeTest.cmake22
-rw-r--r--Tests/SwiftOnly/CMakeLists.txt4
-rw-r--r--Tests/SwiftOnly/SubC/CMakeLists.txt2
-rw-r--r--Tests/SwiftOnly/SubC/SubC.swift1
-rw-r--r--Tests/SwiftOnly/SubD/CMakeLists.txt1
-rw-r--r--Tests/SwiftOnly/SubD/SubD.swift1
-rw-r--r--Tests/SwiftOnly/SubE/CMakeLists.txt2
-rw-r--r--Tests/SwiftOnly/SubE/main.swift1
8 files changed, 30 insertions, 4 deletions
diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake
index 39f754c..716075e 100644
--- a/Tests/RunCMake/Swift/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake
@@ -19,9 +19,7 @@ block()
run_cmake(CMP0157-NEW)
run_cmake(CMP0157-WARN)
- if(RunCMake_GENERATOR MATCHES "Ninja.*")
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0157-OLD-build)
- endif()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0157-OLD-build)
run_cmake(CMP0157-OLD)
@@ -32,9 +30,25 @@ block()
endif()
endblock()
-if(RunCMake_GENERATOR MATCHES "Ninja")
+block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SwiftSimple-build)
run_cmake(SwiftSimple)
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG AND
+ # Older Xcode versions didn't support Swift static libraries.
+ NOT (RunCMake_GENERATOR STREQUAL "Xcode" AND XCODE_VERSION VERSION_LESS 9.0))
+ # Check that .swiftmodule files get their own directories
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(SwiftSimple-build-Debug ${CMAKE_COMMAND} --build . --config Debug)
+ run_cmake_command(SwiftSimple-build-Release ${CMAKE_COMMAND} --build . --config Release)
+ # Will fail if either path doesn't exist. Passing -r because Xcode
+ # generates .swiftmodule directories.
+ run_cmake_command(SwiftSimple-verify ${CMAKE_COMMAND} -E
+ rm -r Debug/L.swiftmodule Release/L.swiftmodule)
+ endif()
+endblock()
+
+if(RunCMake_GENERATOR MATCHES "Ninja")
block()
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
run_cmake_with_options(Win32ExecutableDisallowed)
diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt
index 25892f1..e933ea1 100644
--- a/Tests/SwiftOnly/CMakeLists.txt
+++ b/Tests/SwiftOnly/CMakeLists.txt
@@ -28,6 +28,10 @@ endif()
add_subdirectory(SubA)
add_subdirectory(SubB)
+add_subdirectory(SubC)
+add_subdirectory(SubD)
+add_subdirectory(SubE)
+
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
add_executable(SwiftOnly main.swift)
diff --git a/Tests/SwiftOnly/SubC/CMakeLists.txt b/Tests/SwiftOnly/SubC/CMakeLists.txt
new file mode 100644
index 0000000..4fdb3d3
--- /dev/null
+++ b/Tests/SwiftOnly/SubC/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(SubC SubC.swift)
+target_link_libraries(SubC PUBLIC SubD)
diff --git a/Tests/SwiftOnly/SubC/SubC.swift b/Tests/SwiftOnly/SubC/SubC.swift
new file mode 100644
index 0000000..1ca44f4
--- /dev/null
+++ b/Tests/SwiftOnly/SubC/SubC.swift
@@ -0,0 +1 @@
+import SubD
diff --git a/Tests/SwiftOnly/SubD/CMakeLists.txt b/Tests/SwiftOnly/SubD/CMakeLists.txt
new file mode 100644
index 0000000..01b38d3
--- /dev/null
+++ b/Tests/SwiftOnly/SubD/CMakeLists.txt
@@ -0,0 +1 @@
+add_library(SubD SubD.swift)
diff --git a/Tests/SwiftOnly/SubD/SubD.swift b/Tests/SwiftOnly/SubD/SubD.swift
new file mode 100644
index 0000000..857d3f4
--- /dev/null
+++ b/Tests/SwiftOnly/SubD/SubD.swift
@@ -0,0 +1 @@
+public let x = 42
diff --git a/Tests/SwiftOnly/SubE/CMakeLists.txt b/Tests/SwiftOnly/SubE/CMakeLists.txt
new file mode 100644
index 0000000..099a81c
--- /dev/null
+++ b/Tests/SwiftOnly/SubE/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_executable(SubE main.swift)
+target_link_libraries(SubE PUBLIC SubD)
diff --git a/Tests/SwiftOnly/SubE/main.swift b/Tests/SwiftOnly/SubE/main.swift
new file mode 100644
index 0000000..1ca44f4
--- /dev/null
+++ b/Tests/SwiftOnly/SubE/main.swift
@@ -0,0 +1 @@
+import SubD