Skip to content

Commit 557ed64

Browse files
committed
Create Windows CMake preset (#13257)
Create a CMake preset for Windows, based on what is currently buildable. Add to CI. A lot of things are currently broken, including portable kernels and XNNPACK. I've disabled these (and more) to allow setting up the initial preset and CI. These build issues will be resolved further in this stack. I've also disabled the pybind preset on Windows for now, as it does not build yet. ghstack-source-id: 1448843 ghstack-comment-id: 3222036586 Pull-Request: #13670
1 parent 6ee6d7a commit 557ed64

File tree

3 files changed

+38
-37
lines changed

3 files changed

+38
-37
lines changed

.github/workflows/build-presets.yml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -103,40 +103,3 @@ jobs:
103103
./install_requirements.sh > /dev/null
104104
cmake --preset ${{ matrix.preset }}
105105
cmake --build cmake-out -j$(( $(nproc) - 1 ))
106-
107-
windows:
108-
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
109-
strategy:
110-
fail-fast: false
111-
matrix:
112-
preset: [pybind]
113-
with:
114-
job-name: build
115-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
116-
submodules: recursive
117-
timeout: 90
118-
script: |
119-
set -eux
120-
conda init powershell
121-
powershell -Command "& {
122-
Set-PSDebug -Trace 1
123-
\$ErrorActionPreference = 'Stop'
124-
\$PSNativeCommandUseErrorActionPreference = \$true
125-
126-
conda create --yes --quiet -n et python=3.12
127-
conda activate et
128-
129-
python install_requirements.py
130-
cmake --preset ${{ matrix.preset }}
131-
if (\$LASTEXITCODE -ne 0) {
132-
Write-Host "CMake configuration was unsuccessful. Exit code: \$LASTEXITCODE."
133-
exit \$LASTEXITCODE
134-
}
135-
136-
\$numCores = [System.Environment]::GetEnvironmentVariable('NUMBER_OF_PROCESSORS') - 1
137-
cmake --build cmake-out -j \$numCores
138-
if (\$LASTEXITCODE -ne 0) {
139-
Write-Host "CMake build was unsuccessful. Exit code: \$LASTEXITCODE."
140-
exit \$LASTEXITCODE
141-
}
142-
}"

CMakePresets.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,21 @@
150150
]
151151
}
152152
},
153+
{
154+
"name": "windows",
155+
"displayName": "Build ExecuTorch for Windows",
156+
"inherits": ["common"],
157+
"cacheVariables": {
158+
"CMAKE_SYSTEM_NAME": "Windows",
159+
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/windows.cmake"
160+
},
161+
"toolset": "ClangCL",
162+
"condition": {
163+
"lhs": "${hostSystemName}",
164+
"type": "equals",
165+
"rhs": "Windows"
166+
}
167+
},
153168
{
154169
"name": "zephyr",
155170
"displayName": "Build ExecuTorch for Zephyr RTOS",

tools/cmake/preset/windows.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# keep sorted
8+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON)
9+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_EVALUE_UTIL ON)
10+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON)
11+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_MODULE ON)
12+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL ON)
13+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TENSOR ON)
14+
15+
# Below options are not yet buildable on Windows, but should be.
16+
set(EXECUTORCH_BUILD_PORTABLE_OPS
17+
OFF
18+
CACHE BOOL ""
19+
)
20+
# set_overridable_option(EXECUTORCH_BUILD_EXECUTOR_RUNNER ON)
21+
# set_overridable_option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED ON)
22+
# set_overridable_option(EXECUTORCH_BUILD_KERNELS_QUANTIZED ON)
23+
# set_overridable_option(EXECUTORCH_BUILD_XNNPACK ON)

0 commit comments

Comments
 (0)