Commit ec0b3a73 authored by PRUVOST Florent's avatar PRUVOST Florent

cmake: add the possibility to force kind of mangling to use for BLAS/LAPACK

parent e843b5af
......@@ -375,35 +375,53 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
list(APPEND CMAKE_INSTALL_RPATH "${LAPACK_LIBRARY_DIRS}")
endif()
message (STATUS "check BLAS Fortran mangling")
# check blas and lapack symbols naming
set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LIBRARIES}")
check_function_exists(dgemv_ DGEMV_ADD_)
set (SCALFMM_BLAS_UPCASE OFF)
set (SCALFMM_BLAS_NOCHANGE OFF)
message (STATUS "BLAS dgemv_ " ${DGEMV_ADD_} ${SCALFMM_BLAS_UPCASE})
if (DGEMV_ADD_)
set (SCALFMM_BLAS_ADD_ ON)
message (STATUS "BLAS dgemv_ symbol found, SCALFMM_BLAS_ADD_ is ON")
else (DGEMV_ADD_)
set (SCALFMM_BLAS_ADD_ OFF)
# add options to let the user be able to force a behavior
option( SCALFMM_BLAS_ADD_ "Set to ON to force calls to BLAS Fortran symbols with _ (ex: dgemm_)" OFF )
option( SCALFMM_BLAS_UPCASE "Set to ON to force calls to BLAS Fortran symbols in capital (ex: DGEMM)" OFF )
option( SCALFMM_BLAS_NOCHANGE "Set to ON to force calls to BLAS Fortran symbols with no change (ex: dgemm)" OFF )
# if options not changed by user then auto-detection
if (NOT SCALFMM_BLAS_ADD_ AND NOT SCALFMM_BLAS_UPCASE AND NOT SCALFMM_BLAS_NOCHANGE)
# give blas libraries and check dgemm symbol
set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LIBRARIES}")
check_function_exists(dgemv_ DGEMV_ADD_)
check_function_exists(DGEMV DGEMV_UPCASE)
if (DGEMV_UPCASE)
set (SCALFMM_BLAS_UPCASE ON)
message (STATUS "BLAS DGEMV symbol found, SCALFMM_BLAS_UPCASE is ON")
else (DGEMV_UPCASE)
# set (SCALFMM_BLAS_UPCASE OFF)
check_function_exists(dgemv DGEMV_NOCHANGE)
if (DGEMV_NOCHANGE)
set (SCALFMM_BLAS_NOCHANGE ON)
message (STATUS "BLAS dgemv symbol found, SCALFMM_BLAS_NOCHANGE is ON")
# else (DGEMV_NOCHANGE)
# set (SCALFMM_BLAS_NOCHANGE OFF)
endif (DGEMV_NOCHANGE)
endif (DGEMV_UPCASE)
endif (DGEMV_ADD_)
if ( (NOT DGEMV_ADD_) AND (NOT DGEMV_UPCASE) AND (NOT DGEMV_NOCHANGE) )
message(FATAL_ERROR "BLAS Fortran mangling cannot be properly detected")
endif ()
check_function_exists(dgemv DGEMV_NOCHANGE)
# here we consider that the first kind of symbol found will be the one used
# current order is: ADD_, UPCASE, NOCHANGE
if (DGEMV_ADD_)
set (SCALFMM_BLAS_ADD_ ON)
set (SCALFMM_BLAS_UPCASE OFF)
set (SCALFMM_BLAS_NOCHANGE OFF)
message (STATUS "BLAS dgemv_ symbol found, SCALFMM_BLAS_ADD_ is ON")
else (DGEMV_ADD_)
if (DGEMV_UPCASE)
set (SCALFMM_BLAS_ADD_ OFF)
set (SCALFMM_BLAS_UPCASE ON)
set (SCALFMM_BLAS_NOCHANGE OFF)
message (STATUS "BLAS DGEMV symbol found, SCALFMM_BLAS_UPCASE is ON")
else (DGEMV_UPCASE)
if (DGEMV_NOCHANGE)
set (SCALFMM_BLAS_ADD_ OFF)
set (SCALFMM_BLAS_UPCASE OFF)
set (SCALFMM_BLAS_NOCHANGE ON)
message (STATUS "BLAS dgemv symbol found, SCALFMM_BLAS_NOCHANGE is ON")
endif (DGEMV_NOCHANGE)
endif (DGEMV_UPCASE)
endif (DGEMV_ADD_)
if ( (NOT DGEMV_ADD_) AND (NOT DGEMV_UPCASE) AND (NOT DGEMV_NOCHANGE) )
message(FATAL_ERROR "BLAS Fortran mangling is not properly detected - please check your BLAS libraries")
endif ()
else (NOT SCALFMM_BLAS_ADD_ AND NOT SCALFMM_BLAS_UPCASE AND NOT SCALFMM_BLAS_NOCHANGE)
if (SCALFMM_BLAS_ADD_)
message (STATUS "SCALFMM_BLAS_ADD_ is set to ON")
endif()
if (SCALFMM_BLAS_UPCASE)
message (STATUS "SCALFMM_BLAS_UPCASE is set to ON")
endif()
if (SCALFMM_BLAS_NOCHANGE)
message (STATUS "SCALFMM_BLAS_NOCHANGE is set to ON")
endif()
endif (NOT SCALFMM_BLAS_ADD_ AND NOT SCALFMM_BLAS_UPCASE AND NOT SCALFMM_BLAS_NOCHANGE)
else()
message(WARNING "BLAS has not been found, SCALFMM will continue to compile but some applications will be disabled.")
message(WARNING "If you have BLAS set BLAS_LIBDIR, BLAS_INCDIR or BLAS_DIR (CMake variables using -D or environment variables).")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment