Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add lapack/blas wrapper as suggested in #3706 #3757

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -393,19 +393,9 @@ if(MKLROOT)
list(APPEND math_libs -lifcore)
endif()
else()
# In compatibility to builtin FindLAPACK.cmake before v3.5.4
if(DEFINED LAPACK_DIR)
string(APPEND CMAKE_PREFIX_PATH ";${LAPACK_DIR}")
endif()
if(DEFINED LAPACK_LIBRARY)
set(LAPACK_LIBRARIES ${LAPACK_LIBRARY})
endif()
if(DEFINED BLAS_DIR)
string(APPEND CMAKE_PREFIX_PATH ";${BLAS_DIR}")
endif()

find_package(FFTW3 REQUIRED)
find_package(LAPACK REQUIRED)
find_package(Lapack REQUIRED)
include_directories(${FFTW3_INCLUDE_DIRS})
list(APPEND math_libs FFTW3::FFTW3 LAPACK::LAPACK BLAS::BLAS)

Expand Down
15 changes: 15 additions & 0 deletions cmake/FindBlas.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
if(DEFINED BLAS_DIR)
string(APPEND CMAKE_PREFIX_PATH ";${BLAS_DIR}")
endif()
if(DEFINED BLAS_LIBRARY)
set(BLAS_LIBRARIES ${BLAS_LIBRARY})
endif()

find_package(BLAS REQUIRED)

if(NOT TARGET BLAS::BLAS)
add_library(BLAS::BLAS UNKNOWN IMPORTED)
set_target_properties(BLAS::BLAS PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${BLAS_LIBRARIES}")
endif()
17 changes: 17 additions & 0 deletions cmake/FindLapack.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# In compatibility to builtin FindLAPACK.cmake before v3.5.4
if(DEFINED LAPACK_DIR)
string(APPEND CMAKE_PREFIX_PATH ";${LAPACK_DIR}")
endif()
if(DEFINED LAPACK_LIBRARY)
set(LAPACK_LIBRARIES ${LAPACK_LIBRARY})
endif()

find_package(Blas REQUIRED)
find_package(LAPACK REQUIRED)

if(NOT TARGET LAPACK::LAPACK)
add_library(LAPACK::LAPACK UNKNOWN IMPORTED)
set_target_properties(LAPACK::LAPACK PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LAPACK_LIBRARIES}")
endif()