Skip to content

force 14.44 developer powershell for llvm + nvcc builds #216

force 14.44 developer powershell for llvm + nvcc builds

force 14.44 developer powershell for llvm + nvcc builds #216

name: CMake on Windows (x64)
on:
#push:
# branches: [ $default-branch ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: [self-hosted, windows, x64]
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
matrix:
#host compiler, version, cuda compiler, cuda version,
#disabling ,"llvm,21.1.0,llvm,12.1", not working on windows yet
toolset: ["cl,14.44,nvcc,12.9","llvm,21.1.0,nvcc,12.9"]
steps:
- uses: actions/checkout@v4
- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
run: |
echo "build-output-dir=${{github.workspace}}/build" >> "$env:GITHUB_OUTPUT"
- name: Configure CMake
run: |
$vsWhere = "${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsInstallationPath = & $vsWhere -products * -latest -property installationPath
$y = "${{matrix.toolset}}".split(",")
if ($y[0].contains("llvm")) {
$env:CC="D:\clang+llvm-"+$y[1]+"-x86_64-pc-windows-msvc\bin\clang-cl.exe"
$env:CXX="D:\clang+llvm-"+$y[1]+"-x86_64-pc-windows-msvc\bin\clang-cl.exe"
$devargs='-arch=x64 -vcvars_ver=14.44'
} else {
$env:CC="cl.exe"
$env:CXX="cl.exe"
$devargs='-arch=x64 -vcvars_ver='+$y[1]
}
if ($y[2].contains("llvm")) {
#we only support clang with gnu frontend for cuda
$env:CC="D:\clang+llvm-"+$y[1]+"-x86_64-pc-windows-msvc\bin\clang++.exe"
$env:CXX=$env:CC
$env:CUDACXX=$env:CC
$devargs='-arch=x64 -vcvars_ver=14.44'
} else {
$env:CUDACXX="${env:ProgramFiles}\NVIDIA GPU Computing Toolkit\CUDA\v$($y[3])\bin\nvcc.exe"
}
Import-Module (Get-ChildItem $vsInstallationPath -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName
Enter-VsDevShell -VsInstallPath $vsInstallationPath -SkipAutomaticLocation -DevCmdArguments $devargs
cmake -G "Ninja" -B ${{steps.strings.outputs.build-output-dir}} -DCMAKE_CUDA_COMPILER="$env:CUDACXX" -DCMAKE_BUILD_TYPE=Release -S ${{github.workspace}};
#worksaround for rules.ninja generating empty path
if ($y[2].contains("nvcc")) {
(Get-Content ${{steps.strings.outputs.build-output-dir}}\CMakeFiles\rules.ninja) -replace "\\nvcc\\bin\\nvcc.exe", "$env:CUDACXX" | Set-Content ${{steps.strings.outputs.build-output-dir}}\CMakeFiles\rules.ninja
}
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: |
$vsWhere = "${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsInstallationPath = & $vsWhere -products * -latest -property installationPath
$y = "${{matrix.toolset}}".split(",")
Import-Module (Get-ChildItem $vsInstallationPath -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName
if ($y[0].contains("llvm")) {
$devargs='-arch=x64 -vcvars_ver=14.44'
} else {
$devargs='-arch=x64 -vcvars_ver='+$y[1]
}
Enter-VsDevShell -VsInstallPath $vsInstallationPath -SkipAutomaticLocation -DevCmdArguments $devargs
cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config Release --output-junit test_results.xml