Skip to content
Merged
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
75 changes: 39 additions & 36 deletions cmake/addOpenBLAS.cmake
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
# This program is a part of EASIFEM library
# Copyright (C) 2020-2021 Vikas Sharma, Ph.D
# This program is a part of EASIFEM library Copyright (C) 2020-2021 Vikas
# Sharma, Ph.D
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https: //www.gnu.org/licenses/>
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https: //www.gnu.org/licenses/>
#

IF( ${PROJECT_NAME} MATCHES "easifemBase" )
#SET(BLA_VENDOR "OpenBLAS")
FIND_PACKAGE( LAPACK REQUIRED )
IF( LAPACK_FOUND )
MESSAGE(STATUS "FOUND LAPACK")
ENDIF()
IF( BLA_VENDOR MATCHES "MKL" )
MESSAGE(STATUS "BLA_VENDOR : MKL")
LIST( APPEND TARGET_COMPILE_DEF "-DUSE_INTEL_MKL" )
ELSEIF( BLA_VENDOR MATCHES "OpenBLAS" )
MESSAGE(STATUS "BLA_VENDOR : OpenBLAS")
LIST( APPEND TARGET_COMPILE_DEF "-DUSE_OpenBLAS" )
ELSE( )
MESSAGE(STATUS "BLA_VENDOR : ${BLA_VENDOR}")
MESSAGE(STATUS "BLA_VENDOR : System provided")
LIST( APPEND TARGET_COMPILE_DEF "-DUSE_NativeBLAS" )
if(${PROJECT_NAME} MATCHES "easifemBase")
# SET(BLA_VENDOR "OpenBLAS")
find_package(LAPACK REQUIRED)
if(LAPACK_FOUND)
message(STATUS "FOUND LAPACK")
endif()
if(BLA_VENDOR MATCHES "MKL")
message(STATUS "BLA_VENDOR : MKL")
list(APPEND TARGET_COMPILE_DEF "-DUSE_INTEL_MKL")
elseif(BLA_VENDOR MATCHES "OpenBLAS")
message(STATUS "BLA_VENDOR : OpenBLAS")
list(APPEND TARGET_COMPILE_DEF "-DUSE_OpenBLAS")
else()
message(STATUS "BLA_VENDOR : ${BLA_VENDOR}")
message(STATUS "BLA_VENDOR : System provided")
list(APPEND TARGET_COMPILE_DEF "-DUSE_NativeBLAS")

IF(APPLE)
LIST( APPEND TARGET_COMPILE_DEF "-DUSE_APPLE_NativeBLAS" )
ENDIF()
if(APPLE)
list(APPEND TARGET_COMPILE_DEF "-DUSE_APPLE_NativeBLAS")
endif()

ENDIF( )
TARGET_LINK_LIBRARIES(
${PROJECT_NAME} PUBLIC ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}
)
ENDIF()
endif()

message(STATUS "BLAS_LIBRARIES: ${BLAS_LIBRARIES}")
message(STATUS "LAPACK_LIBRARIES: ${LAPACK_LIBRARIES}")

target_link_libraries(${PROJECT_NAME} PUBLIC ${LAPACK_LIBRARIES}
${BLAS_LIBRARIES})
endif()