Skip to content

Commit 678b673

Browse files
e-kwsmrwgk
andauthored
build: support Eigen 5 (#6036)
* build: support Eigen 5 fix #6034 * build: probe Eigen 3 and 5 separately in CMake config mode Avoid relying on package-specific handling of a bounded version range when discovering Eigen through Eigen3Config.cmake. Made-with: Cursor * [skip ci] build: clarify Eigen 5 module fallback comment Explain that the MODULE-mode fallback only exists for older Eigen 3 setups so the remaining fallback path does not look like an unresolved Eigen 5 issue. Made-with: Cursor * [skip ci] docs: add Eigen 5 entry to v3.0.4 changelog Document the Eigen 5 CMake package detection fix in the 3.0.4 release notes before merging the PR. Made-with: Cursor --------- Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com> Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
1 parent ae05b15 commit 678b673

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

docs/changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ Internal:
3333

3434
Bug fixes:
3535

36+
- Fixed test builds with installed Eigen 5 by improving `Eigen3` CMake package detection.
37+
[#6036](https://github.com/pybind/pybind11/pull/6036)
38+
3639
- Fixed move semantics of `scoped_ostream_redirect` to preserve buffered output and avoid crashes when moved redirects restore stream buffers.
3740
[#6033](https://github.com/pybind/pybind11/pull/6033)
3841

tests/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,17 @@ if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1)
300300

301301
else()
302302
find_package(Eigen3 3.2.7 QUIET CONFIG)
303+
if(NOT Eigen3_FOUND)
304+
find_package(Eigen3 5 QUIET CONFIG)
305+
endif()
306+
set(EIGEN3_FOUND ${Eigen3_FOUND})
307+
set(EIGEN3_VERSION ${Eigen3_VERSION})
303308

304309
if(NOT EIGEN3_FOUND)
305310
# Couldn't load via target, so fall back to allowing module mode finding, which will pick up
306311
# tools/FindEigen3.cmake
312+
# This MODULE-mode fallback is for older Eigen 3 setups; Eigen 5 is expected to be found
313+
# via the CONFIG-mode probes above.
307314
find_package(Eigen3 3.2.7 QUIET)
308315
endif()
309316
endif()

0 commit comments

Comments
 (0)