From 59ff857a80c333ac5de2dfca4c2fb1b2f578fe1b Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Sun, 10 Sep 2023 21:47:02 -0700 Subject: [PATCH] Windows Clang-Cl: Powershell & Ninja --- .github/ci/vcvarsall.ps1 | 12 ++++++++++++ .github/workflows/windows.yml | 19 +++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 .github/ci/vcvarsall.ps1 diff --git a/.github/ci/vcvarsall.ps1 b/.github/ci/vcvarsall.ps1 new file mode 100644 index 00000000..ad73de12 --- /dev/null +++ b/.github/ci/vcvarsall.ps1 @@ -0,0 +1,12 @@ +# https://discourse.cmake.org/t/how-to-configure-cmake-on-windows-to-use-clang-cl-with-ninja-multi-config-for-intel-32-bits-intel-64-bits-and-arm64-coming-from-visual-studio/3430/10 +# https://gitlab.kitware.com/cmake/cmake/-/blob/master/.gitlab/ci/vcvarsall.ps1 + +$erroractionpreference = "stop" + +cmd /c "`"$env:VCVARSALL`" $env:VCVARSPLATFORM -vcvars_ver=$env:VCVARSVERSION & set" | +foreach { + if ($_ -match "=") { + $v = $_.split("=") + [Environment]::SetEnvironmentVariable($v[0], $v[1]) + } +} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 6682c9dd..b0c91f82 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -31,7 +31,7 @@ jobs: clang: name: Clang w/o MPI shared debug - runs-on: windows-latest + runs-on: windows-2022 if: github.event.pull_request.draft == false steps: - uses: actions/checkout@v3 @@ -41,15 +41,22 @@ jobs: - uses: seanmiddleditch/gha-setup-ninja@master - name: Build run: | + $Env:VCVARSALL = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\vc\Auxiliary\build\vcvarsall.bat" + $Env:VCVARSPLATFORM = "x64" + $Env:VCVARSVERSION = "14.36.32532" + Invoke-Expression -Command .github/ci/vcvarsall.ps1 + python3 -m pip install -U pip setuptools wheel pytest python3 -m pip install -U cmake python3 -m pip install -r requirements.txt - cmake -S . -B build ` - -T "ClangCl" ` - -DCMAKE_VERBOSE_MAKEFILE=ON ` - -DBUILD_SHARED_LIBS=ON ` - -DAMReX_MPI=OFF ` + cmake -S . -B build ` + -G "Ninja" ` + -DCMAKE_C_COMPILER=clang-cl ` + -DCMAKE_CXX_COMPILER=clang-cl ` + -DCMAKE_VERBOSE_MAKEFILE=ON ` + -DBUILD_SHARED_LIBS=ON ` + -DAMReX_MPI=OFF ` -DAMReX_SPACEDIM="1;2;3" if(!$?) { Exit $LASTEXITCODE }