Skip to content

Commit 6f3d881

Browse files
committed
Merge pull request opencv#8950 from alalek:cmake_mkl_detection
2 parents 8b664d6 + 9496fe4 commit 6f3d881

File tree

2 files changed

+18
-40
lines changed

2 files changed

+18
-40
lines changed

cmake/OpenCVFindLibsPerf.cmake

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,6 @@
22
# Detect other 3rd-party performance and math libraries
33
# ----------------------------------------------------------------------------
44

5-
# --- Lapack ---
6-
# if(WITH_LAPACK)
7-
# if(WIN32)
8-
# set(BLA_STATIC 1)
9-
# endif()
10-
# find_package(LAPACK)
11-
# if(LAPACK_FOUND)
12-
# find_path(LAPACKE_INCLUDE_DIR "lapacke.h")
13-
# find_path(MKL_LAPACKE_INCLUDE_DIR "mkl_lapack.h")
14-
# if(LAPACKE_INCLUDE_DIR)
15-
# ocv_include_directories(${LAPACKE_INCLUDE_DIR})
16-
# set(HAVE_LAPACK 1)
17-
# set(HAVE_LAPACK_GENERIC 1)
18-
# elseif(MKL_LAPACKE_INCLUDE_DIR)
19-
# ocv_include_directories(${MKL_LAPACKE_INCLUDE_DIR})
20-
# set(HAVE_LAPACK 1)
21-
# set(HAVE_LAPACK_MKL 1)
22-
# elseif(APPLE)
23-
# set(HAVE_LAPACK 1)
24-
# set(HAVE_LAPACK_APPLE 1)
25-
# endif()
26-
# list(APPEND OPENCV_LINKER_LIBS ${LAPACK_LIBRARIES})
27-
# endif()
28-
# endif()
29-
305
# --- TBB ---
316
if(WITH_TBB)
327
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectTBB.cmake")

cmake/OpenCVFindMKL.cmake

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#
88
# On return this will define:
99
#
10-
# HAVE_MKL - True if Intel IPP found
11-
# MKL_ROOT_DIR - root of IPP installation
12-
# MKL_INCLUDE_DIRS - IPP include folder
13-
# MKL_LIBRARIES - IPP libraries that are used by OpenCV
10+
# HAVE_MKL - True if Intel MKL found
11+
# MKL_ROOT_DIR - root of MKL installation
12+
# MKL_INCLUDE_DIRS - MKL include folder
13+
# MKL_LIBRARIES - MKL libraries that are used by OpenCV
1414
#
1515

1616
macro (mkl_find_lib VAR NAME DIRS)
@@ -21,7 +21,7 @@ endmacro()
2121

2222
macro(mkl_fail)
2323
set(HAVE_MKL OFF)
24-
set(MKL_ROOT_DIR ${MKL_ROOT_DIR} CACHE PATH "Path to MKL directory")
24+
set(MKL_ROOT_DIR "${MKL_ROOT_DIR}" CACHE PATH "Path to MKL directory")
2525
return()
2626
endmacro()
2727

@@ -46,23 +46,26 @@ if(NOT DEFINED MKL_USE_MULTITHREAD)
4646
endif()
4747

4848
#check current MKL_ROOT_DIR
49-
if(NOT MKL_ROOT_DIR OR NOT EXISTS ${MKL_ROOT_DIR}/include/mkl.h)
50-
set(mkl_root_paths ${MKL_ROOT_DIR})
49+
if(NOT MKL_ROOT_DIR OR NOT EXISTS "${MKL_ROOT_DIR}/include/mkl.h")
50+
set(mkl_root_paths "${MKL_ROOT_DIR}")
5151
if(DEFINED ENV{MKLROOT})
52-
list(APPEND mkl_root_paths $ENV{MKLROOT})
52+
list(APPEND mkl_root_paths "$ENV{MKLROOT}")
5353
endif()
54-
if(WIN32)
54+
55+
if(WITH_MKL AND NOT mkl_root_paths)
56+
if(WIN32)
5557
set(ProgramFilesx86 "ProgramFiles(x86)")
5658
list(APPEND mkl_root_paths $ENV{${ProgramFilesx86}}/IntelSWTools/compilers_and_libraries/windows/mkl)
57-
endif()
58-
if(UNIX)
59+
endif()
60+
if(UNIX)
5961
list(APPEND mkl_root_paths "/opt/intel/mkl")
62+
endif()
6063
endif()
6164

6265
find_path(MKL_ROOT_DIR include/mkl.h PATHS ${mkl_root_paths})
6366
endif()
6467

65-
set(MKL_INCLUDE_DIRS ${MKL_ROOT_DIR}/include CACHE PATH "Path to MKL include directory")
68+
set(MKL_INCLUDE_DIRS "${MKL_ROOT_DIR}/include" CACHE PATH "Path to MKL include directory")
6669

6770
if(NOT MKL_ROOT_DIR
6871
OR NOT EXISTS "${MKL_ROOT_DIR}"
@@ -128,9 +131,9 @@ endforeach()
128131

129132
message(STATUS "Found MKL ${MKL_VERSION_STR} at: ${MKL_ROOT_DIR}")
130133
set(HAVE_MKL ON)
131-
set(MKL_ROOT_DIR ${MKL_ROOT_DIR} CACHE PATH "Path to MKL directory")
132-
set(MKL_INCLUDE_DIRS ${MKL_INCLUDE_DIRS} CACHE PATH "Path to MKL include directory")
133-
set(MKL_LIBRARIES ${MKL_LIBRARIES} CACHE STRING "MKL libarries")
134+
set(MKL_ROOT_DIR "${MKL_ROOT_DIR}" CACHE PATH "Path to MKL directory")
135+
set(MKL_INCLUDE_DIRS "${MKL_INCLUDE_DIRS}" CACHE PATH "Path to MKL include directory")
136+
set(MKL_LIBRARIES "${MKL_LIBRARIES}" CACHE STRING "MKL libarries")
134137
if(UNIX AND NOT MKL_LIBRARIES_DONT_HACK)
135138
#it's ugly but helps to avoid cyclic lib problem
136139
set(MKL_LIBRARIES ${MKL_LIBRARIES} ${MKL_LIBRARIES} ${MKL_LIBRARIES} "-lpthread" "-lm" "-ldl")

0 commit comments

Comments
 (0)