Skip to content

Commit

Permalink
Avoid configuring Eigen via FetchContent_MakeAvaiable
Browse files Browse the repository at this point in the history
Eigen's configuration script is really verbose and we don't need its
output when configuring MRtrix3 as it's just a header only library.
This also allows to get rid of the custom patch to fix this problem.
  • Loading branch information
daljit46 committed Jul 12, 2024
1 parent 9ec0756 commit 61d3d67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 66 deletions.
10 changes: 9 additions & 1 deletion cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"]]
Expand Down
64 changes: 0 additions & 64 deletions thirdparty/eigen.patch

This file was deleted.

0 comments on commit 61d3d67

Please sign in to comment.