trunk/bdf94407bfd178ff17a615beb21aa094bcffda71: Move some pre-build steps from setup.py to CMake (#177641)
Modernizing build system with scikit-build-core for easier maintenance...
PyTorch has made a significant infrastructure update by migrating pre-build steps from setup.py to CMake. PR #177641 introduces `cmake/PreBuildSteps.cmake`, which now handles git submodule initialization, replacing the equivalent `check_submodules()` function previously in setup.py. This change is part of a larger initiative to replace the old setuptools-based build system with scikit-build-core, as described in issue #157807, aiming for a more modern and maintainable build pipeline.
The new CMake module parses `.gitmodules` to discover submodule paths, verifies they are populated, and runs `git submodule update --init --recursive` if needed. It also validates that expected marker files exist to catch corrupt or partial checkouts, and checks fbgemm's nested asmjit dependency. The PR was co-generated with Claude Code and approved by PyTorch maintainers atalman, albanD, and nWEIdia, marking a step toward a cleaner, more modular build system.
- Moves git submodule initialization from setup.py to CMake via new `cmake/PreBuildSteps.cmake`
- Part of replacing setuptools-based build with scikit-build-core (issue #157807)
- Validates marker files and checks fbgemm's nested asmjit dependency for corrupt checkouts
Why It Matters
Modernizes PyTorch's build system for easier maintenance and future scalability.