ci: Factor out helper to load clang into environment on Windows

This commit is contained in:
Brad King
2022-11-10 09:29:29 -05:00
parent bf2e4a2e85
commit 8ba5835c8d
5 changed files with 16 additions and 13 deletions

15
.gitlab/ci/clang-env.ps1 Executable file
View File

@@ -0,0 +1,15 @@
Invoke-Expression -Command .gitlab/ci/clang.ps1
Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
$pwdpath = $pwd.Path
Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\llvm\bin;$env:PATH"
if ("$env:CMAKE_CI_BUILD_NAME" -match "(^|_)gnu(_|$)") {
$env:CC = "clang"
$env:CXX = "clang++"
clang --version
} else {
$env:CC = "clang-cl"
$env:CXX = "clang-cl"
clang-cl --version
}

View File

@@ -1,7 +0,0 @@
if("$ENV{CMAKE_CI_BUILD_NAME}" MATCHES "(^|_)gnu(_|$)")
set(ENV{CC} clang)
set(ENV{CXX} clang++)
else()
set(ENV{CC} clang-cl)
set(ENV{CXX} clang-cl)
endif()

View File

@@ -1 +0,0 @@
include("${CMAKE_CURRENT_LIST_DIR}/env_windows_clang_common.cmake")

View File

@@ -1 +0,0 @@
include("${CMAKE_CURRENT_LIST_DIR}/env_windows_clang_common.cmake")

View File

@@ -396,10 +396,7 @@
script:
- . .gitlab/ci/env.ps1
- . .gitlab/ci/ninja-env.ps1
- Invoke-Expression -Command .gitlab/ci/clang.ps1
- Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
- $pwdpath = $pwd.Path
- Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\llvm\bin;$env:PATH"
- . .gitlab/ci/clang-env.ps1
- build/install/bin/ctest --output-on-failure -V -S .gitlab/ci/ctest_standalone.cmake
interruptible: true