Commit fb6b5c2
Add system mdspan CMake option (#1403)
Summary:
- Add a `MOMENTUM_USE_SYSTEM_MDSPAN` CMake option, defaulting to `OFF`.
- Use `find_package(mdspan CONFIG REQUIRED)` when that option is enabled.
- Preserve the existing `FetchContent` mdspan path by default for source builds.
## Motivation
Package-manager builds should be able to use the mdspan package supplied by the environment instead of downloading it with CMake `FetchContent`. This keeps conda-forge and similar builds offline-friendly, reproducible, and aligned with their declared dependency graph, while leaving the default source-build path convenient for users who do not already have mdspan installed.
This is needed by the conda-forge packaging flow today: `conda-forge/momentum-feedstock` currently carries a downstream patch to replace the mdspan `FetchContent` block with `find_package(mdspan CONFIG REQUIRED)`:
- conda-forge PR: conda-forge/momentum-feedstock#292
- downstream patch permalink: https://github.com/conda-forge/momentum-feedstock/blob/8abdac65ab4781261eb856bdcb3b2e66e2b09964/recipe/patches/0003-Use-packaged-mdspan.patch
- recipe dependency permalink: https://github.com/conda-forge/momentum-feedstock/blob/8abdac65ab4781261eb856bdcb3b2e66e2b09964/recipe/recipe.yaml
- conda-forge mdspan feedstock: https://github.com/conda-forge/mdspan-feedstock
With this option upstream, conda-forge can eventually drop that downstream patch after a Momentum release and pass `-DMOMENTUM_USE_SYSTEM_MDSPAN=ON` instead.
Pull Request resolved: #1403
Test Plan:
- `git diff --check origin/main..HEAD`
- `pixi run -e py312 cmake -S . -B build/pr-mdspan-off-clean ... -DMOMENTUM_USE_SYSTEM_MDSPAN=OFF`
- `CMAKE_PREFIX_PATH=<conda-forge mdspan prefix> pixi run -e py312 cmake -S . -B build/pr-mdspan-on-clean ... -DMOMENTUM_USE_SYSTEM_MDSPAN=ON`
- `pixi run -e py312 cmake --build build/pr-mdspan-on-clean --target rasterizer -j4`
Reviewed By: jeongseok-meta
Differential Revision: D105652029
fbshipit-source-id: 23d58194b903b164d841e788c25e0a698f5b27391 parent 2366d7c commit fb6b5c2
1 file changed
Lines changed: 16 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
146 | 151 | | |
147 | 152 | | |
148 | 153 | | |
| |||
0 commit comments