Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 2 additions & 6 deletions Modules/ThirdParty/Eigen3/UpdateFromUpstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ shopt -s dotglob

readonly name="Eigen3"
readonly ownership="Eigen Upstream <kwrobot@kitware.com>"
# ITK has applied a small number of post-import patches under itkeigen/
# (e.g., SelfadjointMatrixVector.h pzero init), so the tree no longer
# bytewise matches the previous import commit's tree. Use log-based
# matching instead of exact-tree matching for the previous-import probe.
exact_tree_match=false
readonly subtree="Modules/ThirdParty/Eigen3/src/itkeigen"
readonly exact_tree_match=false
readonly repo="https://github.com/InsightSoftwareConsortium/eigen"
readonly tag="for/itk-20260501-879885e1"
readonly tag="for/itk-5.0.1-v3"
readonly paths="
Eigen/AccelerateSupport
Eigen/Cholesky
Expand Down
2 changes: 0 additions & 2 deletions Modules/ThirdParty/Eigen3/src/itkeigen/.gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
debug/msvc/*.dat eol=crlf
debug/msvc/*.natvis eol=crlf

# ITK fork: relax content-checks for the largest Eigen header so
# UpdateFromUpstream.sh / KWStyle hooks do not reject the import.
* -whitespace
Eigen/src/misc/lapacke.h hooks-max-size=1500000
Eigen/src/misc/lapacke.h hooks.MaxObjectKiB=2048
146 changes: 36 additions & 110 deletions Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ project(Eigen3)
# ITK doesn't compile anything here, just generates targets for the INTERFACE library.
#[[ # ITK - START DISABLE UPSTREAM EIGEN LOGIC

cmake_minimum_required(VERSION 3.10.0)

#==============================================================================
# CMake Policy issues.
#==============================================================================
Expand Down Expand Up @@ -42,17 +40,10 @@ if (POLICY CMP0177)
cmake_policy(SET CMP0177 NEW)
endif ()

# Respect <PackageName>_ROOT variables.
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif ()

#==============================================================================
# CMake Project.
#==============================================================================

project(Eigen3)

# Remove this block after bumping CMake to v3.21.0
# PROJECT_IS_TOP_LEVEL is defined then by default
if(CMAKE_VERSION VERSION_LESS 3.21.0)
Expand Down Expand Up @@ -82,6 +73,8 @@ if (EIGEN_BUILD_BLAS OR EIGEN_BUILD_LAPACK)
endif()
endif()

option(EIGEN_BUILD_BTL "Build benchmark suite" OFF)
option(EIGEN_BUILD_SPBENCH "Build sparse benchmark suite" OFF)
# Avoid building docs if included from another project.
# Building documentation requires creating and running executables on the host
# platform. We shouldn't do this if cross-compiling.
Expand All @@ -98,7 +91,7 @@ if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
endif()
option(EIGEN_BUILD_CMAKE_PACKAGE "Enables the creation of EigenConfig.cmake and related files" ${PROJECT_IS_TOP_LEVEL})

if (EIGEN_BUILD_TESTING OR EIGEN_BUILD_BLAS OR EIGEN_BUILD_LAPACK OR EIGEN_BUILD_DOC OR EIGEN_BUILD_DEMOS)
if (EIGEN_BUILD_TESTING OR EIGEN_BUILD_BLAS OR EIGEN_BUILD_LAPACK OR EIGEN_BUILT_BTL OR EIGEN_BUILD_BTL OR EIGEN_BUILD_SPBENCH OR EIGEN_BUILD_DOC OR EIGEN_BUILD_DEMOS)
set(EIGEN_IS_BUILDING_ ON)
endif()

Expand All @@ -111,19 +104,19 @@ endif()
file(READ "${PROJECT_SOURCE_DIR}/Eigen/Version" _eigen_version_header)
if (NOT DEFINED EIGEN_WORLD_VERSION)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}")
set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}" CACHE STRING "")
set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}")
endif()
if (NOT DEFINED EIGEN_MAJOR_VERSION)
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}")
set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}" CACHE STRING "")
set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}")
endif()
if (NOT DEFINED EIGEN_MINOR_VERSION)
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}")
set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}" CACHE STRING "")
set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}")
endif()
if (NOT DEFINED EIGEN_PATCH_VERSION)
string(REGEX MATCH "define[ \t]+EIGEN_PATCH_VERSION[ \t]+([0-9]+)" _eigen_patch_version_match "${_eigen_version_header}")
set(EIGEN_PATCH_VERSION "${CMAKE_MATCH_1}" CACHE STRING "")
set(EIGEN_PATCH_VERSION "${CMAKE_MATCH_1}")
endif()
if (NOT DEFINED EIGEN_PRERELEASE_VERSION)
set(EIGEN_PRERELEASE_VERSION "dev")
Expand All @@ -145,18 +138,18 @@ endif()
if (NOT DEFINED EIGEN_BUILD_VERSION AND DEFINED EIGEN_GIT_REVNUM)
string(SUBSTRING "${EIGEN_GIT_REVNUM}" 0 8 EIGEN_BUILD_VERSION)
else()
set(EIGEN_BUILD_VERSION "" CACHE STRING "")
set(EIGEN_BUILD_VERSION "")
endif()

# The EIGEN_VERSION_NUMBER must be of the form <major.minor.patch>.
# The EIGEN_VERSION_STRING can contain the preprelease/build strings.
set(EIGEN_VERSION_NUMBER "${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}.${EIGEN_PATCH_VERSION}" CACHE STRING "")
set(EIGEN_VERSION_STRING "${EIGEN_VERSION_NUMBER}" CACHE STRING "")
set(EIGEN_VERSION_NUMBER "${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}.${EIGEN_PATCH_VERSION}")
set(EIGEN_VERSION_STRING "${EIGEN_VERSION_NUMBER}")
if (NOT "x${EIGEN_PRERELEASE_VERSION}" STREQUAL "x")
set(EIGEN_VERSION_STRING "${EIGEN_VERSION_STRING}-${EIGEN_PRERELEASE_VERSION}" CACHE STRING "")
set(EIGEN_VERSION_STRING "${EIGEN_VERSION_STRING}-${EIGEN_PRERELEASE_VERSION}")
endif()
if (NOT "x${EIGEN_BUILD_VERSION}" STREQUAL "x")
set(EIGEN_VERSION_STRING "${EIGEN_VERSION_STRING}+${EIGEN_BUILD_VERSION}" CACHE STRING "")
set(EIGEN_VERSION_STRING "${EIGEN_VERSION_STRING}+${EIGEN_BUILD_VERSION}")
endif()


Expand Down Expand Up @@ -316,29 +309,17 @@ if (EIGEN_IS_BUILDING_)
set(CMAKE_INCLUDE_CURRENT_DIR OFF)

find_package(StandardMathLibrary)
find_package(AOCL QUIET)
set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "")
if(AOCL_FOUND)
list(APPEND EIGEN_STANDARD_LIBRARIES_TO_LINK_TO ${AOCL_LIBRARIES})
if(AOCL_INCLUDE_DIRS)
include_directories(${AOCL_INCLUDE_DIRS})
endif()
endif()

if(NOT STANDARD_MATH_LIBRARY_FOUND)
message(FATAL_ERROR
"Can't link to the standard math library. Please report to the Eigen developers, telling them about your platform.")
message(FATAL_ERROR
"Can't link to the standard math library. Please report to the Eigen developers, telling them about your platform.")
else()
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${STANDARD_MATH_LIBRARY}")
else()
set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${STANDARD_MATH_LIBRARY}")
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${STANDARD_MATH_LIBRARY}")
else()
set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${STANDARD_MATH_LIBRARY}")
endif()
endif()
# Clean up any leading/trailing whitespace in the variable to avoid CMP0004 errors
string(STRIP "${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}" EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
endif()


if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
message(STATUS "Standard libraries to link to explicitly: ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}")
else()
Expand Down Expand Up @@ -415,16 +396,13 @@ if (EIGEN_BUILD_TESTING)
ei_add_cxx_compiler_flag("-Wshorten-64-to-32")
ei_add_cxx_compiler_flag("-Wlogical-op")
ei_add_cxx_compiler_flag("-Wenum-conversion")
ei_add_cxx_compiler_flag("-Werror=deprecated-anon-enum-enum-conversion")
ei_add_cxx_compiler_flag("-Werror=deprecated-enum-enum-conversion")
ei_add_cxx_compiler_flag("-Wc++11-extensions")
ei_add_cxx_compiler_flag("-Wdouble-promotion")
# ei_add_cxx_compiler_flag("-Wconversion")
ei_add_cxx_compiler_flag("-Wshadow")
ei_add_cxx_compiler_flag("-Wno-psabi")
ei_add_cxx_compiler_flag("-Wno-variadic-macros")
ei_add_cxx_compiler_flag("-Wno-long-long")
ei_add_cxx_compiler_flag("-Wno-pass-failed") # disable clang's warning for unrolling when the loop count is dynamic.
ei_add_cxx_compiler_flag("-fno-common")
ei_add_cxx_compiler_flag("-fstrict-aliasing")
ei_add_cxx_compiler_flag("-wd981") # disable ICC's "operands are evaluated in unspecified order" remark
Expand All @@ -435,17 +413,6 @@ if (EIGEN_BUILD_TESTING)
ei_add_cxx_compiler_flag("-fno-check-new")
endif()

# GCC 12+ emits false-positive -Warray-bounds, -Wmaybe-uninitialized,
# -Wstringop-overread, and -Wnonnull warnings at -O2/-O3 in heavily
# templated code with mixed static/dynamic sizes. These are well-known
# compiler bugs (see GCC PR 109394, 106247, 105329, 98610, among others).
if (CMAKE_COMPILER_IS_GNUCXX)
ei_add_cxx_compiler_flag("-Wno-array-bounds")
ei_add_cxx_compiler_flag("-Wno-maybe-uninitialized")
ei_add_cxx_compiler_flag("-Wno-stringop-overread")
ei_add_cxx_compiler_flag("-Wno-nonnull")
endif()


if(ANDROID_NDK)
ei_add_cxx_compiler_flag("-pie")
Expand Down Expand Up @@ -682,7 +649,7 @@ if (EIGEN_BUILD_TESTING)
endif()

set(EIGEN_CUDA_CXX_FLAGS "" CACHE STRING "Additional flags to pass to the cuda compiler.")
set(EIGEN_CUDA_COMPUTE_ARCH 70 CACHE STRING "The CUDA compute architecture(s) to target when compiling CUDA code")
set(EIGEN_CUDA_COMPUTE_ARCH 30 CACHE STRING "The CUDA compute architecture(s) to target when compiling CUDA code")

option(EIGEN_TEST_SYCL "Add Sycl support." OFF)
if(EIGEN_TEST_SYCL)
Expand Down Expand Up @@ -772,6 +739,15 @@ if(EIGEN_BUILD_DOC)
add_subdirectory(doc EXCLUDE_FROM_ALL)
endif()

# TODO: consider also replacing EIGEN_BUILD_BTL by a custom target "make btl"?
if(EIGEN_BUILD_BTL)
add_subdirectory(bench/btl EXCLUDE_FROM_ALL)
endif()

if(NOT WIN32 AND EIGEN_BUILD_SPBENCH)
add_subdirectory(bench/spbench EXCLUDE_FROM_ALL)
endif()

if (EIGEN_BUILD_DEMOS)
add_subdirectory(demos EXCLUDE_FROM_ALL)
endif()
Expand Down Expand Up @@ -827,7 +803,6 @@ endif()
message(STATUS "")
message(STATUS "Configured Eigen ${EIGEN_VERSION_STRING}")
message(STATUS "")

#]] # ITK -STOP DISABLE UPSTREAM EIGEN LOGIC

###############################################################################
Expand All @@ -849,33 +824,15 @@ include(GNUInstallDirs)
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
set(CMAKEPACKAGE_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}")

# Automatically parse the version number.
# Eigen 5+ moved the version macros from Eigen/src/Core/util/Macros.h to
# Eigen/Version, and switched to semantic versioning. EIGEN_WORLD_VERSION
# is now permanently "3" (legacy "Eigen3" name); EIGEN_MAJOR_VERSION /
# EIGEN_MINOR_VERSION / EIGEN_PATCH_VERSION carry the real semver triple.
# Build EIGEN_VERSION_NUMBER as MAJOR.MINOR.PATCH so that
# find_package(Eigen3 X.Y.Z) and Eigen3_VERSION reflect the real version.
if(EXISTS "${PROJECT_SOURCE_DIR}/Eigen/Version")
file(READ "${PROJECT_SOURCE_DIR}/Eigen/Version" _eigen_version_header)
else()
file(READ "${PROJECT_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen_version_header)
endif()
# automatically parse the version number
file(READ "${PROJECT_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}")
set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}")
set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}")
set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_PATCH_VERSION[ \t]+([0-9]+)" _eigen_patch_version_match "${_eigen_version_header}")
set(EIGEN_PATCH_VERSION "${CMAKE_MATCH_1}")
if(EIGEN_WORLD_VERSION STREQUAL "3" AND EIGEN_PATCH_VERSION)
# Eigen >= 5.0: WORLD frozen at 3, real version is MAJOR.MINOR.PATCH.
set(EIGEN_VERSION_NUMBER ${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}.${EIGEN_PATCH_VERSION})
else()
# Eigen <= 3.4.x: legacy WORLD.MAJOR.MINOR layout.
set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})
endif()
set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})

include (CMakePackageConfigHelpers)

Expand Down Expand Up @@ -935,7 +892,7 @@ install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake
# Install files (used for both eigen_external and eigen_internal)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Eigen/"
DESTINATION "${INCLUDE_INSTALL_DIR}/itkeigen/Eigen"
DESTINATION "${ITK3P_INSTALL_INCLUDE_DIR}/itkeigen/Eigen"
PATTERN "*.txt" EXCLUDE)

######################### eigen_internal #####################################
Expand All @@ -949,7 +906,6 @@ add_library (ITKInternalEigen3::Eigen ALIAS eigen_internal)
# This would wrongly enforce EIGEN_MPL2_ONLY to other libraries using Eigen.
# We wrap this definition in ITK_USE_EIGEN_MPL2_ONLY, and only enabling it internally in the dashboards and CI,
# to avoid introducing GPL code from Eigen3 internally in ITK.
# (ITK_USE_EIGEN_MPL2_ONLY is declared once near line 844 of this file.)

if(ITK_USE_EIGEN_MPL2_ONLY)
target_compile_definitions (eigen_internal INTERFACE "EIGEN_MPL2_ONLY")
Expand All @@ -959,40 +915,10 @@ endif()
# #include <itkeigen/Eigen/x>
# INSTALL: headers require pre-prend itkeigen/Eigen/X.
target_include_directories (eigen_internal SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${ITK3P_INSTALL_INCLUDE_DIR}/itkeigen>;"
)

# Export as title case Eigen
set_target_properties (eigen_internal PROPERTIES EXPORT_NAME Eigen)
install (TARGETS eigen_internal EXPORT ITKInternalEigen3Targets)
install (TARGETS eigen_internal EXPORT ${ITK3P_INSTALL_EXPORT_NAME})

set(EIGEN3_TARGETS_FILE ITKInternalEigen3Targets.cmake)
configure_package_config_file (
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/ITKInternalEigen3Config.cmake
INSTALL_DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}
NO_CHECK_REQUIRED_COMPONENTS_MACRO # Eigen does not provide components
)
# Remove CMAKE_SIZEOF_VOID_P from Eigen3ConfigVersion.cmake since Eigen does
# not depend on architecture specific settings or libraries. More
# specifically, an Eigen3Config.cmake generated from a 64 bit target can be
# used for 32 bit targets as well (and vice versa).
set (_Eigen3_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
unset (CMAKE_SIZEOF_VOID_P)
write_basic_package_version_file (ITKInternalEigen3ConfigVersion.cmake
VERSION ${EIGEN_VERSION_NUMBER}
COMPATIBILITY SameMajorVersion)
set (CMAKE_SIZEOF_VOID_P ${_Eigen3_CMAKE_SIZEOF_VOID_P})
# The Eigen target will be located in the Eigen3 namespace. Other CMake
# targets can refer to it using Eigen3::Eigen.
export (TARGETS eigen_internal NAMESPACE ITKInternalEigen3:: FILE ITKInternalEigen3Targets.cmake)
install (EXPORT ITKInternalEigen3Targets NAMESPACE ITKInternalEigen3:: DESTINATION ${CMAKEPACKAGE_INSTALL_DIR})
# Files already installed in eigen_external
# install(
# DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Eigen/"
# DESTINATION "${INCLUDE_INSTALL_DIR}/itkeigen/Eigen"
# PATTERN "*.txt" EXCLUDE)
install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/ITKInternalEigen3Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/ITKInternalEigen3ConfigVersion.cmake
DESTINATION ${CMAKEPACKAGE_INSTALL_DIR} )
2 changes: 1 addition & 1 deletion Modules/ThirdParty/Eigen3/src/itkeigen/COPYING.MPL2
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Mozilla Public License Version 2.0
means any form of the work other than Source Code Form.

1.7. "Larger Work"
means a work that combines Covered Software with other material, in
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.

1.8. "License"
Expand Down
18 changes: 5 additions & 13 deletions Modules/ThirdParty/Eigen3/src/itkeigen/COPYING.README
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
Eigen is primarily licensed under the Mozilla Public License 2.0.
See LICENSE, COPYING.MPL2, and these links:
https://www.mozilla.org/MPL/2.0/
https://www.mozilla.org/MPL/2.0/FAQ.html
Eigen is primarily MPL2 licensed. See COPYING.MPL2 and these links:
http://www.mozilla.org/MPL/2.0/
http://www.mozilla.org/MPL/2.0/FAQ.html

Some files contain third-party code under permissive or otherwise
MPL2-compatible licenses, hence the other COPYING.* files here. These
include Apache-2.0, BSD-style notices, the MINPACK license, and the MORSE
CMake module BSD-style notice in cmake/MORSE-Copyright.txt.

Note that some optional external dependencies (e.g. FFTW, MPFR C++)
are distributed under different licenses, including the GPL. Refer to
the individual source files and their respective COPYING files for
details.
Some files contain third-party code under BSD or other MPL2-compatible licenses,
whence the other COPYING.* files here.
2 changes: 2 additions & 0 deletions Modules/ThirdParty/Eigen3/src/itkeigen/Eigen/Cholesky
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "src/Core/util/DisableStupidWarnings.h"

/** \defgroup Cholesky_Module Cholesky module
*
*
*
* This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices.
* Those decompositions are also accessible via the following methods:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* For the sake of completeness, this module also propose the two following classes:
* - class CholmodSimplicialLLT
* - class CholmodSimplicialLDLT
* Note that these classes do not bring any particular advantage compared to the built-in
* Note that these classes does not bring any particular advantage compared to the built-in
* SimplicialLLT and SimplicialLDLT factorization classes.
*
* \code
Expand Down
Loading
Loading