summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-02-09 14:04:59 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-02-09 14:05:07 (GMT)
commit63c3d89e96341f23e114cace116629dbaef260aa (patch)
tree43ea4b18174b4e8597c20e05ffa6186d36e6a45a
parentd851386ab0221ad0d01ad3b80179dc712f2cc6bc (diff)
parent0909fb9d4804b62ccf73bc99433a8d58740c6f0f (diff)
downloadCMake-63c3d89e96341f23e114cace116629dbaef260aa.zip
CMake-63c3d89e96341f23e114cace116629dbaef260aa.tar.gz
CMake-63c3d89e96341f23e114cace116629dbaef260aa.tar.bz2
Merge topic 'ci-swift-windows'
0909fb9d48 ci: Enable Swift tests on Windows a4e5715959 Tests/SwiftOnly: Bump minimum required CMake to 3.5 Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Evan Wilde <etceterawilde@gmail.com> Merge-request: !9231
-rw-r--r--.gitlab/.gitignore1
-rw-r--r--.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake1
-rw-r--r--.gitlab/ci/ctest_exclusions.cmake7
-rwxr-xr-x.gitlab/ci/env_windows_vs2022_x64_ninja.ps11
-rwxr-xr-x.gitlab/ci/swift-env.ps16
-rwxr-xr-x.gitlab/ci/swift.ps138
-rw-r--r--Tests/SwiftOnly/CMakeLists.txt2
7 files changed, 55 insertions, 1 deletions
diff --git a/.gitlab/.gitignore b/.gitlab/.gitignore
index b28fe32..0e34b1b 100644
--- a/.gitlab/.gitignore
+++ b/.gitlab/.gitignore
@@ -16,6 +16,7 @@
/python*
/qt*
/sccache*
+/swift
/unstable-jom*
/watcom
/wix*
diff --git a/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake b/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
index 54abf72..a41ec8b 100644
--- a/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
+++ b/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
@@ -1,6 +1,7 @@
if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
set(CMake_TEST_CPACK_INNOSETUP "ON" CACHE STRING "")
set(CMake_TEST_ISPC "ON" CACHE STRING "")
+ set(CMake_TEST_Swift "ON" CACHE STRING "")
endif()
set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "")
diff --git a/.gitlab/ci/ctest_exclusions.cmake b/.gitlab/ci/ctest_exclusions.cmake
index a2789c3..ed5e1dd 100644
--- a/.gitlab/ci/ctest_exclusions.cmake
+++ b/.gitlab/ci/ctest_exclusions.cmake
@@ -34,6 +34,13 @@ if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "nvhpc_")
)
endif()
+if ("$ENV{CMAKE_CONFIGURATION}" STREQUAL "windows_vs2022_x64_ninja")
+ list(APPEND test_exclusions
+ # FIXME(#25573): This test failure needs further investigation.
+ "^SwiftMixLib$"
+ )
+endif()
+
string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
if (test_exclusions)
set(test_exclusions "(${test_exclusions})")
diff --git a/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1 b/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1
index 50a03ca..b512e37 100755
--- a/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1
+++ b/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1
@@ -1,4 +1,5 @@
if ("$env:CMAKE_CI_NIGHTLY" -eq "true") {
. ".gitlab/ci/innosetup-env.ps1"
. ".gitlab/ci/ispc-env.ps1"
+ . ".gitlab/ci/swift-env.ps1"
}
diff --git a/.gitlab/ci/swift-env.ps1 b/.gitlab/ci/swift-env.ps1
new file mode 100755
index 0000000..871b31c
--- /dev/null
+++ b/.gitlab/ci/swift-env.ps1
@@ -0,0 +1,6 @@
+$pwdpath = $pwd.Path
+& "$pwsh" -File ".gitlab/ci/swift.ps1"
+Set-Item -Force -Path "env:DEVELOPER_DIR" -Value "$pwdpath\.gitlab\swift"
+Set-Item -Force -Path "env:SDKROOT" -Value "$pwdpath\.gitlab\swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk"
+Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\swift\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;$env:PATH"
+swiftc --version
diff --git a/.gitlab/ci/swift.ps1 b/.gitlab/ci/swift.ps1
new file mode 100755
index 0000000..b970dce
--- /dev/null
+++ b/.gitlab/ci/swift.ps1
@@ -0,0 +1,38 @@
+$erroractionpreference = "stop"
+
+$version = "5.9.2"
+$sha256sum = "8C053108528EB2DAD84C33D6F0834A3A1444D21BA1A89D591AB149304A62F6B5"
+$filename = "swift-$version-win-x86_64-1"
+$tarball = "$filename.zip"
+
+$outdir = $pwd.Path
+$outdir = "$outdir\.gitlab"
+$ProgressPreference = 'SilentlyContinue'
+# This URL is only visible inside of Kitware's network. See above filename table.
+Invoke-WebRequest -Uri "https://cmake.org/files/dependencies/internal/$tarball" -OutFile "$outdir\$tarball"
+$hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256
+if ($hash.Hash -ne $sha256sum) {
+ exit 1
+}
+
+Add-Type -AssemblyName System.IO.Compression.FileSystem
+[System.IO.Compression.ZipFile]::ExtractToDirectory("$outdir\$tarball", "$outdir")
+Move-Item -Path "$outdir\$filename" -Destination "$outdir\swift"
+Remove-Item "$outdir\$tarball"
+
+$bin = "$outdir\swift\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin"
+$null = New-Item -ItemType HardLink -Path "$bin\clang++.exe" -Target "$bin\clang.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\clang-cl.exe" -Target "$bin\clang.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\clang-cpp.exe" -Target "$bin\clang.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\ld.lld.exe" -Target "$bin\lld.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\ld64.lld.exe" -Target "$bin\lld.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\lld-link.exe" -Target "$bin\lld.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\llvm-dlltool.exe" -Target "$bin\llvm-ar.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\llvm-lib.exe" -Target "$bin\llvm-ar.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\llvm-ranlib.exe" -Target "$bin\llvm-ar.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\llvm-objcopy.exe" -Target "$bin\llvm-strip.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\swiftc.exe" -Target "$bin\swift.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\swift-api-digester.exe" -Target "$bin\swift-frontend.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\swift-autolink-extract.exe" -Target "$bin\swift-frontend.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\swift-symbolgraph-extract.exe" -Target "$bin\swift-frontend.exe"
+Clear-Variable -Name bin
diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt
index 2aa5710..3d2fe73 100644
--- a/Tests/SwiftOnly/CMakeLists.txt
+++ b/Tests/SwiftOnly/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.3)
+cmake_minimum_required(VERSION 3.5)
if(POLICY CMP0126)
cmake_policy(SET CMP0126 NEW)
endif()