Skip to content

Commit 4fc2acc

Browse files
authored
Lower the CMake version floor so 3.26 through 3.28 can build again (pytorch#22570)
### Summary You cannot build ExecuTorch from source unless you have CMake 3.29 or newer. CMake is the tool that drives the build. Every build file can name the oldest CMake it accepts, and if yours is older, CMake stops with an error instead of building. Five files in this repo named 3.29, and none of them uses anything that needs it. This hurts most on small Arm computers such as developer boards. Those ship CMake 3.28, and 3.28 is also the newest their system offers, so you cannot simply upgrade. You have to go and install a second, private copy of CMake before you can build at all. Those five files now name 3.26 instead, so anyone on 3.26 or newer can build. 3.26 rather than something lower, because `kernels/optimized` uses CMake syntax that only exists from 3.26 on Arm builds. Going lower means rewriting that file, which belongs in its own change. The docs and requirement files name a CMake version too, and some of those numbers could never have worked, so they are corrected here: the build requirements said 3.24 and now say 3.26, the WebGPU docs said 3.19 and now say 3.24, and the Supertonic example said 3.24 and now says 3.26. Installing a prebuilt wheel is untouched and still works on CMake 3.19. One more file, `examples/models/phi-3-mini`, named 3.24 and then asked CMake to turn on a behaviour that only exists from 3.27. Asking for a behaviour CMake does not have is a hard error, so that file could never build on the version it advertised. It now asks only when the running CMake has it.
1 parent bf88c64 commit 4fc2acc

13 files changed

Lines changed: 18 additions & 14 deletions

File tree

‎backends/apple/metal/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# ~~~
1515
# It should also be cmake-lint clean.
1616
#
17-
cmake_minimum_required(VERSION 3.29)
17+
cmake_minimum_required(VERSION 3.26)
1818

1919
set(CMAKE_CXX_STANDARD 17)
2020
set(CMAKE_CXX_STANDARD_REQUIRED ON)

‎backends/cuda/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# ~~~
1515
# It should also be cmake-lint clean.
1616
#
17-
cmake_minimum_required(VERSION 3.29)
17+
cmake_minimum_required(VERSION 3.26)
1818

1919
set(CMAKE_CXX_STANDARD 17)
2020
set(CMAKE_CXX_STANDARD_REQUIRED ON)

‎backends/webgpu/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,4 @@ backends/webgpu/
218218
- **Linux:** Vulkan-capable GPU and drivers
219219
- **Browser:** A WebGPU-enabled browser; the benchmark harness uses Chrome
220220
Canary
221-
- **Build:** CMake 3.19+ and a Python environment with ExecuTorch installed
221+
- **Build:** CMake 3.24+ and a Python environment with ExecuTorch installed

‎docs/source/backends/webgpu/webgpu-overview.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ depend on the selected WebGPU adapter.
6868

6969
## Development Requirements
7070

71-
- CMake 3.19 or later.
71+
- CMake 3.24 or later.
7272
- A Python environment with ExecuTorch installed for model export.
7373
- Dawn's CMake package for native builds.
7474
- Emscripten for browser builds.

‎docs/source/llm/run-with-c-plus-plus.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Before you begin, make sure you have:
1212
- For HuggingFace tokenizers, this is a JSON file `tokenizer.json`
1313
- For SentencePiece tokenizers, this is a `tokenizer.model` file and normally lives alongside the weights file
1414
3. CMake and a C++ compiler installed
15-
- CMake version 3.29 or higher
15+
- CMake version 3.26 or higher
1616
- g++ or clang compiler
1717

1818
## Model Metadata

‎docs/source/raspberry_pi_llama_tutorial.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This tutorial demonstrates how to deploy **Llama models on Raspberry Pi 4/5 devi
2121

2222
- **Python 3.10-3.14** (ExecuTorch requirement)
2323
- **conda** or **venv** for environment management
24-
- **CMake 3.29.6+**
24+
- **CMake 3.26+**
2525
- **Git** for repository cloning
2626

2727
### Target Device Requirements
@@ -47,7 +47,7 @@ python3 --version # Should be 3.10-3.14
4747
# Check required tools
4848
hash cmake git md5sum 2>/dev/null || echo "Missing required tools"
4949

50-
cmake --version # Should be 3.29.6+ at minimum
50+
cmake --version # Should be 3.26+ at minimum
5151

5252
## Development Environment Setup
5353

‎examples/models/phi-3-mini/CMakeLists.txt‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
#
1515

1616
cmake_minimum_required(VERSION 3.24)
17-
cmake_policy(SET CMP0144 NEW)
17+
# CMP0144 arrives in 3.27, and cmake_policy(SET) on a policy the running CMake
18+
# does not know is a hard error, so the request has to be guarded.
19+
if(POLICY CMP0144)
20+
cmake_policy(SET CMP0144 NEW)
21+
endif()
1822
project(phi_3_mini_runner)
1923

2024
set(CMAKE_CXX_STANDARD 17)

‎examples/models/supertonic/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ exit cleanly; closing stdin also exits with status zero.
110110
## Platform and model limits
111111

112112
- This workflow requires an Apple silicon Mac, macOS, Xcode command-line
113-
tools, CMake 3.24 or newer, and an ExecuTorch Python environment with the MLX
113+
tools, CMake 3.26 or newer, and an ExecuTorch Python environment with the MLX
114114
backend and custom operations available. The native runner supports only
115115
arm64 Darwin and uses MLX GPU delegation with FP16 activations.
116116
- Exported programs use dynamic sequence lengths, five flow-matching steps,

‎examples/models/whisper/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7-
cmake_minimum_required(VERSION 3.29)
7+
cmake_minimum_required(VERSION 3.26)
88
project(whisper_runner)
99

1010
set(CMAKE_CXX_STANDARD 17)

‎extension/wasm/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# cmake-format -i CMakeLists.txt
1010
# ~~~
1111

12-
cmake_minimum_required(VERSION 3.29)
12+
cmake_minimum_required(VERSION 3.26)
1313

1414
project(executorch_wasm)
1515

0 commit comments

Comments
 (0)