Create a helper to define overridable configs (#10731)
### Summary Context: https://github.com/pytorch/executorch/discussions/10661. As part https://github.com/pytorch/executorch/issues/10716, this creates a helper to define ET configs. #### Why define_overridable_config? This is a simple wrapper to configure an option via the user or fallback to a default value. Instead of having people do this manually, this is convenient and consistent. More specifically: - If the option is set via the CLI or `set`, then save that value in the cache — with our own description - If the option is unset, then fallback to the default value The user options will be loaded *before* loading the `default.cmake` file. This means, when we load the default file, we can use the user set options or fallback on defaults. Then finally we can do a final sweet of option validations. After this point, all options will be frozen and immutable. Moreover, having a helper function will allow us to enforce standards on options. For example, naming standards done in this PR. #### Migration plan For now, I've only migrated a simple option `EXECUTORCH_ENABLE_LOGGING`. We'll incrementally migrate remaining options in future PRs. ### Test plan For changes to `EXECUTORCH_ENABLE_LOGGING`, I changed the release modes and checked the finaly `CMakeCache.txt` file. Rely on CI for full tests. For python tests: ``` $ python3 -m unittest discover -s tools/cmake -p "*.py" ``` I will include this test in CI in the next diff.
J
jathu committed
c837925aa2f82573a3b8be17845e400926454dc6
Parent: ee6cf99
Committed by GitHub <noreply@github.com>
on 5/7/2025, 7:52:14 PM