From 8ba5835c8d77b5d61847eba06feac8cfd6682b45 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Nov 2022 09:29:29 -0500 Subject: ci: Factor out helper to load clang into environment on Windows --- .gitlab/ci/clang-env.ps1 | 15 +++++++++++++++ .gitlab/ci/env_windows_clang_common.cmake | 7 ------- .gitlab/ci/env_windows_clang_ninja.cmake | 1 - .gitlab/ci/env_windows_clang_nmake.cmake | 1 - .gitlab/os-windows.yml | 5 +---- 5 files changed, 16 insertions(+), 13 deletions(-) create mode 100755 .gitlab/ci/clang-env.ps1 delete mode 100644 .gitlab/ci/env_windows_clang_common.cmake delete mode 100644 .gitlab/ci/env_windows_clang_ninja.cmake delete mode 100644 .gitlab/ci/env_windows_clang_nmake.cmake diff --git a/.gitlab/ci/clang-env.ps1 b/.gitlab/ci/clang-env.ps1 new file mode 100755 index 0000000..451fca3 --- /dev/null +++ b/.gitlab/ci/clang-env.ps1 @@ -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 +} diff --git a/.gitlab/ci/env_windows_clang_common.cmake b/.gitlab/ci/env_windows_clang_common.cmake deleted file mode 100644 index fdd668f..0000000 --- a/.gitlab/ci/env_windows_clang_common.cmake +++ /dev/null @@ -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() diff --git a/.gitlab/ci/env_windows_clang_ninja.cmake b/.gitlab/ci/env_windows_clang_ninja.cmake deleted file mode 100644 index f3834a2..0000000 --- a/.gitlab/ci/env_windows_clang_ninja.cmake +++ /dev/null @@ -1 +0,0 @@ -include("${CMAKE_CURRENT_LIST_DIR}/env_windows_clang_common.cmake") diff --git a/.gitlab/ci/env_windows_clang_nmake.cmake b/.gitlab/ci/env_windows_clang_nmake.cmake deleted file mode 100644 index f3834a2..0000000 --- a/.gitlab/ci/env_windows_clang_nmake.cmake +++ /dev/null @@ -1 +0,0 @@ -include("${CMAKE_CURRENT_LIST_DIR}/env_windows_clang_common.cmake") diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index 78ebb2e..6f9c292 100644 --- a/.gitlab/os-windows.yml +++ b/.gitlab/os-windows.yml @@ -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 -- cgit v0.12