Skip to content

Commit 3db0529

Browse files
committed
enforce clang on windows
1 parent 1b4968f commit 3db0529

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

.github/workflows/build-presets.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ jobs:
7171
# Build Arm Zephyr Preset
7272
cmake --preset ${{ matrix.preset }}
7373
cmake --build cmake-out -j$(( $(nproc) - 1 ))
74+
7475
linux:
7576
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
7677
strategy:
@@ -117,16 +118,9 @@ jobs:
117118
timeout: 90
118119
script: |
119120
set -eux
120-
conda init powershell
121-
powershell -Command "& {
122-
\$ErrorActionPreference = 'Stop'
123-
Set-PSDebug -Trace 1
124-
125-
conda create --yes --quiet -n et python=3.12
126-
conda activate et
121+
conda create --yes --quiet -n et python=3.12
122+
conda activate et
127123
128-
python install_requirements.py
129-
cmake --preset ${{ matrix.preset }}
130-
\$numCores = [System.Environment]::GetEnvironmentVariable('NUMBER_OF_PROCESSORS') - 1
131-
cmake --build cmake-out -j \$numCores
132-
}"
124+
./install_requirements.sh
125+
cmake -G "Visual Studio 17 2022" -T ClangCL --preset ${{ matrix.preset }}
126+
cmake --build cmake-out -j$(( $(nproc) - 1 ))

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ if(NOT CMAKE_BUILD_TYPE)
7474
endif()
7575
announce_configured_options(CMAKE_BUILD_TYPE)
7676

77+
if(WIN32)
78+
if(NOT "${CMAKE_GENERATOR_TOOLSET}" STREQUAL "" AND NOT CMAKE_GENERATOR_TOOLSET MATCHES "Clang")
79+
message(FATAL_ERROR "Windows requires clang. Pass '-T ClangCL' in the cmake build command. Current CMAKE_GENERATOR_TOOLSET: ${CMAKE_GENERATOR_TOOLSET}")
80+
endif()
81+
endif()
82+
7783
if(NOT PYTHON_EXECUTABLE)
7884
resolve_python_executable()
7985
endif()

0 commit comments

Comments
 (0)