diff --git a/CMakeLists.txt b/CMakeLists.txt index 00069cb7..80bf90dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,9 @@ set(ENABLE_OPENMP OFF CACHE BOOL "Whether geometric operations will be parallelized using OpenMP") set(ENABLE_LTO OFF CACHE BOOL "Whether interprocedural (global) optimizations are enabled") +option(FORCE_VENDORED_Eigen3 + "Whether we should use our bundled Eigen even in the presence of a system copy" + OFF) set(OPENGL 3 CACHE STRING "OpenGL version to use (one of: 1 3)") @@ -190,6 +193,18 @@ set(MI_BUILD_TESTS OFF CACHE BOOL "") add_subdirectory(extlib/mimalloc EXCLUDE_FROM_ALL) set(MIMALLOC_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extlib/mimalloc/include) +if(NOT FORCE_VENDORED_Eigen3) + find_package(Eigen3 CONFIG) +endif() +if(FORCE_VENDORED_Eigen3 OR NOT EIGEN3_FOUND) + message(STATUS "Using in-tree Eigen") + set(EIGEN3_FOUND YES) + set(EIGEN3_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extlib/eigen) +else() + message(STATUS "Using system Eigen: ${EIGEN3_INCLUDE_DIRS}") +endif() + + if(WIN32 OR APPLE) # On Win32 and macOS we use vendored packages, since there is little to no benefit # to trying to find system versions. In particular, trying to link to libraries from diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 61204575..d812eb76 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,7 +27,8 @@ target_include_directories(slvs_deps INTERFACE SYSTEM ${PNG_PNG_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} ${CAIRO_INCLUDE_DIRS} - ${MIMALLOC_INCLUDE_DIR}) + ${MIMALLOC_INCLUDE_DIR} + ${EIGEN3_INCLUDE_DIRS}) target_link_libraries(slvs_deps INTERFACE dxfrw ${ZLIB_LIBRARY}