-
Notifications
You must be signed in to change notification settings - Fork 218
/
FindMKL.cmake
73 lines (63 loc) · 1.79 KB
/
FindMKL.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Find Intel Math Karnel Library (MKL)
#
# Options
# - MKL_DIR MKL root directory
# - MKL_OPENMP use OpenMP threading
#
# Results
# - MKL_INCLUDE_DIR
# - MKL_LIBRARIES
#
# Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
# Distributed under a Modified BSD License.
# See accompanying file LICENSE.txt or
# http://www.opengeosys.org/project/license
# Lookg for MKL root dir
if (NOT MKL_DIR)
find_path(MKL_DIR
include/mkl.h
PATHS
$ENV{MKL_DIR}
/opt/intel/mkl/
)
endif()
if(MKL_DIR)
message(STATUS "MKL_DIR : ${MKL_DIR}")
endif()
# Find MKL include dir
find_path(MKL_INCLUDE_DIR NAMES mkl.h
PATHS
${MKL_DIR}/include
PATH_SUFFIXES
mkl
)
# Set the directory path storing MKL libraries
if (NOT MKL_LIB_DIR)
if(APPLE)
set(MKL_LIB_DIR ${MKL_DIR}/lib)
else()
if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(MKL_LIB_DIR ${MKL_DIR}/lib/intel64)
else()
set(MKL_LIB_DIR ${MKL_DIR}/lib/ia32)
endif()
endif()
endif()
# Find MKL libs
find_library(MKL_LIB_CORE mkl_core PATHS ${MKL_LIB_DIR})
if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(MKL_INTEL_LIB_NAME mkl_intel_lp64)
else()
set(MKL_INTEL_LIB_NAME mkl_intel)
endif()
find_library(MKL_LIB_INTEL ${MKL_INTEL_LIB_NAME} PATHS ${MKL_LIB_DIR})
if(OPENMP_FOUND)
set(MKL_THREAD_LIB_NAME "mkl_gnu_thread")
else()
set(MKL_THREAD_LIB_NAME "mkl_sequential")
endif()
find_library(MKL_LIB_THREAD ${MKL_THREAD_LIB_NAME} PATHS ${MKL_LIB_DIR})
set(MKL_LIBRARIES "${MKL_LIB_INTEL}" "${MKL_LIB_THREAD}" "${MKL_LIB_CORE}")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MKL DEFAULT_MSG MKL_INCLUDE_DIR MKL_LIBRARIES)
mark_as_advanced(MKL_INCLUDE_DIR MKL_LIBRARIES)