Skip to content

Commit 1cbdc54

Browse files
committed
Create Windows CMake preset
ghstack-source-id: 43e8787 ghstack-comment-id: 3172042069 Pull-Request: #13257
1 parent 34ae042 commit 1cbdc54

File tree

3 files changed

+40
-12
lines changed

3 files changed

+40
-12
lines changed

.github/workflows/build-presets.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
branches:
77
- main
88
- release/*
9+
paths:
10+
- .github/workflows/build-presets.yml
911
workflow_dispatch:
1012

1113
concurrency:
@@ -109,7 +111,7 @@ jobs:
109111
strategy:
110112
fail-fast: false
111113
matrix:
112-
preset: [pybind]
114+
preset: [pybind, windows]
113115
with:
114116
job-name: build
115117
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
@@ -119,24 +121,14 @@ jobs:
119121
set -eux
120122
conda init powershell
121123
powershell -Command "& {
122-
Set-PSDebug -Trace 1
123124
\$ErrorActionPreference = 'Stop'
124-
\$PSNativeCommandUseErrorActionPreference = \$true
125+
Set-PSDebug -Trace 2
125126
126127
conda create --yes --quiet -n et python=3.12
127128
conda activate et
128129
129130
python install_requirements.py
130131
cmake --preset ${{ matrix.preset }}
131-
if (\$LASTEXITCODE -ne 0) {
132-
Write-Host "CMake configuration was unsuccessful. Exit code: \$LASTEXITCODE."
133-
exit \$LASTEXITCODE
134-
}
135-
136132
\$numCores = [System.Environment]::GetEnvironmentVariable('NUMBER_OF_PROCESSORS') - 1
137133
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-
}
142134
}"

CMakePresets.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,21 @@
120120
]
121121
}
122122
},
123+
{
124+
"name": "windows",
125+
"displayName": "Build ExecuTorch for Windows",
126+
"inherits": ["common"],
127+
"cacheVariables": {
128+
"CMAKE_SYSTEM_NAME": "Windows",
129+
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/windows.cmake"
130+
},
131+
"toolset": "ClangCL",
132+
"condition": {
133+
"lhs": "${hostSystemName}",
134+
"type": "equals",
135+
"rhs": "Windows"
136+
}
137+
},
123138
{
124139
"name": "zephyr",
125140
"displayName": "Build ExecuTorch for Zephyr RTOS",

tools/cmake/preset/windows.cmake

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
8+
# keep sorted
9+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON)
10+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_EVALUE_UTIL ON)
11+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON)
12+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_MODULE ON)
13+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL ON)
14+
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TENSOR ON)
15+
16+
# Below options are not yet buildable on Windows, but should be.
17+
set(EXECUTORCH_BUILD_PORTABLE_OPS OFF CACHE BOOL "")
18+
#set_overridable_option(EXECUTORCH_BUILD_EXECUTOR_RUNNER ON)
19+
#set_overridable_option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED ON)
20+
#set_overridable_option(EXECUTORCH_BUILD_KERNELS_QUANTIZED ON)
21+
#set_overridable_option(EXECUTORCH_BUILD_XNNPACK ON)

0 commit comments

Comments
 (0)