Skip to content

Skip CMake configure when build directory already exists#17643

Open
kirklandsign wants to merge 1 commit intomainfrom
android/skip-redundant-cmake-configure
Open

Skip CMake configure when build directory already exists#17643
kirklandsign wants to merge 1 commit intomainfrom
android/skip-redundant-cmake-configure

Conversation

@kirklandsign
Copy link
Contributor

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

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.
@pytorch-bot
Copy link

pytorch-bot bot commented Feb 23, 2026

🔗 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 Failure

As of commit 0950708 with merge base bf0cd1c (image):

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.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 23, 2026
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@kirklandsign kirklandsign marked this pull request as ready for review February 23, 2026 23:34
Copilot AI review requested due to automatic review settings February 23, 2026 23:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.txt existence check to skip cmake configure on subsequent runs.
  • Proceed directly to cmake --build when the build directory appears configured.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +38 to +42
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 \
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants