mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Made cmake avoid using the Intel MKL when building mex files since it will
often create a conflict with MATLAB's copy of the MKL.
This commit is contained in:
parent
c029600a26
commit
b6b62fa2b1
@ -47,40 +47,43 @@ if (UNIX)
|
||||
include(CheckLibraryExists)
|
||||
|
||||
|
||||
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt
|
||||
# file first since this way avoids linking bugs in some cases.
|
||||
find_library(mkl_rt mkl_rt ${mkl_search_path})
|
||||
mark_as_advanced( mkl_rt )
|
||||
# if we found the MKL
|
||||
if ( mkl_rt)
|
||||
set(blas_libraries ${mkl_rt} )
|
||||
set(lapack_libraries ${mkl_rt} )
|
||||
set(blas_found 1)
|
||||
set(lapack_found 1)
|
||||
set(found_intel_mkl 1)
|
||||
message(STATUS "Found Intel MKL BLAS/LAPACK library")
|
||||
endif()
|
||||
# Don't try to use the Intel MKL when we are building a MATLAB mex file
|
||||
# since it will usually conflict with MATLAB's copy of the MKL and cause
|
||||
# problems.
|
||||
if (NOT BUILDING_MATLAB_MEX_FILE)
|
||||
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt
|
||||
# file first since this way avoids linking bugs in some cases.
|
||||
find_library(mkl_rt mkl_rt ${mkl_search_path})
|
||||
mark_as_advanced( mkl_rt )
|
||||
# if we found the MKL
|
||||
if ( mkl_rt)
|
||||
set(blas_libraries ${mkl_rt} )
|
||||
set(lapack_libraries ${mkl_rt} )
|
||||
set(blas_found 1)
|
||||
set(lapack_found 1)
|
||||
set(found_intel_mkl 1)
|
||||
message(STATUS "Found Intel MKL BLAS/LAPACK library")
|
||||
endif()
|
||||
|
||||
if (NOT found_intel_mkl)
|
||||
# Search for the needed libraries from the MKL. This time try looking for a different
|
||||
# set of MKL files and try to link against those.
|
||||
find_library(mkl_core mkl_core ${mkl_search_path})
|
||||
find_library(mkl_thread mkl_intel_thread ${mkl_search_path})
|
||||
find_library(mkl_iomp iomp5 ${mkl_search_path})
|
||||
find_library(mkl_pthread pthread ${mkl_search_path})
|
||||
|
||||
|
||||
if (NOT found_intel_mkl)
|
||||
# Search for the needed libraries from the MKL. This time try looking for a different
|
||||
# set of MKL files and try to link against those.
|
||||
find_library(mkl_core mkl_core ${mkl_search_path})
|
||||
find_library(mkl_thread mkl_intel_thread ${mkl_search_path})
|
||||
find_library(mkl_iomp iomp5 ${mkl_search_path})
|
||||
find_library(mkl_pthread pthread ${mkl_search_path})
|
||||
|
||||
mark_as_advanced( mkl_intel mkl_core mkl_thread mkl_iomp mkl_pthread)
|
||||
# If we found the MKL
|
||||
if (mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp AND mkl_pthread)
|
||||
set(blas_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
|
||||
set(lapack_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
|
||||
set(blas_found 1)
|
||||
set(lapack_found 1)
|
||||
set(found_intel_mkl 1)
|
||||
message(STATUS "Found Intel MKL BLAS/LAPACK library")
|
||||
endif()
|
||||
mark_as_advanced( mkl_intel mkl_core mkl_thread mkl_iomp mkl_pthread)
|
||||
# If we found the MKL
|
||||
if (mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp AND mkl_pthread)
|
||||
set(blas_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
|
||||
set(lapack_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
|
||||
set(blas_found 1)
|
||||
set(lapack_found 1)
|
||||
set(found_intel_mkl 1)
|
||||
message(STATUS "Found Intel MKL BLAS/LAPACK library")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@ -96,6 +99,7 @@ if (UNIX)
|
||||
/usr/lib/atlas
|
||||
/usr/lib/openblas-base
|
||||
/opt/OpenBLAS/lib
|
||||
$ENV{OPENBLAS_HOME}/lib
|
||||
)
|
||||
|
||||
INCLUDE (CheckFunctionExists)
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.4)
|
||||
|
||||
set(BUILDING_MATLAB_MEX_FILE true)
|
||||
|
||||
# Find MATLAB's include directory and needed libraries
|
||||
find_program(MATLAB_EXECUTABLE matlab PATHS
|
||||
|
Loading…
Reference in New Issue
Block a user