Skip to content

Commit 3abc792

Browse files
committed
move OPTIMIZE_SIZE
1 parent c2c9a6b commit 3abc792

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
120120
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
121121
endif()
122122

123-
option(OPTIMIZE_SIZE "Build executorch runtime optimizing for binary size" OFF)
124-
if(OPTIMIZE_SIZE)
123+
if(EXECUTORCH_OPTIMIZE_SIZE)
125124
# -Os: Optimize for size.
126125
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os")
127126
else()

docs/source/using-executorch-building-from-source.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ The release build offers optimizations intended to improve performance and reduc
164164
To further optimize the release build for size, use both:
165165
```bash
166166
-DCMAKE_BUILD_TYPE=Release \
167-
-DOPTIMIZE_SIZE=ON
167+
-DEXECUTORCH_OPTIMIZE_SIZE=ON
168168
```
169169
170170
See [CMakeLists.txt](https://github.com/pytorch/executorch/blob/main/CMakeLists.txt)

test/build_optimized_size_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cmake_install_executorch_lib() {
2727
-DCMAKE_BUILD_TYPE=MinSizeRel \
2828
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
2929
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
30-
-DOPTIMIZE_SIZE=ON \
30+
-DEXECUTORCH_OPTIMIZE_SIZE=ON \
3131
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
3232
-Bcmake-out .
3333
cmake --build cmake-out -j9 --target install --config MinSizeRel

test/build_size_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ cmake_install_executorch_lib() {
2828
-DCMAKE_INSTALL_PREFIX=cmake-out \
2929
-DCMAKE_BUILD_TYPE=Release \
3030
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
31-
-DOPTIMIZE_SIZE=ON \
31+
-DEXECUTORCH_OPTIMIZE_SIZE=ON \
3232
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
3333
${EXTRA_BUILD_ARGS} \
3434
-Bcmake-out .

tools/cmake/preset/default.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ define_overridable_option(
5454
"Build with ET_EVENT_TRACER_ENABLED"
5555
BOOL OFF
5656
)
57+
define_overridable_option(
58+
EXECUTORCH_OPTIMIZE_SIZE
59+
"Build executorch runtime optimizing for binary size"
60+
BOOL OFF
61+
)
5762

5863
# MARK: - Validations
5964
# At this point all the options should be configured with their final value.

0 commit comments

Comments
 (0)