blob: c7f45e6c38640fdb3a0a35fe9190234628ecaff6 [file]
# SPDX-FileCopyrightText: The Eigen Authors
# SPDX-License-Identifier: MPL-2.0
project(EigenBlas CXX)
if(EIGEN_BUILD_BLAS)
add_custom_target(blas)
set(EigenBlas_SRCS single.cpp double.cpp complex_single.cpp complex_double.cpp xerbla.cpp
lsame.cpp complexdots.cpp
)
set(EIGEN_BLAS_TARGETS "")
add_library(eigen_blas_static STATIC ${EigenBlas_SRCS})
list(APPEND EIGEN_BLAS_TARGETS eigen_blas_static)
if (EIGEN_BUILD_SHARED_LIBS)
add_library(eigen_blas SHARED ${EigenBlas_SRCS} "eigen_blas.def")
target_compile_definitions(eigen_blas PUBLIC "EIGEN_BLAS_BUILD_DLL")
set_target_properties(eigen_blas PROPERTIES CXX_VISIBILITY_PRESET hidden
VERSION ${EIGEN_VERSION_NUMBER}
SOVERSION ${EIGEN_MAJOR_VERSION})
list(APPEND EIGEN_BLAS_TARGETS eigen_blas)
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT EIGEN_TEST_32BIT)
option(EIGEN_BUILD_BLAS_ILP64 "Toggles the building of the 64-bit integer (ILP64) Eigen Blas library" ON)
else()
set(EIGEN_BUILD_BLAS_ILP64 OFF)
endif()
if(EIGEN_BUILD_BLAS_ILP64)
add_library(eigen_blas_ilp64_static STATIC ${EigenBlas_SRCS})
target_compile_definitions(eigen_blas_ilp64_static PUBLIC "EIGEN_64BIT_BLAS")
list(APPEND EIGEN_BLAS_TARGETS eigen_blas_ilp64_static)
if(EIGEN_BUILD_SHARED_LIBS)
add_library(eigen_blas_ilp64 SHARED ${EigenBlas_SRCS} "eigen_blas.def")
# EIGEN_BLAS_BUILD_DLL stays private: a consumer that sees it declares the routines dllexport,
# which MSVC rejects against the plain declarations EIGEN_USE_BLAS brings in (C2375).
target_compile_definitions(eigen_blas_ilp64 PRIVATE "EIGEN_BLAS_BUILD_DLL" PUBLIC "EIGEN_64BIT_BLAS")
set_target_properties(eigen_blas_ilp64 PROPERTIES CXX_VISIBILITY_PRESET hidden
VERSION ${EIGEN_VERSION_NUMBER}
SOVERSION ${EIGEN_MAJOR_VERSION})
list(APPEND EIGEN_BLAS_TARGETS eigen_blas_ilp64)
endif()
endif()
foreach(target IN LISTS EIGEN_BLAS_TARGETS)
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
target_link_libraries(${target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
endif()
add_dependencies(blas ${target})
if(EIGEN_INSTALL)
install(TARGETS ${target}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()
endforeach()
if(EIGEN_BUILD_TESTING)
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
add_subdirectory(testing) # can't do EXCLUDE_FROM_ALL here, breaks CTest
else()
add_subdirectory(testing EXCLUDE_FROM_ALL)
endif()
endif()
endif()