123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- include(CheckFunctionExists)
- include(CMakeFindDependencyMacro)
- 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()
- endforeach()
- 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_dependency( 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()
-
-
- 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()
-
- if(NOT _libraries_work)
- set(${DEFINITIONS} "")
- set(${LIBRARIES} FALSE)
- endif()
-
-
- endmacro()
- if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
- find_dependency(BLAS)
- else()
- find_dependency(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 ()
-
-
- 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()
- 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()
- endif()
-
- 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()
|