FindBLAS works in C/C++ projects without Fortran
This commit is contained in:
parent
a14a8562ea
commit
4f00763814
|
@ -40,16 +40,7 @@
|
||||||
# License text for the above reference.)
|
# License text for the above reference.)
|
||||||
|
|
||||||
get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
|
get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||||
if(NOT _LANGUAGES_ MATCHES Fortran)
|
include(CheckFunctionExists)
|
||||||
if(BLAS_FIND_REQUIRED)
|
|
||||||
message(FATAL_ERROR "FindBLAS is Fortran-only so Fortran must be enabled.")
|
|
||||||
else(BLAS_FIND_REQUIRED)
|
|
||||||
message(STATUS "Looking for BLAS... - NOT found (Fortran not enabled)") #
|
|
||||||
return()
|
|
||||||
endif(BLAS_FIND_REQUIRED)
|
|
||||||
endif(NOT _LANGUAGES_ MATCHES Fortran)
|
|
||||||
|
|
||||||
include(CheckFortranFunctionExists)
|
|
||||||
|
|
||||||
macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads)
|
macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads)
|
||||||
# This macro checks for the existence of the combination of fortran libraries
|
# This macro checks for the existence of the combination of fortran libraries
|
||||||
|
@ -107,7 +98,7 @@ if(_libraries_work)
|
||||||
# Test this combination of libraries.
|
# Test this combination of libraries.
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads})
|
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads})
|
||||||
# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
|
# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
|
||||||
check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
|
check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES)
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
mark_as_advanced(${_prefix}${_combined_name}_WORKS)
|
mark_as_advanced(${_prefix}${_combined_name}_WORKS)
|
||||||
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
|
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
|
||||||
|
@ -300,6 +291,9 @@ endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
|
||||||
|
|
||||||
#BLAS in intel mkl 10 library? (em64t 64bit)
|
#BLAS in intel mkl 10 library? (em64t 64bit)
|
||||||
if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||||
|
if (NOT WIN32)
|
||||||
|
set(LM "-lm")
|
||||||
|
endif ()
|
||||||
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||||
if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
|
if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
@ -340,7 +334,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||||
sgemm
|
sgemm
|
||||||
""
|
""
|
||||||
"mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide"
|
"mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide"
|
||||||
"${CMAKE_THREAD_LIBS_INIT}"
|
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||||
)
|
)
|
||||||
endif(NOT BLAS95_LIBRARIES)
|
endif(NOT BLAS95_LIBRARIES)
|
||||||
else(BLA_F95)
|
else(BLA_F95)
|
||||||
|
@ -352,6 +346,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||||
""
|
""
|
||||||
"mkl_intel;mkl_intel_thread;mkl_core;guide"
|
"mkl_intel;mkl_intel_thread;mkl_core;guide"
|
||||||
"${CMAKE_THREAD_LIBS_INIT}"
|
"${CMAKE_THREAD_LIBS_INIT}"
|
||||||
|
"${LM}"
|
||||||
)
|
)
|
||||||
endif(NOT BLAS_LIBRARIES)
|
endif(NOT BLAS_LIBRARIES)
|
||||||
endif(BLA_F95)
|
endif(BLA_F95)
|
||||||
|
@ -365,7 +360,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||||
sgemm
|
sgemm
|
||||||
""
|
""
|
||||||
"mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
|
"mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
|
||||||
"${CMAKE_THREAD_LIBS_INIT}"
|
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||||
)
|
)
|
||||||
endif(NOT BLAS95_LIBRARIES)
|
endif(NOT BLAS95_LIBRARIES)
|
||||||
else(BLA_F95)
|
else(BLA_F95)
|
||||||
|
@ -376,7 +371,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||||
sgemm
|
sgemm
|
||||||
""
|
""
|
||||||
"mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
|
"mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
|
||||||
"${CMAKE_THREAD_LIBS_INIT}"
|
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||||
)
|
)
|
||||||
endif(NOT BLAS_LIBRARIES)
|
endif(NOT BLAS_LIBRARIES)
|
||||||
endif(BLA_F95)
|
endif(BLA_F95)
|
||||||
|
@ -391,7 +386,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||||
sgemm
|
sgemm
|
||||||
""
|
""
|
||||||
"mkl;guide"
|
"mkl;guide"
|
||||||
"${CMAKE_THREAD_LIBS_INIT}"
|
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||||
)
|
)
|
||||||
endif(NOT BLAS_LIBRARIES)
|
endif(NOT BLAS_LIBRARIES)
|
||||||
#BLAS in intel mkl library? (static, 32bit)
|
#BLAS in intel mkl library? (static, 32bit)
|
||||||
|
@ -402,7 +397,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||||
sgemm
|
sgemm
|
||||||
""
|
""
|
||||||
"mkl_ia32;guide"
|
"mkl_ia32;guide"
|
||||||
"${CMAKE_THREAD_LIBS_INIT}"
|
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||||
)
|
)
|
||||||
endif(NOT BLAS_LIBRARIES)
|
endif(NOT BLAS_LIBRARIES)
|
||||||
#BLAS in intel mkl library? (static, em64t 64bit)
|
#BLAS in intel mkl library? (static, em64t 64bit)
|
||||||
|
@ -413,7 +408,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||||
sgemm
|
sgemm
|
||||||
""
|
""
|
||||||
"mkl_em64t;guide"
|
"mkl_em64t;guide"
|
||||||
"${CMAKE_THREAD_LIBS_INIT}"
|
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||||
)
|
)
|
||||||
endif(NOT BLAS_LIBRARIES)
|
endif(NOT BLAS_LIBRARIES)
|
||||||
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||||
|
|
Loading…
Reference in New Issue