diff --git a/Modules/Core/Common/include/itkSymmetricEigenAnalysis.h b/Modules/Core/Common/include/itkSymmetricEigenAnalysis.h index 4e82879651c..23e5206df20 100644 --- a/Modules/Core/Common/include/itkSymmetricEigenAnalysis.h +++ b/Modules/Core/Common/include/itkSymmetricEigenAnalysis.h @@ -19,8 +19,7 @@ #define itkSymmetricEigenAnalysis_h #include "itkMacro.h" -#include "itk_eigen.h" -#include ITK_EIGEN(Eigenvalues) +#include #include #include // For GetPointerToMatrixData diff --git a/Modules/Registration/Montage/include/itkTileMontage.hxx b/Modules/Registration/Montage/include/itkTileMontage.hxx index dce24ce2ff3..496851368d3 100644 --- a/Modules/Registration/Montage/include/itkTileMontage.hxx +++ b/Modules/Registration/Montage/include/itkTileMontage.hxx @@ -25,8 +25,7 @@ #include "itkThreadPool.h" #include "itkConfigure.h" // for ITK_USE_FFTWF and ITK_USE_FFTWD -#include "itk_eigen.h" -#include ITK_EIGEN(Sparse) +#include #include #include diff --git a/Modules/ThirdParty/Eigen3/src/itk_eigen.h.in b/Modules/ThirdParty/Eigen3/src/itk_eigen.h.in index e4044ab999a..9eb65f01ddc 100644 --- a/Modules/ThirdParty/Eigen3/src/itk_eigen.h.in +++ b/Modules/ThirdParty/Eigen3/src/itk_eigen.h.in @@ -19,7 +19,14 @@ #ifndef itk_eigen_h #define itk_eigen_h -/* Usage: +/* Legacy include shim. New code should write `#include ` + * (or any other Eigen header) directly. The Eigen3::Eigen CMake target, + * which is automatically linked when a module declares ITKEigen3 as a + * dependency in itk-module.cmake, provides the include path and (for + * bundled Eigen) the EIGEN_MPL2_ONLY define and Eigen-specific Clang + * warning suppressions. + * + * Legacy usage: * ITK_EIGEN(Eigenvalues) * If using a Eigen3 header containing non MPL2 code * It would generate errors when using internal Eigen, but not with system Eigen. diff --git a/Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt b/Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt index b3658c338be..32dc6eb748e 100644 --- a/Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt +++ b/Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt @@ -955,14 +955,25 @@ if(ITK_USE_EIGEN_MPL2_ONLY) target_compile_definitions (eigen_internal INTERFACE "EIGEN_MPL2_ONLY") endif() -# BUILD: go one directory before to localize the headers: -# #include -# INSTALL: headers require pre-prend itkeigen/Eigen/X. +# Resolve both #include (preferred, ITKv6 canonical syntax) and +# #include (legacy ITK_EIGEN(x) macro expansion). target_include_directories (eigen_internal SYSTEM INTERFACE + $ $ + $ $ ) +# Eigen headers trip several Clang warnings that don't fire elsewhere in ITK. +target_compile_options (eigen_internal INTERFACE + $<$:-Wno-alloca> + $<$:-Wno-used-but-marked-unused> + $<$:-Wno-unused-template> + $<$:-Wno-missing-noreturn> + $<$:-Wno-zero-as-null-pointer-constant> + $<$:-Wno-deprecated> + ) + # Export as title case Eigen set_target_properties (eigen_internal PROPERTIES EXPORT_NAME Eigen) install (TARGETS eigen_internal EXPORT ITKInternalEigen3Targets)