Skip CMake configure when build directory already exists#17643
Skip CMake configure when build directory already exists#17643kirklandsign wants to merge 1 commit intomainfrom
Conversation
Check for CMakeCache.txt before running cmake configure. If the build directory is already configured, go straight to cmake --build, which auto-reconfigures when CMakeLists.txt files change. Saves ~37s per ABI on incremental builds. To force a full reconfigure, delete the cmake-out-android-* directories.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17643
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New Failures, 1 Unrelated FailureAs of commit 0950708 with merge base bf0cd1c ( NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
Updates the Android native build script to avoid re-running CMake configure when an existing build directory is already configured, improving incremental build times for repeated ABI builds.
Changes:
- Add a
CMakeCache.txtexistence check to skipcmakeconfigure on subsequent runs. - Proceed directly to
cmake --buildwhen the build directory appears configured.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if [ ! -f "${CMAKE_OUT}/CMakeCache.txt" ]; then | ||
| cmake . -DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \ | ||
| -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \ | ||
| --preset "android-${ANDROID_ABI}" \ | ||
| -DANDROID_PLATFORM=android-26 \ |
There was a problem hiding this comment.
Skipping the configure step based solely on CMakeCache.txt means changes to any of the -D options passed here (e.g., EXECUTORCH_BUILD_QNN/NEURON/VULKAN, CMAKE_BUILD_TYPE) will be silently ignored on subsequent runs; cmake --build will not update cached values unless a configure is re-run. Consider re-running configure when key cache entries don’t match the current env (at minimum CMAKE_BUILD_TYPE), or add a supported override (e.g., EXECUTORCH_FORCE_CMAKE_CONFIGURE=1) to force configure without requiring users to delete the build directory.
Summary
Check for CMakeCache.txt before running cmake configure. If the build directory is already configured, go straight to cmake --build, which auto-reconfigures when CMakeLists.txt files change. Saves ~37s per ABI on incremental builds. To force a full reconfigure, delete the cmake-out-android-* directories.
Test plan
CI