Fix DLL builds and c++ lapack declarations.

This commit is contained in:
Antonio Sánchez
2025-10-13 16:25:08 +00:00
committed by Rasmus Munk Larsen
parent 3abaabb999
commit e1f1a608be
14 changed files with 725 additions and 123 deletions

View File

@@ -22,9 +22,11 @@ add_custom_target(lapack)
include_directories(../blas)
set(EigenLapack_SRCS
dsecnd_INT_CPU_TIME.cpp second_INT_CPU_TIME.cpp single.cpp double.cpp complex_single.cpp complex_double.cpp ../blas/xerbla.cpp
dsecnd_INT_CPU_TIME.cpp second_INT_CPU_TIME.cpp single.cpp double.cpp complex_single.cpp complex_double.cpp
)
set(EIGEN_LAPACK_DEF "eigen_lapack_cpp.def")
if(EIGEN_Fortran_COMPILER_WORKS)
set(EigenLapack_SRCS ${EigenLapack_SRCS}
@@ -40,6 +42,8 @@ set(EigenLapack_SRCS ${EigenLapack_SRCS}
slamch.f dlamch.f
)
set(EIGEN_LAPACK_DEF "eigen_lapack.def")
option(EIGEN_ENABLE_LAPACK_TESTS OFF "Enable the Lapack unit tests")
if(EIGEN_ENABLE_LAPACK_TESTS)
@@ -98,13 +102,16 @@ endif()
set(EIGEN_LAPACK_TARGETS "")
add_library(eigen_lapack_static STATIC ${EigenLapack_SRCS} ${ReferenceLapack_SRCS})
target_link_libraries(eigen_lapack_static eigen_blas_static)
list(APPEND EIGEN_LAPACK_TARGETS eigen_lapack_static)
if (EIGEN_BUILD_SHARED_LIBS)
add_library(eigen_lapack SHARED ${EigenLapack_SRCS})
target_compile_definitions(eigen_lapack PUBLIC "EIGEN_BUILD_DLL")
list(APPEND EIGEN_LAPACK_TARGETS eigen_lapack)
add_library(eigen_lapack SHARED ${EigenLapack_SRCS} ${EIGEN_LAPACK_DEF})
# Build LAPACK but link BLAS.
target_compile_definitions(eigen_lapack PUBLIC "EIGEN_BLAS_LINK_DLL" "EIGEN_LAPACK_BUILD_DLL")
target_link_libraries(eigen_lapack eigen_blas)
set_target_properties(eigen_lapack PROPERTIES CXX_VISIBILITY_PRESET hidden)
list(APPEND EIGEN_LAPACK_TARGETS eigen_lapack)
endif()
foreach(target IN LISTS EIGEN_LAPACK_TARGETS)