-
-
Notifications
You must be signed in to change notification settings - Fork 686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Update external Eigen from release 3.4 to master #4265
ENH: Update external Eigen from release 3.4 to master #4265
Conversation
Test is passing. The failure in Windows is unrelated, it was failing for other PR's as well. |
Thanks @phcerdan but would it still be an option to use a tagged revision of Eigen? Looks like 3.4.1 is quite a recent version: https://gitlab.com/libeigen/eigen/-/commits/3.4.1 Oh, now I see, 3.4.1 is just a branch, not (yet?) a tag. |
bec339e
to
f1c48dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
@jcfr may have suggestions on how to make the mangling name configurable |
a65b145
to
897dd81
Compare
@jcfr happy to hear suggestions for making the mangling name configurable. If you can provide a link to some existing CMake project with the options, I can copy it here. This PR introduces a BOOL variable ITK_EIGEN_MANGLE, and if that's defined, we mangle with |
See this relevant comment: Associated discussion for generalizing the support currently specific to Slicer12 is discussed in https://discourse.itk.org/t/adding-support-for-customizing-itk-namespace/5170 Footnotes
|
I am not sure we want a CMake option to control this as we will always want the function name to be mangled if building against the version bundled in ITK. |
Not mangling Eigen was proposed to facilitate external ITK modules (see ITKTotalVariation for example) using third-party libraries (libproxTV) that use Eigen to not having to fork the proxTV library and replace all However, I understand mangling is better for the general case, and we should turn it ON by default. But I would appreciate if we keep the option to turn it off, to reuse the internal Eigen on those external modules that use it.
Thanks for the links, amazing work! |
I also suggest to split this pull request and contribute the support for disabling the mangling of the Eigen include directory into its own pull request. |
I indeed remember the time we worked on this together. If I recall it is available at https://github.com/phcerdan/proxTV/commits/use_eigen For reference, see also https://github.com/InsightSoftwareConsortium/ITKTotalVariation/blob/master/CMakeLists.txt |
@phcerdan and I reviewed this pull request and concluded that updating Eigen without adding extra logic for namespacing was a sensible first step. Approach for supporting including multiple Eigen "header only" library in one project will be evaluated and discussed later. |
897dd81
to
784b49c
Compare
Accommodating @jcfr suggestions.
784b49c
to
ab7350c
Compare
Code extracted from: https://github.com/InsightSoftwareConsortium/eigen at commit 2a86e97ca9f0213df35bcaa7d7c3315ae5aa9ab9 (for/itk-20231108-master-4d54c43d).
# By Eigen Upstream * upstream-Eigen3: Eigen3 2023-11-08 (2a86e97c)
ab7350c
to
d83d0e1
Compare
Tested against current ITKTotalVariation external module, which uses the internal ITK eigen, and all green. |
Not in a hurry, but could we move forward with this? I integrated all the suggestions from @jcfr. Wrapping the "mangling" conversation. (Note, mangling refers to symbols, there are no symbols in a header-only library). Our protection is changing the name (the path) of the eigen files. If a third party linking to ITK uses Eigen, the standard procedure, as with many other dependencies is to use their own Eigen and share it with ITK (ITK_USE_SYSTEM_EIGEN), and with their software. Or, which I think is great, reuse the internal Eigen from ITK and use that for their own library without the need of using any ITK macro. See ITKTotalVariation for that: https://github.com/InsightSoftwareConsortium/ITKTotalVariation/blob/b615ce13394fb5fb16bf8abc2390f5dab73ac27e/CMakeLists.txt if(NOT ITK_USE_SYSTEM_EIGEN)
# Set Eigen3_DIR to the internal Eigen3 used in ITK
set(Eigen3_DIR "${ITKInternalEigen3_DIR}")
message(STATUS "ITKTotalVariation: Using internal ITK Eigen Config found in: ${Eigen3_DIR}")
endif()
find_package(Eigen3 REQUIRED)
set(${PROJECT_NAME}_EXPORT_CODE_INSTALL
"${${PROJECT_NAME}_EXPORT_CODE_INSTALL}
set(Eigen3_DIR \"${Eigen3_DIR}\")
find_package(Eigen3 REQUIRED CONFIG)
")
set(${PROJECT_NAME}_EXPORT_CODE_BUILD
"${${PROJECT_NAME}_EXPORT_CODE_BUILD}
if(NOT ITK_BINARY_DIR)
set(Eigen3_DIR \"${Eigen3_DIR}\")
find_package(Eigen3 REQUIRED CONFIG)
endif()
") |
@jcfr Review/merge? |
5622705
to
67e2513
Compare
Conditionally pass CMAKE_SH if CMAKE_VERSION is less than 3.17.0 Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
67e2513
to
f79ec64
Compare
This is ready, all @jcfr suggestions have been integrated (thanks!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💖
5d494b0
into
InsightSoftwareConsortium:master
ENH: Update Eigen from 3.4 to master