diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 5acedba78c..2b90d495ef 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -8,18 +8,26 @@ else() endif() # Eigen +# We avoid configuring the Eigen library via FetchContent_MakeAvaiable +# to avoid the verbosity of Eigen's CMake configuration output. if(MRTRIX_LOCAL_DEPENDENCIES) set(eigen_url ${MRTRIX_DEPENDENCIES_DIR}/eigen-3.4.0.tar.gz) else() set(eigen_url "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz") endif() -FetchContent_MakeAvailable(eigen3) FetchContent_Declare( eigen3 DOWNLOAD_EXTRACT_TIMESTAMP ON URL ${eigen_url} ) +FetchContent_GetProperties(Eigen3) +if(NOT eigen3_POPULATED) + FetchContent_Populate(Eigen3) + add_library(Eigen3 INTERFACE) + add_library(Eigen3::Eigen ALIAS Eigen3) + target_include_directories(Eigen3 INTERFACE "${eigen3_SOURCE_DIR}") +endif() # Json for Modern C++ if(MRTRIX_LOCAL_DEPENDENCIES) diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt index 0d5e113398..7b778e2bea 100644 --- a/cmd/CMakeLists.txt +++ b/cmd/CMakeLists.txt @@ -9,7 +9,6 @@ if(MRTRIX_USE_PCH) file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pch_cmd.cpp CONTENT "int main(){}") add_executable(pch_cmd ${CMAKE_CURRENT_BINARY_DIR}/pch_cmd.cpp) target_include_directories(pch_cmd PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../core) - find_package(Eigen3 REQUIRED) target_link_libraries(pch_cmd PRIVATE Eigen3::Eigen half::half) target_precompile_headers(pch_cmd PRIVATE [["app.h"]] diff --git a/thirdparty/eigen.patch b/thirdparty/eigen.patch deleted file mode 100644 index f36ddeedbb..0000000000 --- a/thirdparty/eigen.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f3e69b845..f50304eac 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -59,6 +59,7 @@ include(CheckCXXCompilerFlag) - include(GNUInstallDirs) - include(CMakeDependentOption) - -+if(0) - set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) - - -@@ -419,6 +420,7 @@ endif() - set(EIGEN_CUDA_COMPUTE_ARCH 30 CACHE STRING "The CUDA compute architecture level to target when compiling CUDA code") - - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -+endif() - - # Backward compatibility support for EIGEN_INCLUDE_INSTALL_DIR - if(EIGEN_INCLUDE_INSTALL_DIR) -@@ -475,7 +477,7 @@ endif() - - install(DIRECTORY Eigen DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) - -- -+if(0) - option(EIGEN_BUILD_DOC "Enable creation of Eigen documentation" ON) - if(EIGEN_BUILD_DOC) - add_subdirectory(doc EXCLUDE_FROM_ALL) -@@ -532,9 +534,10 @@ if(EIGEN_TEST_SYCL) - add_definitions(-DEIGEN_DONT_VECTORIZE_SYCL=1) - endif() - endif() -+endif() - - add_subdirectory(unsupported) -- -+if(0) - add_subdirectory(demos EXCLUDE_FROM_ALL) - - # must be after test and unsupported, for configuring buildtests.in -@@ -554,11 +557,12 @@ configure_file(scripts/cdashtesting.cmake.in cdashtesting.cmake @ONLY) - if(BUILD_TESTING) - ei_testing_print_summary() - endif() -- -+endif() - message(STATUS "") - message(STATUS "Configured Eigen ${EIGEN_VERSION_NUMBER}") - message(STATUS "") - -+if(0) - string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower) - if(cmake_generator_tolower MATCHES "makefile") - message(STATUS "Available targets (use: make TARGET):") -@@ -586,7 +590,7 @@ message(STATUS "blas | Build BLAS library (not the same thing as Eigen)") - message(STATUS "uninstall| Remove files installed by the install target") - message(STATUS "---------+--------------------------------------------------------------") - message(STATUS "") -- -+endif() - - set ( EIGEN_VERSION_STRING ${EIGEN_VERSION_NUMBER} ) - set ( EIGEN_VERSION_MAJOR ${EIGEN_WORLD_VERSION} )