|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include(CheckFunctionExists) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
macro(check_lapack_libraries DEFINITIONS LIBRARIES _prefix _name _flags _list _blas _path) |
|
|
|
|
|
|
|
|
|
|
|
set(_libraries_found TRUE) |
|
|
set(_libraries_work FALSE) |
|
|
set(${DEFINITIONS} "") |
|
|
set(${LIBRARIES} "") |
|
|
set(_combined_name) |
|
|
foreach(_library ${_list}) |
|
|
set(_combined_name ${_combined_name}_${_library}) |
|
|
|
|
|
if(_libraries_found) |
|
|
|
|
|
find_library(${_prefix}_${_library}_LIBRARY |
|
|
NAMES ${_library} |
|
|
PATHS ${_path} NO_DEFAULT_PATH |
|
|
) |
|
|
|
|
|
if ( WIN32 ) |
|
|
find_library(${_prefix}_${_library}_LIBRARY |
|
|
NAMES ${_library} |
|
|
PATHS ENV LIB |
|
|
) |
|
|
elseif ( APPLE ) |
|
|
find_library(${_prefix}_${_library}_LIBRARY |
|
|
NAMES ${_library} |
|
|
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH |
|
|
) |
|
|
else () |
|
|
find_library(${_prefix}_${_library}_LIBRARY |
|
|
NAMES ${_library} |
|
|
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH |
|
|
) |
|
|
endif() |
|
|
mark_as_advanced(${_prefix}_${_library}_LIBRARY) |
|
|
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) |
|
|
set(_libraries_found ${${_prefix}_${_library}_LIBRARY}) |
|
|
endif(_libraries_found) |
|
|
endforeach(_library ${_list}) |
|
|
if(_libraries_found) |
|
|
set(_libraries_found ${${LIBRARIES}}) |
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
if(_libraries_found AND NOT _libraries_work) |
|
|
set(${DEFINITIONS} "-D${_prefix}_USE_F2C") |
|
|
set(${LIBRARIES} ${_libraries_found}) |
|
|
|
|
|
|
|
|
find_package( F2C QUIET ) |
|
|
if ( F2C_FOUND ) |
|
|
set(${DEFINITIONS} ${${DEFINITIONS}} ${F2C_DEFINITIONS}) |
|
|
set(${LIBRARIES} ${${LIBRARIES}} ${F2C_LIBRARIES}) |
|
|
endif() |
|
|
set(CMAKE_REQUIRED_DEFINITIONS ${${DEFINITIONS}}) |
|
|
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas}) |
|
|
|
|
|
|
|
|
|
|
|
check_function_exists(${_name}_ ${_prefix}_${_name}_${_combined_name}_f2c_WORKS) |
|
|
set(CMAKE_REQUIRED_DEFINITIONS} "") |
|
|
set(CMAKE_REQUIRED_LIBRARIES "") |
|
|
mark_as_advanced(${_prefix}_${_name}_${_combined_name}_f2c_WORKS) |
|
|
set(_libraries_work ${${_prefix}_${_name}_${_combined_name}_f2c_WORKS}) |
|
|
endif(_libraries_found AND NOT _libraries_work) |
|
|
|
|
|
|
|
|
|
|
|
if(_libraries_found AND NOT _libraries_work) |
|
|
set(${DEFINITIONS} "") |
|
|
set(${LIBRARIES} ${_libraries_found}) |
|
|
set(CMAKE_REQUIRED_DEFINITIONS "") |
|
|
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas}) |
|
|
|
|
|
check_function_exists(${_name} ${_prefix}_${_name}${_combined_name}_WORKS) |
|
|
set(CMAKE_REQUIRED_LIBRARIES "") |
|
|
mark_as_advanced(${_prefix}_${_name}${_combined_name}_WORKS) |
|
|
set(_libraries_work ${${_prefix}_${_name}${_combined_name}_WORKS}) |
|
|
endif(_libraries_found AND NOT _libraries_work) |
|
|
|
|
|
|
|
|
if(NOT _libraries_work) |
|
|
set(${DEFINITIONS} "") |
|
|
set(${LIBRARIES} FALSE) |
|
|
endif() |
|
|
|
|
|
|
|
|
endmacro(check_lapack_libraries) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) |
|
|
find_package(BLAS) |
|
|
else() |
|
|
find_package(BLAS REQUIRED) |
|
|
endif() |
|
|
|
|
|
if (NOT BLAS_FOUND) |
|
|
|
|
|
message(STATUS "LAPACK requires BLAS.") |
|
|
set(LAPACK_FOUND FALSE) |
|
|
|
|
|
|
|
|
elseif (LAPACK_LIBRARIES_DIR OR LAPACK_LIBRARIES) |
|
|
|
|
|
set(LAPACK_FOUND TRUE) |
|
|
|
|
|
else() |
|
|
|
|
|
|
|
|
set( LAPACK_INCLUDE_DIR "" ) |
|
|
set( LAPACK_DEFINITIONS "" ) |
|
|
set( LAPACK_LINKER_FLAGS "" ) |
|
|
set( LAPACK_LIBRARIES "" ) |
|
|
set( LAPACK_LIBRARIES_DIR "" ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(NOT LAPACK_LIBRARIES) |
|
|
check_lapack_libraries( |
|
|
LAPACK_DEFINITIONS |
|
|
LAPACK_LIBRARIES |
|
|
LAPACK |
|
|
cheev |
|
|
"" |
|
|
"mkl_lapack" |
|
|
"${BLAS_LIBRARIES}" |
|
|
"${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR" |
|
|
) |
|
|
endif() |
|
|
|
|
|
|
|
|
if(NOT LAPACK_LIBRARIES) |
|
|
check_lapack_libraries( |
|
|
LAPACK_DEFINITIONS |
|
|
LAPACK_LIBRARIES |
|
|
LAPACK |
|
|
cheev |
|
|
"" |
|
|
"acml" |
|
|
"${BLAS_LIBRARIES}" |
|
|
"${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR" |
|
|
) |
|
|
endif() |
|
|
|
|
|
|
|
|
if(NOT LAPACK_LIBRARIES) |
|
|
check_lapack_libraries( |
|
|
LAPACK_DEFINITIONS |
|
|
LAPACK_LIBRARIES |
|
|
LAPACK |
|
|
cheev |
|
|
"" |
|
|
"Accelerate" |
|
|
"${BLAS_LIBRARIES}" |
|
|
"${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR" |
|
|
) |
|
|
endif() |
|
|
|
|
|
if ( NOT LAPACK_LIBRARIES ) |
|
|
check_lapack_libraries( |
|
|
LAPACK_DEFINITIONS |
|
|
LAPACK_LIBRARIES |
|
|
LAPACK |
|
|
cheev |
|
|
"" |
|
|
"vecLib" |
|
|
"${BLAS_LIBRARIES}" |
|
|
"${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR" |
|
|
) |
|
|
endif ( NOT LAPACK_LIBRARIES ) |
|
|
|
|
|
|
|
|
|
|
|
if ( NOT LAPACK_LIBRARIES ) |
|
|
check_lapack_libraries( |
|
|
LAPACK_DEFINITIONS |
|
|
LAPACK_LIBRARIES |
|
|
LAPACK |
|
|
cheev |
|
|
"" |
|
|
"lapack" |
|
|
"${BLAS_LIBRARIES}" |
|
|
"${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR" |
|
|
) |
|
|
endif() |
|
|
|
|
|
if(LAPACK_LIBRARIES_DIR OR LAPACK_LIBRARIES) |
|
|
set(LAPACK_FOUND TRUE) |
|
|
else() |
|
|
set(LAPACK_FOUND FALSE) |
|
|
endif() |
|
|
|
|
|
if(NOT LAPACK_FIND_QUIETLY) |
|
|
if(LAPACK_FOUND) |
|
|
message(STATUS "A library with LAPACK API found.") |
|
|
else(LAPACK_FOUND) |
|
|
if(LAPACK_FIND_REQUIRED) |
|
|
message(FATAL_ERROR "A required library with LAPACK API not found. Please specify library location.") |
|
|
else() |
|
|
message(STATUS "A library with LAPACK API not found. Please specify library location.") |
|
|
endif() |
|
|
endif(LAPACK_FOUND) |
|
|
endif(NOT LAPACK_FIND_QUIETLY) |
|
|
|
|
|
|
|
|
set( LAPACK_INCLUDE_DIR "${LAPACK_INCLUDE_DIR}" |
|
|
CACHE PATH "Directories containing the LAPACK header files" FORCE ) |
|
|
set( LAPACK_DEFINITIONS "${LAPACK_DEFINITIONS}" |
|
|
CACHE STRING "Compilation options to use LAPACK" FORCE ) |
|
|
set( LAPACK_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}" |
|
|
CACHE STRING "Linker flags to use LAPACK" FORCE ) |
|
|
set( LAPACK_LIBRARIES "${LAPACK_LIBRARIES}" |
|
|
CACHE FILEPATH "LAPACK libraries name" FORCE ) |
|
|
set( LAPACK_LIBRARIES_DIR "${LAPACK_LIBRARIES_DIR}" |
|
|
CACHE PATH "Directories containing the LAPACK libraries" FORCE ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endif(NOT BLAS_FOUND) |
|
|
|