Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2f901956 authored by PRUVOST Florent's avatar PRUVOST Florent
Browse files

add _DEP lists to CBLAS and LAPACKE

parent ace7c7b0
No related branches found
No related tags found
No related merge requests found
......@@ -1354,9 +1354,6 @@ if(BLA_F95)
set(BLAS_FOUND TRUE)
set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
if (NOT BLAS_LIBRARIES_DEP)
set(BLAS_LIBRARIES_DEP "${BLAS95_LIBRARIES}")
endif()
else(BLA_F95)
......
......@@ -114,22 +114,24 @@ if (BLAS_FOUND)
# Check for faster complex GEMM routine
# (only C/Z, no S/D version)
if ( CBLAS_ZGEMM3M_FOUND )
add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M)
add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M)
endif()
if(NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas: test with blas succeeds")
message(STATUS "Looking for cblas: test with blas succeeds")
endif()
# test succeeds: CBLAS is in BLAS
set(CBLAS_LIBRARIES "${BLAS_LIBRARIES}")
set(CBLAS_LIBRARIES_DEP "${BLAS_LIBRARIES}")
if (BLAS_LIBRARY_DIRS)
set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}")
set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}")
endif()
if(BLAS_INCLUDE_DIRS)
set(CBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}")
set(CBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}")
set(CBLAS_INCLUDE_DIRS_DEP "${BLAS_INCLUDE_DIRS_DEP}")
endif()
if (BLAS_LINKER_FLAGS)
set(CBLAS_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
set(CBLAS_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
endif()
endif()
endif (NOT CBLAS_STANDALONE)
......@@ -160,17 +162,17 @@ if (BLAS_FOUND)
list(APPEND _inc_env "${ENV_CBLAS_DIR}/include/cblas")
else()
if(WIN32)
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
......@@ -184,21 +186,21 @@ if (BLAS_FOUND)
if(CBLAS_INCDIR)
set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND")
find_path(CBLAS_cblas.h_DIRS
NAMES cblas.h
HINTS ${CBLAS_INCDIR})
NAMES cblas.h
HINTS ${CBLAS_INCDIR})
else()
if(CBLAS_DIR)
set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND")
find_path(CBLAS_cblas.h_DIRS
NAMES cblas.h
HINTS ${CBLAS_DIR}
PATH_SUFFIXES "include" "include/cblas")
set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND")
find_path(CBLAS_cblas.h_DIRS
NAMES cblas.h
HINTS ${CBLAS_DIR}
PATH_SUFFIXES "include" "include/cblas")
else()
set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND")
find_path(CBLAS_cblas.h_DIRS
NAMES cblas.h
HINTS ${_inc_env}
PATH_SUFFIXES "cblas")
set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND")
find_path(CBLAS_cblas.h_DIRS
NAMES cblas.h
HINTS ${_inc_env}
PATH_SUFFIXES "cblas")
endif()
endif()
mark_as_advanced(CBLAS_cblas.h_DIRS)
......@@ -210,7 +212,7 @@ if (BLAS_FOUND)
else ()
set(CBLAS_INCLUDE_DIRS "CBLAS_INCLUDE_DIRS-NOTFOUND")
if(NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas -- cblas.h not found")
message(STATUS "Looking for cblas -- cblas.h not found")
endif()
endif()
......@@ -229,15 +231,15 @@ if (BLAS_FOUND)
list(APPEND _lib_env "${ENV_CBLAS_DIR}/lib")
else()
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else()
if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
endif()
list(REMOVE_DUPLICATES _lib_env)
......@@ -249,20 +251,20 @@ if (BLAS_FOUND)
if(CBLAS_LIBDIR)
set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND")
find_library(CBLAS_cblas_LIBRARY
NAMES cblas
HINTS ${CBLAS_LIBDIR})
NAMES cblas
HINTS ${CBLAS_LIBDIR})
else()
if(CBLAS_DIR)
set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND")
find_library(CBLAS_cblas_LIBRARY
NAMES cblas
HINTS ${CBLAS_DIR}
PATH_SUFFIXES lib lib32 lib64)
set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND")
find_library(CBLAS_cblas_LIBRARY
NAMES cblas
HINTS ${CBLAS_DIR}
PATH_SUFFIXES lib lib32 lib64)
else()
set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND")
find_library(CBLAS_cblas_LIBRARY
NAMES cblas
HINTS ${_lib_env})
set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND")
find_library(CBLAS_cblas_LIBRARY
NAMES cblas
HINTS ${_lib_env})
endif()
endif()
mark_as_advanced(CBLAS_cblas_LIBRARY)
......@@ -278,7 +280,7 @@ if (BLAS_FOUND)
set(CBLAS_LIBRARIES "CBLAS_LIBRARIES-NOTFOUND")
set(CBLAS_LIBRARY_DIRS "CBLAS_LIBRARY_DIRS-NOTFOUND")
if (NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas -- lib cblas not found")
message(STATUS "Looking for cblas -- lib cblas not found")
endif()
endif ()
......@@ -292,22 +294,22 @@ if (BLAS_FOUND)
# CBLAS
if (CBLAS_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}")
set(REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}")
endif()
if (CBLAS_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS}")
set(REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${CBLAS_LIBRARIES}")
# BLAS
if (BLAS_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}")
list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}")
endif()
if (BLAS_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${BLAS_LIBRARY_DIRS}")
list(APPEND REQUIRED_LIBDIRS "${BLAS_LIBRARY_DIRS}")
endif()
list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}")
if (BLAS_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
endif()
# set required libraries for link
......@@ -315,7 +317,7 @@ if (BLAS_FOUND)
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -328,28 +330,28 @@ if (BLAS_FOUND)
if(CBLAS_WORKS)
# Check for faster complex GEMM routine
# (only C/Z, no S/D version)
check_function_exists(cblas_zgemm3m CBLAS_ZGEMM3M_FOUND)
if ( CBLAS_ZGEMM3M_FOUND )
add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M)
endif()
# save link with dependencies
set(CBLAS_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(CBLAS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(CBLAS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(CBLAS_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES CBLAS_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_LINKER_FLAGS)
# Check for faster complex GEMM routine
# (only C/Z, no S/D version)
check_function_exists(cblas_zgemm3m CBLAS_ZGEMM3M_FOUND)
if ( CBLAS_ZGEMM3M_FOUND )
add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M)
endif()
# save link with dependencies
set(CBLAS_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(CBLAS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(CBLAS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(CBLAS_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES CBLAS_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_LINKER_FLAGS)
else()
if(NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas : test of cblas_dscal with cblas and blas libraries fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
if(NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas : test of cblas_dscal with cblas and blas libraries fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
......
......@@ -74,18 +74,18 @@ macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
else()
if(${LIBNAME}_DIR)
message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}"
"has not been found in ${ARGN}${ColourReset}")
"has not been found in ${ARGN}${ColourReset}")
else()
message("${Yellow}${_lib_to_find} not found."
"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
"are defined so that we look for ${_lib_to_find} in"
"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
"Mac: DYLD_LIBRARY_PATH,"
"CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES,"
"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
"are defined so that we look for ${_lib_to_find} in"
"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
"Mac: DYLD_LIBRARY_PATH,"
"CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES,"
"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
if(_lib_env)
message("${Yellow}${_lib_to_find} has not been found in"
"${_lib_env}${ColourReset}")
message("${Yellow}${_lib_to_find} has not been found in"
"${_lib_env}${ColourReset}")
endif()
endif()
endif()
......@@ -151,11 +151,11 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads
list(APPEND _libdir "${BLAS_DIR}")
list(APPEND _libdir "${BLAS_DIR}/lib")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
list(APPEND _libdir "${BLAS_DIR}/lib64")
list(APPEND _libdir "${BLAS_DIR}/lib/intel64")
list(APPEND _libdir "${BLAS_DIR}/lib64")
list(APPEND _libdir "${BLAS_DIR}/lib/intel64")
else()
list(APPEND _libdir "${BLAS_DIR}/lib32")
list(APPEND _libdir "${BLAS_DIR}/lib/ia32")
list(APPEND _libdir "${BLAS_DIR}/lib32")
list(APPEND _libdir "${BLAS_DIR}/lib/ia32")
endif()
elseif(ENV_BLAS_LIBDIR)
list(APPEND _libdir "${ENV_BLAS_LIBDIR}")
......@@ -163,11 +163,11 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads
list(APPEND _libdir "${ENV_BLAS_DIR}")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib64")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib/intel64")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib64")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib/intel64")
else()
list(APPEND _libdir "${ENV_BLAS_DIR}/lib32")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib32")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32")
endif()
endif()
if (LAPACK_LIBDIR)
......@@ -176,11 +176,11 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads
list(APPEND _libdir "${LAPACK_DIR}")
list(APPEND _libdir "${LAPACK_DIR}/lib")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
list(APPEND _libdir "${LAPACK_DIR}/lib64")
list(APPEND _libdir "${LAPACK_DIR}/lib/intel64")
list(APPEND _libdir "${LAPACK_DIR}/lib64")
list(APPEND _libdir "${LAPACK_DIR}/lib/intel64")
else()
list(APPEND _libdir "${LAPACK_DIR}/lib32")
list(APPEND _libdir "${LAPACK_DIR}/lib/ia32")
list(APPEND _libdir "${LAPACK_DIR}/lib32")
list(APPEND _libdir "${LAPACK_DIR}/lib/ia32")
endif()
elseif(ENV_LAPACK_LIBDIR)
list(APPEND _libdir "${ENV_LAPACK_LIBDIR}")
......@@ -188,29 +188,29 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads
list(APPEND _libdir "${ENV_LAPACK_DIR}")
list(APPEND _libdir "${ENV_LAPACK_DIR}/lib")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
list(APPEND _libdir "${ENV_LAPACK_DIR}/lib64")
list(APPEND _libdir "${ENV_LAPACK_DIR}/lib/intel64")
list(APPEND _libdir "${ENV_LAPACK_DIR}/lib64")
list(APPEND _libdir "${ENV_LAPACK_DIR}/lib/intel64")
else()
list(APPEND _libdir "${ENV_LAPACK_DIR}/lib32")
list(APPEND _libdir "${ENV_LAPACK_DIR}/lib/ia32")
list(APPEND _libdir "${ENV_LAPACK_DIR}/lib32")
list(APPEND _libdir "${ENV_LAPACK_DIR}/lib/ia32")
endif()
else()
if (ENV_MKLROOT)
list(APPEND _libdir "${ENV_MKLROOT}/lib")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
list(APPEND _libdir "${ENV_MKLROOT}/lib64")
list(APPEND _libdir "${ENV_MKLROOT}/lib/intel64")
else()
list(APPEND _libdir "${ENV_MKLROOT}/lib32")
list(APPEND _libdir "${ENV_MKLROOT}/lib/ia32")
endif()
list(APPEND _libdir "${ENV_MKLROOT}/lib")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
list(APPEND _libdir "${ENV_MKLROOT}/lib64")
list(APPEND _libdir "${ENV_MKLROOT}/lib/intel64")
else()
list(APPEND _libdir "${ENV_MKLROOT}/lib32")
list(APPEND _libdir "${ENV_MKLROOT}/lib/ia32")
endif()
endif()
if (WIN32)
string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
elseif (APPLE)
string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
else ()
string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
endif ()
list(APPEND _libdir "${_libdir2}")
list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
......@@ -227,30 +227,30 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads
if(_libraries_work)
if (BLA_STATIC)
if (WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif ( WIN32 )
if (APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
else (APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif (APPLE)
if (WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif ( WIN32 )
if (APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
else (APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif (APPLE)
else (BLA_STATIC)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# for ubuntu's libblas3gf and liblapack3gf packages
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# for ubuntu's libblas3gf and liblapack3gf packages
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
endif ()
endif (BLA_STATIC)
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
HINTS ${_libdir}
NO_DEFAULT_PATH
)
NAMES ${_library}
HINTS ${_libdir}
NO_DEFAULT_PATH
)
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
# Print status if not found
# -------------------------
if (NOT ${_prefix}_${_library}_LIBRARY AND NOT LAPACK_FIND_QUIETLY AND LAPACK_VERBOSE)
Print_Find_Library_Blas_Status(lapack ${_library} ${_libdir})
Print_Find_Library_Blas_Status(lapack ${_library} ${_libdir})
endif ()
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
......@@ -270,7 +270,7 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads
endif(UNIX AND BLA_STATIC)
if (LAPACK_VERBOSE)
message("${Cyan}LAPACK libs found. Try to compile symbol ${_name} with"
"following libraries: ${CMAKE_REQUIRED_LIBRARIES}")
"following libraries: ${CMAKE_REQUIRED_LIBRARIES}")
endif ()
if(NOT LAPACK_FOUND)
unset(${_prefix}${_combined_name}_WORKS CACHE)
......@@ -345,18 +345,18 @@ if(BLAS_FOUND)
)
if (LAPACK_LIBRARIES)
if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_LIBRARIES)
message(STATUS "Looking for LAPACK in BLAS: found")
else()
message(STATUS "Looking for LAPACK in BLAS: not found")
endif()
endif()
if(LAPACK_LIBRARIES)
message(STATUS "Looking for LAPACK in BLAS: found")
else()
message(STATUS "Looking for LAPACK in BLAS: not found")
endif()
endif()
if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND)
set (LAPACK_VENDOR_FOUND "${BLAS_VENDOR_FOUND}")
endif()
endif()
endif(BLAS_LIBRARIES)
#intel lapack
if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
......@@ -364,82 +364,82 @@ if(BLAS_FOUND)
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
find_PACKAGE(Threads)
find_PACKAGE(Threads)
else()
find_package(Threads REQUIRED)
find_package(Threads REQUIRED)
endif()
set(LAPACK_SEARCH_LIBS "")
set(additional_flags "")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(additional_flags "-Wl,--no-as-needed")
set(additional_flags "-Wl,--no-as-needed")
endif()
if (BLA_F95)
set(LAPACK_mkl_SEARCH_SYMBOL "CHEEV")
set(_LIBRARIES LAPACK95_LIBRARIES)
set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
# old
list(APPEND LAPACK_SEARCH_LIBS
"mkl_lapack95")
# new >= 10.3
list(APPEND LAPACK_SEARCH_LIBS
"mkl_intel_c")
list(APPEND LAPACK_SEARCH_LIBS
"mkl_intel_lp64")
set(LAPACK_mkl_SEARCH_SYMBOL "CHEEV")
set(_LIBRARIES LAPACK95_LIBRARIES)
set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
# old
list(APPEND LAPACK_SEARCH_LIBS
"mkl_lapack95")
# new >= 10.3
list(APPEND LAPACK_SEARCH_LIBS
"mkl_intel_c")
list(APPEND LAPACK_SEARCH_LIBS
"mkl_intel_lp64")
else(BLA_F95)
set(LAPACK_mkl_SEARCH_SYMBOL "cheev")
set(_LIBRARIES LAPACK_LIBRARIES)
set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
# old
list(APPEND LAPACK_SEARCH_LIBS
"mkl_lapack")
# new >= 10.3
list(APPEND LAPACK_SEARCH_LIBS
"mkl_gf_lp64")
set(LAPACK_mkl_SEARCH_SYMBOL "cheev")
set(_LIBRARIES LAPACK_LIBRARIES)
set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
# old
list(APPEND LAPACK_SEARCH_LIBS
"mkl_lapack")
# new >= 10.3
list(APPEND LAPACK_SEARCH_LIBS
"mkl_gf_lp64")
endif(BLA_F95)
# First try empty lapack libs
if (NOT ${_LIBRARIES})
check_lapack_libraries(
${_LIBRARIES}
LAPACK
${LAPACK_mkl_SEARCH_SYMBOL}
"${additional_flags}"
""
"${_BLAS_LIBRARIES}"
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
if(_LIBRARIES)
set(LAPACK_LINKER_FLAGS "${additional_flags}")
endif()
check_lapack_libraries(
${_LIBRARIES}
LAPACK
${LAPACK_mkl_SEARCH_SYMBOL}
"${additional_flags}"
""
"${_BLAS_LIBRARIES}"
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
if(_LIBRARIES)
set(LAPACK_LINKER_FLAGS "${additional_flags}")
endif()
endif ()
# Then try the search libs
foreach (IT ${LAPACK_SEARCH_LIBS})
if (NOT ${_LIBRARIES})
check_lapack_libraries(
${_LIBRARIES}
LAPACK
${LAPACK_mkl_SEARCH_SYMBOL}
"${additional_flags}"
"${IT}"
"${_BLAS_LIBRARIES}"
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
if(_LIBRARIES)
set(LAPACK_LINKER_FLAGS "${additional_flags}")
endif()
endif ()
if (NOT ${_LIBRARIES})
check_lapack_libraries(
${_LIBRARIES}
LAPACK
${LAPACK_mkl_SEARCH_SYMBOL}
"${additional_flags}"
"${IT}"
"${_BLAS_LIBRARIES}"
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
if(_LIBRARIES)
set(LAPACK_LINKER_FLAGS "${additional_flags}")
endif()
endif ()
endforeach ()
if(NOT LAPACK_FIND_QUIETLY)
if(${_LIBRARIES})
message(STATUS "Looking for MKL LAPACK: found")
else()
message(STATUS "Looking for MKL LAPACK: not found")
endif()
if(${_LIBRARIES})
message(STATUS "Looking for MKL LAPACK: found")
else()
message(STATUS "Looking for MKL LAPACK: not found")
endif()
endif(NOT LAPACK_FIND_QUIETLY)
if (${_LIBRARIES} AND NOT LAPACK_VENDOR_FOUND)
set (LAPACK_VENDOR_FOUND "Intel MKL")
......@@ -453,20 +453,20 @@ if(BLAS_FOUND)
if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheev
""
"goto2"
"${BLAS_LIBRARIES}"
""
)
LAPACK_LIBRARIES
LAPACK
cheev
""
"goto2"
"${BLAS_LIBRARIES}"
""
)
if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_LIBRARIES)
message(STATUS "Looking for Goto LAPACK: found")
else()
message(STATUS "Looking for Goto LAPACK: not found")
endif()
if(LAPACK_LIBRARIES)
message(STATUS "Looking for Goto LAPACK: found")
else()
message(STATUS "Looking for Goto LAPACK: not found")
endif()
endif()
if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND)
set (LAPACK_VENDOR_FOUND "Goto")
......@@ -478,20 +478,20 @@ if(BLAS_FOUND)
if (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All")
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheev
""
"openblas"
"${BLAS_LIBRARIES}"
""
)
LAPACK_LIBRARIES
LAPACK
cheev
""
"openblas"
"${BLAS_LIBRARIES}"
""
)
if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_LIBRARIES)
message(STATUS "Looking for Open LAPACK: found")
else()
message(STATUS "Looking for Open LAPACK: not found")
endif()
if(LAPACK_LIBRARIES)
message(STATUS "Looking for Open LAPACK: found")
else()
message(STATUS "Looking for Open LAPACK: not found")
endif()
endif()
if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND)
set (LAPACK_VENDOR_FOUND "Openblas")
......@@ -503,20 +503,20 @@ if(BLAS_FOUND)
if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheevd
""
"essl;lapack"
"${BLAS_LIBRARIES}"
""
)
LAPACK_LIBRARIES
LAPACK
cheevd
""
"essl;lapack"
"${BLAS_LIBRARIES}"
""
)
if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_LIBRARIES)
message(STATUS "Looking for IBM ESSL LAPACK: found")
else()
message(STATUS "Looking for IBM ESSL LAPACK: not found")
endif()
if(LAPACK_LIBRARIES)
message(STATUS "Looking for IBM ESSL LAPACK: found")
else()
message(STATUS "Looking for IBM ESSL LAPACK: not found")
endif()
endif()
if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND)
set (LAPACK_VENDOR_FOUND "IBM ESSL")
......@@ -528,20 +528,20 @@ if(BLAS_FOUND)
if (BLA_VENDOR STREQUAL "IBMESSLMT" OR BLA_VENDOR STREQUAL "All")
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheevd
""
"esslsmp;lapack"
"${BLAS_PAR_LIBRARIES}"
""
)
LAPACK_LIBRARIES
LAPACK
cheevd
""
"esslsmp;lapack"
"${BLAS_PAR_LIBRARIES}"
""
)
if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_LIBRARIES)
message(STATUS "Looking for IBM ESSL MT LAPACK: found")
else()
message(STATUS "Looking for IBM ESSL MT LAPACK: not found")
endif()
if(LAPACK_LIBRARIES)
message(STATUS "Looking for IBM ESSL MT LAPACK: found")
else()
message(STATUS "Looking for IBM ESSL MT LAPACK: not found")
endif()
endif()
if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND)
set (LAPACK_VENDOR_FOUND "IBM ESSL MT")
......@@ -554,11 +554,11 @@ if(BLAS_FOUND)
if (BLAS_LIBRARIES MATCHES ".+acml.+")
set (LAPACK_LIBRARIES ${BLAS_LIBRARIES})
if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_LIBRARIES)
message(STATUS "Looking for ACML LAPACK: found")
else()
message(STATUS "Looking for ACML LAPACK: not found")
endif()
if(LAPACK_LIBRARIES)
message(STATUS "Looking for ACML LAPACK: found")
else()
message(STATUS "Looking for ACML LAPACK: not found")
endif()
endif()
if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND)
set (LAPACK_VENDOR_FOUND "ACML")
......@@ -570,20 +570,20 @@ if(BLAS_FOUND)
if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheev
""
"Accelerate"
"${BLAS_LIBRARIES}"
""
)
LAPACK_LIBRARIES
LAPACK
cheev
""
"Accelerate"
"${BLAS_LIBRARIES}"
""
)
if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_LIBRARIES)
message(STATUS "Looking for Apple Accelerate LAPACK: found")
else()
message(STATUS "Looking for Apple Accelerate LAPACK: not found")
endif()
if(LAPACK_LIBRARIES)
message(STATUS "Looking for Apple Accelerate LAPACK: found")
else()
message(STATUS "Looking for Apple Accelerate LAPACK: not found")
endif()
endif()
if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND)
set (LAPACK_VENDOR_FOUND "Apple Accelerate")
......@@ -594,20 +594,20 @@ if(BLAS_FOUND)
if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
if ( NOT LAPACK_LIBRARIES )
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheev
""
"vecLib"
"${BLAS_LIBRARIES}"
""
)
LAPACK_LIBRARIES
LAPACK
cheev
""
"vecLib"
"${BLAS_LIBRARIES}"
""
)
if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_LIBRARIES)
message(STATUS "Looking for NAS LAPACK: found")
else()
message(STATUS "Looking for NAS LAPACK: not found")
endif()
if(LAPACK_LIBRARIES)
message(STATUS "Looking for NAS LAPACK: found")
else()
message(STATUS "Looking for NAS LAPACK: not found")
endif()
endif()
if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND)
set (LAPACK_VENDOR_FOUND "NAS")
......@@ -621,20 +621,20 @@ if(BLAS_FOUND)
BLA_VENDOR STREQUAL "All")
if ( NOT LAPACK_LIBRARIES )
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheev
""
"lapack"
"${BLAS_LIBRARIES};${LM}"
""
)
LAPACK_LIBRARIES
LAPACK
cheev
""
"lapack"
"${BLAS_LIBRARIES};${LM}"
""
)
if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_LIBRARIES)
message(STATUS "Looking for Generic LAPACK: found")
else()
message(STATUS "Looking for Generic LAPACK: not found")
endif()
if(LAPACK_LIBRARIES)
message(STATUS "Looking for Generic LAPACK: found")
else()
message(STATUS "Looking for Generic LAPACK: not found")
endif()
endif()
if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND)
set (LAPACK_VENDOR_FOUND "Netlib or other Generic liblapack")
......@@ -657,23 +657,23 @@ if(BLA_F95)
message(STATUS "LAPACK_LIBRARIES ${LAPACK_LIBRARIES}")
else(LAPACK95_FOUND)
message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but LAPACK 95 libraries could not be found or check of symbols failed."
"\nPlease indicate where to find LAPACK libraries. You have three options:\n"
"- Option 1: Provide the installation directory of LAPACK library with cmake option: -DLAPACK_DIR=your/path/to/lapack\n"
"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"\nTo follow libraries detection more precisely you can activate a verbose mode with -DLAPACK_VERBOSE=ON at cmake configure."
"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
"\nPlease indicate where to find LAPACK libraries. You have three options:\n"
"- Option 1: Provide the installation directory of LAPACK library with cmake option: -DLAPACK_DIR=your/path/to/lapack\n"
"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"\nTo follow libraries detection more precisely you can activate a verbose mode with -DLAPACK_VERBOSE=ON at cmake configure."
"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
if(LAPACK_FIND_REQUIRED)
message(FATAL_ERROR
"A required library with LAPACK95 API not found. Please specify library location."
)
message(FATAL_ERROR
"A required library with LAPACK95 API not found. Please specify library location."
)
else(LAPACK_FIND_REQUIRED)
message(STATUS
"A library with LAPACK95 API not found. Please specify library location."
)
message(STATUS
"A library with LAPACK95 API not found. Please specify library location."
)
endif(LAPACK_FIND_REQUIRED)
endif(LAPACK95_FOUND)
endif(NOT LAPACK_FIND_QUIETLY)
......@@ -692,23 +692,23 @@ else(BLA_F95)
message(STATUS "LAPACK_LIBRARIES ${LAPACK_LIBRARIES}")
else(LAPACK_FOUND)
message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but LAPACK libraries could not be found or check of symbols failed."
"\nPlease indicate where to find LAPACK libraries. You have three options:\n"
"- Option 1: Provide the installation directory of LAPACK library with cmake option: -DLAPACK_DIR=your/path/to/lapack\n"
"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"\nTo follow libraries detection more precisely you can activate a verbose mode with -DLAPACK_VERBOSE=ON at cmake configure."
"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
"\nPlease indicate where to find LAPACK libraries. You have three options:\n"
"- Option 1: Provide the installation directory of LAPACK library with cmake option: -DLAPACK_DIR=your/path/to/lapack\n"
"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"\nTo follow libraries detection more precisely you can activate a verbose mode with -DLAPACK_VERBOSE=ON at cmake configure."
"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
if(LAPACK_FIND_REQUIRED)
message(FATAL_ERROR
"A required library with LAPACK API not found. Please specify library location."
)
message(FATAL_ERROR
"A required library with LAPACK API not found. Please specify library location."
)
else(LAPACK_FIND_REQUIRED)
message(STATUS
"A library with LAPACK API not found. Please specify library location."
)
message(STATUS
"A library with LAPACK API not found. Please specify library location."
)
endif(LAPACK_FIND_REQUIRED)
endif(LAPACK_FOUND)
endif(NOT LAPACK_FIND_QUIETLY)
......
......@@ -91,18 +91,20 @@ if (LAPACK_FOUND)
if(LAPACKE_WORKS)
if(NOT LAPACKE_FIND_QUIETLY)
message(STATUS "Looking for lapacke: test with lapack succeeds")
message(STATUS "Looking for lapacke: test with lapack succeeds")
endif()
# test succeeds: LAPACKE is in LAPACK
set(LAPACKE_LIBRARIES "${LAPACK_LIBRARIES}")
set(LAPACKE_LIBRARIES_DEP "${LAPACK_LIBRARIES}")
if (LAPACK_LIBRARY_DIRS)
set(LAPACKE_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}")
set(LAPACKE_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}")
endif()
if(LAPACK_INCLUDE_DIRS)
set(LAPACKE_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}")
set(LAPACKE_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}")
set(LAPACKE_INCLUDE_DIRS_DEP "${LAPACK_INCLUDE_DIRS}")
endif()
if (LAPACK_LINKER_FLAGS)
set(LAPACKE_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}")
set(LAPACKE_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}")
endif()
endif()
endif (NOT LAPACKE_STANDALONE)
......@@ -133,16 +135,16 @@ if (LAPACK_FOUND)
list(APPEND _inc_env "${ENV_LAPACKE_DIR}/include/lapacke")
else()
if(WIN32)
string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")
string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
......@@ -156,20 +158,20 @@ if (LAPACK_FOUND)
if(LAPACKE_INCDIR)
set(LAPACKE_lapacke.h_DIRS "LAPACKE_lapacke.h_DIRS-NOTFOUND")
find_path(LAPACKE_lapacke.h_DIRS
NAMES lapacke.h
HINTS ${LAPACKE_INCDIR})
NAMES lapacke.h
HINTS ${LAPACKE_INCDIR})
else()
if(LAPACKE_DIR)
set(LAPACKE_lapacke.h_DIRS "LAPACKE_lapacke.h_DIRS-NOTFOUND")
find_path(LAPACKE_lapacke.h_DIRS
NAMES lapacke.h
HINTS ${LAPACKE_DIR}
PATH_SUFFIXES "include" "include/lapacke")
set(LAPACKE_lapacke.h_DIRS "LAPACKE_lapacke.h_DIRS-NOTFOUND")
find_path(LAPACKE_lapacke.h_DIRS
NAMES lapacke.h
HINTS ${LAPACKE_DIR}
PATH_SUFFIXES "include" "include/lapacke")
else()
set(LAPACKE_lapacke.h_DIRS "LAPACKE_lapacke.h_DIRS-NOTFOUND")
find_path(LAPACKE_lapacke.h_DIRS
NAMES lapacke.h
HINTS ${_inc_env})
set(LAPACKE_lapacke.h_DIRS "LAPACKE_lapacke.h_DIRS-NOTFOUND")
find_path(LAPACKE_lapacke.h_DIRS
NAMES lapacke.h
HINTS ${_inc_env})
endif()
endif()
mark_as_advanced(LAPACKE_lapacke.h_DIRS)
......@@ -181,7 +183,7 @@ if (LAPACK_FOUND)
else ()
set(LAPACKE_INCLUDE_DIRS "LAPACKE_INCLUDE_DIRS-NOTFOUND")
if(NOT LAPACKE_FIND_QUIETLY)
message(STATUS "Looking for lapacke -- lapacke.h not found")
message(STATUS "Looking for lapacke -- lapacke.h not found")
endif()
endif()
......@@ -200,15 +202,15 @@ if (LAPACK_FOUND)
list(APPEND _lib_env "${ENV_LAPACKE_DIR}/lib")
else()
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else()
if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
endif()
list(REMOVE_DUPLICATES _lib_env)
......@@ -220,20 +222,20 @@ if (LAPACK_FOUND)
if(LAPACKE_LIBDIR)
set(LAPACKE_lapacke_LIBRARY "LAPACKE_lapacke_LIBRARY-NOTFOUND")
find_library(LAPACKE_lapacke_LIBRARY
NAMES lapacke
HINTS ${LAPACKE_LIBDIR})
NAMES lapacke
HINTS ${LAPACKE_LIBDIR})
else()
if(LAPACKE_DIR)
set(LAPACKE_lapacke_LIBRARY "LAPACKE_lapacke_LIBRARY-NOTFOUND")
find_library(LAPACKE_lapacke_LIBRARY
NAMES lapacke
HINTS ${LAPACKE_DIR}
PATH_SUFFIXES lib lib32 lib64)
set(LAPACKE_lapacke_LIBRARY "LAPACKE_lapacke_LIBRARY-NOTFOUND")
find_library(LAPACKE_lapacke_LIBRARY
NAMES lapacke
HINTS ${LAPACKE_DIR}
PATH_SUFFIXES lib lib32 lib64)
else()
set(LAPACKE_lapacke_LIBRARY "LAPACKE_lapacke_LIBRARY-NOTFOUND")
find_library(LAPACKE_lapacke_LIBRARY
NAMES lapacke
HINTS ${_lib_env})
set(LAPACKE_lapacke_LIBRARY "LAPACKE_lapacke_LIBRARY-NOTFOUND")
find_library(LAPACKE_lapacke_LIBRARY
NAMES lapacke
HINTS ${_lib_env})
endif()
endif()
mark_as_advanced(LAPACKE_lapacke_LIBRARY)
......@@ -249,7 +251,7 @@ if (LAPACK_FOUND)
set(LAPACKE_LIBRARIES "LAPACKE_LIBRARIES-NOTFOUND")
set(LAPACKE_LIBRARY_DIRS "LAPACKE_LIBRARY_DIRS-NOTFOUND")
if (NOT LAPACKE_FIND_QUIETLY)
message(STATUS "Looking for lapacke -- lib lapacke not found")
message(STATUS "Looking for lapacke -- lib lapacke not found")
endif()
endif ()
......@@ -263,57 +265,57 @@ if (LAPACK_FOUND)
# LAPACKE
if (LAPACKE_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${LAPACKE_INCLUDE_DIRS}")
set(REQUIRED_INCDIRS "${LAPACKE_INCLUDE_DIRS}")
endif()
if (LAPACKE_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${LAPACKE_LIBRARY_DIRS}")
set(REQUIRED_LIBDIRS "${LAPACKE_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${LAPACKE_LIBRARIES}")
# LAPACK
if (LAPACK_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${LAPACK_INCLUDE_DIRS}")
list(APPEND REQUIRED_INCDIRS "${LAPACK_INCLUDE_DIRS}")
endif()
if (LAPACK_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${LAPACK_LIBRARY_DIRS}")
list(APPEND REQUIRED_LIBDIRS "${LAPACK_LIBRARY_DIRS}")
endif()
list(APPEND REQUIRED_LIBS "${LAPACK_LIBRARIES}")
if (LAPACK_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}")
list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}")
endif()
# Fortran
if (CMAKE_C_COMPILER_ID MATCHES "GNU")
find_library(
FORTRAN_gfortran_LIBRARY
NAMES gfortran
HINTS ${_lib_env}
)
mark_as_advanced(FORTRAN_gfortran_LIBRARY)
if (FORTRAN_gfortran_LIBRARY)
list(APPEND REQUIRED_LIBS "${FORTRAN_gfortran_LIBRARY}")
endif()
find_library(
FORTRAN_gfortran_LIBRARY
NAMES gfortran
HINTS ${_lib_env}
)
mark_as_advanced(FORTRAN_gfortran_LIBRARY)
if (FORTRAN_gfortran_LIBRARY)
list(APPEND REQUIRED_LIBS "${FORTRAN_gfortran_LIBRARY}")
endif()
elseif (CMAKE_C_COMPILER_ID MATCHES "Intel")
find_library(
FORTRAN_ifcore_LIBRARY
NAMES ifcore
HINTS ${_lib_env}
)
mark_as_advanced(FORTRAN_ifcore_LIBRARY)
if (FORTRAN_ifcore_LIBRARY)
list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}")
endif()
find_library(
FORTRAN_ifcore_LIBRARY
NAMES ifcore
HINTS ${_lib_env}
)
mark_as_advanced(FORTRAN_ifcore_LIBRARY)
if (FORTRAN_ifcore_LIBRARY)
list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}")
endif()
endif()
# m
find_library(M_LIBRARY NAMES m HINTS ${_lib_env})
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
list(APPEND REQUIRED_LIBS "-lm")
list(APPEND REQUIRED_LIBS "-lm")
endif()
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -325,21 +327,21 @@ if (LAPACK_FOUND)
mark_as_advanced(LAPACKE_WORKS)
if(LAPACKE_WORKS)
# save link with dependencies
set(LAPACKE_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(LAPACKE_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(LAPACKE_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(LAPACKE_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES LAPACKE_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES LAPACKE_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES LAPACKE_LINKER_FLAGS)
# save link with dependencies
set(LAPACKE_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(LAPACKE_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(LAPACKE_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(LAPACKE_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES LAPACKE_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES LAPACKE_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES LAPACKE_LINKER_FLAGS)
else()
if(NOT LAPACKE_FIND_QUIETLY)
message(STATUS "Looking for lapacke: test of LAPACKE_dgeqrf with lapacke and lapack libraries fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
if(NOT LAPACKE_FIND_QUIETLY)
message(STATUS "Looking for lapacke: test of LAPACKE_dgeqrf with lapacke and lapack libraries fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment