-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eigen can be built via FetchContent + bumped built version to 3.4.0
eigen search order changed: - first module is used - then config file is sought - lastly fetchcontent is used
- Loading branch information
Showing
5 changed files
with
79 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# provides Eigen3::Eigen target, by looking for it, or building it (via FetchContent) | ||
|
||
# if CUDA is enabled (assuming CUDA version is 9 or 10) need Eigen 3.3.7 | ||
# see https://gitlab.com/libeigen/eigen/issues/1491 | ||
if (ENABLE_CUDA) | ||
set(_tiledarray_required_eigen_version 3.3.7) | ||
else(ENABLE_CUDA) | ||
set(_tiledarray_required_eigen_version ${TA_TRACKED_EIGEN_VERSION}) | ||
endif(ENABLE_CUDA) | ||
|
||
if (NOT TARGET Eigen3::Eigen) | ||
include(FindPackageRegimport) | ||
# re:NO_CMAKE_PACKAGE_REGISTRY: eigen3 registers its *build* tree with the user package registry ... | ||
# to avoid issues with wiped build directory look for installed eigen | ||
find_package_regimport(Eigen3 ${_tiledarray_required_eigen_version} NO_MODULE NO_CMAKE_PACKAGE_REGISTRY) | ||
if (TARGET Eigen3::Eigen) | ||
message(STATUS "Found Eigen3 ${Eigen3_VERSION} via ${Eigen3_CONFIG}") | ||
endif(TARGET Eigen3::Eigen) | ||
endif (NOT TARGET Eigen3::Eigen) | ||
|
||
# if not found, build via FetchContent | ||
if (NOT TARGET Eigen3::Eigen) | ||
include (FetchContent) | ||
cmake_minimum_required (VERSION 3.14.0) # for FetchContent_MakeAvailable | ||
|
||
set(EIGEN3_URL_HASH ${TA_INSTALL_EIGEN_URL_HASH}) | ||
set(EIGEN3_URL https://gitlab.com/libeigen/eigen/-/archive/${TA_INSTALL_EIGEN_VERSION}/eigen-${TA_INSTALL_EIGEN_VERSION}.tar.bz2) | ||
|
||
FetchContent_Declare( | ||
eigen3 | ||
URL ${EIGEN3_URL} | ||
URL_HASH ${EIGEN3_URL_HASH} | ||
) | ||
FetchContent_MakeAvailable(eigen3) | ||
FetchContent_GetProperties(eigen3 | ||
SOURCE_DIR eigen3_SOURCE_DIR | ||
BINARY_DIR eigen3_BINARY_DIR | ||
) | ||
|
||
set(Eigen3_CONFIG ${CMAKE_INSTALL_PREFIX}/share/eigen3/cmake/Eigen3Config.cmake) | ||
|
||
endif(NOT TARGET Eigen3::Eigen) | ||
|
||
# postcond check | ||
if (NOT TARGET Eigen3::Eigen) | ||
message(FATAL_ERROR "FindOrFetchEigen3 could not make Eigen3::Eigen target available") | ||
endif(NOT TARGET Eigen3::Eigen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters