Skip to content

Commit 3a7b9d0

Browse files
committed
Build Windows pybind in CI (#11018)
1 parent 526fae8 commit 3a7b9d0

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

.github/workflows/build-presets.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,17 @@ jobs:
7272
strategy:
7373
fail-fast: false
7474
matrix:
75-
preset: [pybind]
75+
preset: [pybind, llm]
7676
with:
7777
job-name: build
7878
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
7979
submodules: recursive
8080
timeout: 90
8181
script: |
8282
set -eux
83-
conda init powershell
84-
powershell -Command "& {
85-
\$ErrorActionPreference = 'Stop'
86-
Set-PSDebug -Trace 1
83+
conda create --yes --quiet -n et python=3.12
84+
conda activate et
8785
88-
conda create --yes --quiet -n et python=3.12
89-
conda activate et
90-
91-
python install_requirements.py
92-
cmake --preset ${{ matrix.preset }}
93-
\$numCores = [System.Environment]::GetEnvironmentVariable('NUMBER_OF_PROCESSORS') - 1
94-
cmake --build cmake-out -j \$numCores
95-
}"
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)