Skip to content

Commit 1743750

Browse files
committed
Build Windows pybind in CI (#11018)
1 parent 125129b commit 1743750

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

.github/workflows/build-presets.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,30 +65,24 @@ jobs:
6565
6666
./install_requirements.sh > /dev/null
6767
cmake --preset ${{ matrix.preset }}
68+
cmake --build cmake-out -j$(( $(nproc) - 1 ))
6869
6970
windows:
7071
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
7172
strategy:
7273
fail-fast: false
7374
matrix:
74-
preset: [pybind]
75+
preset: [pybind, llm]
7576
with:
7677
job-name: build
7778
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
7879
submodules: recursive
7980
timeout: 90
8081
script: |
8182
set -eux
82-
conda init powershell
83-
powershell -Command "& {
84-
\$ErrorActionPreference = 'Stop'
85-
Set-PSDebug -Trace 1
83+
conda create --yes --quiet -n et python=3.12
84+
conda activate et
8685
87-
conda create --yes --quiet -n et python=3.12
88-
conda activate et
89-
90-
python install_requirements.py
91-
cmake --preset ${{ matrix.preset }}
92-
\$numCores = [System.Environment]::GetEnvironmentVariable('NUMBER_OF_PROCESSORS') - 1
93-
cmake --build cmake-out -j \$numCores
94-
}"
86+
python install_requirements.py
87+
cmake --preset ${{ matrix.preset }}
88+
cmake --build cmake-out -j$(( $(nproc) - 1 ))

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,16 @@ if(NOT PYTHON_EXECUTABLE)
7272
endif()
7373
announce_configured_options(PYTHON_EXECUTABLE)
7474

75+
# Check if we are on Windows
76+
if(WIN32)
77+
if(DEFINED CMAKE_CXX_COMPILER_ID AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
78+
message(FATAL_ERROR "Windows builds require Clang compiler. Current compiler: ${CMAKE_CXX_COMPILER_ID}")
79+
elseif(NOT DEFINED CMAKE_CXX_COMPILER_ID)
80+
set(CMAKE_CXX_COMPILER_ID "ClangCL")
81+
endif()
82+
endif()
7583
announce_configured_options(CMAKE_CXX_COMPILER_ID)
84+
7685
announce_configured_options(CMAKE_TOOLCHAIN_FILE)
7786
announce_configured_options(BUCK2)
7887

install_executorch.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,6 @@ def main(args):
221221
# latest PT commit otherwise
222222
use_pytorch_nightly = False
223223

224-
# Use ClangCL on Windows.
225-
# ClangCL is an alias to Clang that configures it to work in an MSVC-compatible
226-
# mode. Using it on Windows to avoid compiler compatibility issues for MSVC.
227-
if os.name == "nt":
228-
cmake_args.append("-T ClangCL")
229-
230224
#
231225
# Install executorch pip package. This also makes `flatc` available on the path.
232226
# The --extra-index-url may be necessary if pyproject.toml has a dependency on a

0 commit comments

Comments
 (0)