46 lines
1.6 KiB
Diff
46 lines
1.6 KiB
Diff
|
From a29cffa646356228d6ec7bd7ce21fe3ab90fdd19 Mon Sep 17 00:00:00 2001
|
||
|
From: Someone Serge <sergei.kozlukov@aalto.fi>
|
||
|
Date: Wed, 7 Feb 2024 16:59:09 +0000
|
||
|
Subject: [PATCH] eigen: allow dependency injection
|
||
|
|
||
|
---
|
||
|
cmake/external/eigen.cmake | 12 +++++++++---
|
||
|
1 file changed, 9 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/cmake/external/eigen.cmake b/cmake/external/eigen.cmake
|
||
|
index c0f7ddc50e..996b83d18a 100644
|
||
|
--- a/cmake/external/eigen.cmake
|
||
|
+++ b/cmake/external/eigen.cmake
|
||
|
@@ -1,4 +1,3 @@
|
||
|
-
|
||
|
if (onnxruntime_USE_PREINSTALLED_EIGEN)
|
||
|
add_library(eigen INTERFACE)
|
||
|
file(TO_CMAKE_PATH ${eigen_SOURCE_PATH} eigen_INCLUDE_DIRS)
|
||
|
@@ -10,14 +9,21 @@ else ()
|
||
|
URL ${DEP_URL_eigen}
|
||
|
URL_HASH SHA1=${DEP_SHA1_eigen}
|
||
|
PATCH_COMMAND ${Patch_EXECUTABLE} --ignore-space-change --ignore-whitespace < ${PROJECT_SOURCE_DIR}/patches/eigen/Fix_Eigen_Build_Break.patch
|
||
|
+ FIND_PACKAGE_ARGS NAMES Eigen3
|
||
|
)
|
||
|
else()
|
||
|
FetchContent_Declare(
|
||
|
eigen
|
||
|
URL ${DEP_URL_eigen}
|
||
|
URL_HASH SHA1=${DEP_SHA1_eigen}
|
||
|
+ FIND_PACKAGE_ARGS NAMES Eigen3
|
||
|
)
|
||
|
endif()
|
||
|
- FetchContent_Populate(eigen)
|
||
|
- set(eigen_INCLUDE_DIRS "${eigen_SOURCE_DIR}")
|
||
|
+ FetchContent_MakeAvailable(eigen)
|
||
|
+ add_library(eigen ALIAS Eigen3::Eigen)
|
||
|
+
|
||
|
+ # Onnxruntime doesn't always use `eigen` as a target in
|
||
|
+ # `target_link_libraries`, sometimes it just uses
|
||
|
+ # `target_include_directories`:
|
||
|
+ get_target_property(eigen_INCLUDE_DIRS Eigen3::Eigen INTERFACE_INCLUDE_DIRECTORIES)
|
||
|
endif()
|
||
|
--
|
||
|
2.42.0
|
||
|
|