From b79f2e1b55efdd3c60a610561d196b023708ae75 Mon Sep 17 00:00:00 2001 From: Gregory Comer Date: Sat, 9 Aug 2025 12:03:48 -0700 Subject: [PATCH 1/2] Update [ghstack-poisoned] --- .github/workflows/build-presets.yml | 16 ++++------------ CMakePresets.json | 15 +++++++++++++++ tools/cmake/preset/windows.cmake | 21 +++++++++++++++++++++ 3 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 tools/cmake/preset/windows.cmake diff --git a/.github/workflows/build-presets.yml b/.github/workflows/build-presets.yml index 160c07af15e..91c3bb09b23 100644 --- a/.github/workflows/build-presets.yml +++ b/.github/workflows/build-presets.yml @@ -6,6 +6,8 @@ on: branches: - main - release/* + paths: + - .github/workflows/build-presets.yml workflow_dispatch: concurrency: @@ -109,7 +111,7 @@ jobs: strategy: fail-fast: false matrix: - preset: [pybind] + preset: [pybind, windows] with: job-name: build ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} @@ -119,24 +121,14 @@ jobs: set -eux conda init powershell powershell -Command "& { - Set-PSDebug -Trace 1 \$ErrorActionPreference = 'Stop' - \$PSNativeCommandUseErrorActionPreference = \$true + Set-PSDebug -Trace 2 conda create --yes --quiet -n et python=3.12 conda activate et python install_requirements.py cmake --preset ${{ matrix.preset }} - if (\$LASTEXITCODE -ne 0) { - Write-Host "CMake configuration was unsuccessful. Exit code: \$LASTEXITCODE." - exit \$LASTEXITCODE - } - \$numCores = [System.Environment]::GetEnvironmentVariable('NUMBER_OF_PROCESSORS') - 1 cmake --build cmake-out -j \$numCores - if (\$LASTEXITCODE -ne 0) { - Write-Host "CMake build was unsuccessful. Exit code: \$LASTEXITCODE." - exit \$LASTEXITCODE - } }" diff --git a/CMakePresets.json b/CMakePresets.json index 9a3e9290d43..cc293730292 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -120,6 +120,21 @@ ] } }, + { + "name": "windows", + "displayName": "Build ExecuTorch for Windows", + "inherits": ["common"], + "cacheVariables": { + "CMAKE_SYSTEM_NAME": "Windows", + "EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/windows.cmake" + }, + "toolset": "ClangCL", + "condition": { + "lhs": "${hostSystemName}", + "type": "equals", + "rhs": "Windows" + } + }, { "name": "zephyr", "displayName": "Build ExecuTorch for Zephyr RTOS", diff --git a/tools/cmake/preset/windows.cmake b/tools/cmake/preset/windows.cmake new file mode 100644 index 00000000000..e6be8aa6c3b --- /dev/null +++ b/tools/cmake/preset/windows.cmake @@ -0,0 +1,21 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + + +# keep sorted +set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON) +set_overridable_option(EXECUTORCH_BUILD_EXTENSION_EVALUE_UTIL ON) +set_overridable_option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON) +set_overridable_option(EXECUTORCH_BUILD_EXTENSION_MODULE ON) +set_overridable_option(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL ON) +set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TENSOR ON) + +# Below options are not yet buildable on Windows, but should be. +set(EXECUTORCH_BUILD_PORTABLE_OPS OFF CACHE BOOL "") +#set_overridable_option(EXECUTORCH_BUILD_EXECUTOR_RUNNER ON) +#set_overridable_option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED ON) +#set_overridable_option(EXECUTORCH_BUILD_KERNELS_QUANTIZED ON) +#set_overridable_option(EXECUTORCH_BUILD_XNNPACK ON) From 52b9ff1d73e936a3acf945df865db44741b3644f Mon Sep 17 00:00:00 2001 From: Gregory Comer Date: Sat, 9 Aug 2025 20:12:16 -0700 Subject: [PATCH 2/2] Update [ghstack-poisoned] --- .github/workflows/build-presets.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-presets.yml b/.github/workflows/build-presets.yml index 91c3bb09b23..8cb25c74691 100644 --- a/.github/workflows/build-presets.yml +++ b/.github/workflows/build-presets.yml @@ -6,8 +6,6 @@ on: branches: - main - release/* - paths: - - .github/workflows/build-presets.yml workflow_dispatch: concurrency: @@ -121,14 +119,24 @@ jobs: set -eux conda init powershell powershell -Command "& { + Set-PSDebug -Trace 1 \$ErrorActionPreference = 'Stop' - Set-PSDebug -Trace 2 + \$PSNativeCommandUseErrorActionPreference = \$true conda create --yes --quiet -n et python=3.12 conda activate et python install_requirements.py cmake --preset ${{ matrix.preset }} + if (\$LASTEXITCODE -ne 0) { + Write-Host "CMake configuration was unsuccessful. Exit code: \$LASTEXITCODE." + exit \$LASTEXITCODE + } + \$numCores = [System.Environment]::GetEnvironmentVariable('NUMBER_OF_PROCESSORS') - 1 cmake --build cmake-out -j \$numCores + if (\$LASTEXITCODE -ne 0) { + Write-Host "CMake build was unsuccessful. Exit code: \$LASTEXITCODE." + exit \$LASTEXITCODE + } }"