Skip to content

Enforce required cmake flags as explicit requirements #11457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2025

Conversation

jathu
Copy link
Contributor

@jathu jathu commented Jun 6, 2025

Summary

The build file currently turns on a bunch of implicitly dependent flags, perhaps unnecessarily. Let's make these dependencies explicit now.

For example, previously if EXECUTORCH_BUILD_EXTENSION_TRAINING was turned on, it would then turn on its own set of dependencies. This is good from a developer experience point of view because users would need to just turn on one flag. However, from a build point of view, it makes it harder to maintain and understand what flags are conflicting with one another. Now, if you want to build the training extension, you will have to explicitly turn on the required flags. However, with our build presets — most developers should not have to do to this!

I have created a follow up ticket to actually comb through the existing flags and trim the fat if necessary: #11458

Test plan

CI

cc @larryliu0820

@jathu jathu added module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch ciflow/trunk ciflow/binaries release notes: none Do not include this in the release notes labels Jun 6, 2025
Copy link

pytorch-bot bot commented Jun 6, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11457

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 1 Pending

As of commit 16b18b2 with merge base 8f05c35 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-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 Jun 6, 2025
@jathu jathu changed the title ✨ Simplify CMake build configuration and validation logic. Enforce required cmake flags as explicit requirements Jun 6, 2025
@jathu jathu force-pushed the jathu/cmake-explicit-flag-requires branch from e3fba22 to 60fa340 Compare June 6, 2025 20:41
@jathu jathu force-pushed the jathu/cmake-explicit-flag-requires branch from 60fa340 to 469e165 Compare June 6, 2025 21:03
@jathu jathu force-pushed the jathu/cmake-required-flags branch from 28bcb5d to e8aec99 Compare June 6, 2025 21:11
@jathu jathu force-pushed the jathu/cmake-explicit-flag-requires branch 2 times, most recently from ac1180e to e23f1cc Compare June 6, 2025 21:24
@jathu jathu marked this pull request as ready for review June 6, 2025 21:33
@jathu jathu force-pushed the jathu/cmake-explicit-flag-requires branch from e23f1cc to 9e19d27 Compare June 6, 2025 21:40
@jathu jathu force-pushed the jathu/cmake-explicit-flag-requires branch from 9e19d27 to 02e8f57 Compare June 6, 2025 21:57
jathu added a commit that referenced this pull request Jun 6, 2025
### Summary

Some flags require other flags to also be turned on. So this function
helps use enforce it.

### Test plan

Used in: #11457

```
$ python -m unittest tools.cmake.common.preset_test.TestPreset
```


cc @larryliu0820
Base automatically changed from jathu/cmake-required-flags to main June 6, 2025 21:59
@jathu jathu force-pushed the jathu/cmake-explicit-flag-requires branch 3 times, most recently from ce72c8c to 86602c7 Compare June 6, 2025 23:26
@jathu jathu force-pushed the jathu/cmake-explicit-flag-requires branch from 86602c7 to d189a21 Compare June 6, 2025 23:35
@jathu jathu force-pushed the jathu/cmake-explicit-flag-requires branch from d189a21 to 16b18b2 Compare June 9, 2025 15:47
@jathu jathu merged commit 611092d into main Jun 9, 2025
300 of 301 checks passed
@jathu jathu deleted the jathu/cmake-explicit-flag-requires branch June 9, 2025 17:31
jathu added a commit that referenced this pull request Jun 10, 2025
### Summary

Similar to #11457, but now we
also want to warn against unsupported/conflicting flags. For example,
when using `EXECUTORCH_BUILD_ARM_BAREMETAL`, we cannot enable certain
flags.

### Test plan

CI

```
$ cmake -DEXECUTORCH_BUILD_ARM_BAREMETAL=ON --preset macos

CMake Error at tools/cmake/common/preset.cmake:142 (message):
  Both 'EXECUTORCH_BUILD_ARM_BAREMETAL' and
  'EXECUTORCH_BUILD_EXTENSION_DATA_LOADER' can't be ON
Call Stack (most recent call first):
  tools/cmake/preset/default.cmake:352 (check_conflicting_options_on)
  CMakeLists.txt:87 (include)
```

cc @larryliu0820 @digantdesai @freddan80 @per @zingo @oscarandersson8218
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/binaries ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch release notes: none Do not include this in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants