Commit e1df1968 authored by Davis King's avatar Davis King

Include the Intel MKL's iomp dll in the output folder to reduce confusino for windows users.

parent ccd8b64f
No related merge requests found
......@@ -9,6 +9,9 @@ cmake_minimum_required(VERSION 2.8.12)
if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()
project(dlib)
......@@ -954,4 +957,22 @@ if (COMMAND pybind11_add_module)
set_target_properties(dlib PROPERTIES CUDA_VISIBILITY_PRESET "hidden")
endif()
if (WIN32 AND mkl_iomp_dll)
# If we are using the Intel MKL on windows then try and copy the iomp dll
# file to the output folder. We do this since a very large number of
# windows users don't understand that they need to add the Intel MKL's
# folders to their PATH to use the Intel MKL. They then complain on the
# dlib forums. Copying the Intel MKL dlls to the output directory removes
# the need to add the Intel MKL to the PATH.
if (CMAKE_LIBRARY_OUTPUT_DIRECTORY)
add_custom_command(TARGET dlib POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${mkl_iomp_dll}" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
)
else()
add_custom_command(TARGET dlib POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${mkl_iomp_dll}" ${CMAKE_BINARY_DIR}/$<CONFIG>
)
endif()
endif()
add_library(dlib::dlib ALIAS dlib)
......@@ -302,6 +302,7 @@ elseif(WIN32 AND NOT MINGW)
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_*/windows/compiler/lib/intel64"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/tbb/lib/intel64/vc14"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/tbb/lib/intel64/vc_mt"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/compiler/lib/intel64"
"C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64"
"C:/Program Files (x86)/Intel/Composer XE/tbb/lib/intel64/vc14"
......@@ -310,6 +311,9 @@ elseif(WIN32 AND NOT MINGW)
"C:/Program Files/Intel/Composer XE/tbb/lib/intel64/vc14"
"C:/Program Files/Intel/Composer XE/compiler/lib/intel64"
)
set (mkl_redist_path
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/redist/intel64/compiler"
)
find_library(mkl_intel mkl_intel_lp64 ${mkl_search_path})
else()
set( mkl_search_path
......@@ -318,6 +322,7 @@ elseif(WIN32 AND NOT MINGW)
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_*/windows/compiler/lib/ia32"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/ia32"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/tbb/lib/ia32/vc14"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/tbb/lib/ia32/vc_mt"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/compiler/lib/ia32"
"C:/Program Files (x86)/Intel/Composer XE/mkl/lib/ia32"
"C:/Program Files (x86)/Intel/Composer XE/tbb/lib/ia32/vc14"
......@@ -326,6 +331,9 @@ elseif(WIN32 AND NOT MINGW)
"C:/Program Files/Intel/Composer XE/tbb/lib/ia32/vc14"
"C:/Program Files/Intel/Composer XE/compiler/lib/ia32"
)
set (mkl_redist_path
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/redist/ia32/compiler"
)
find_library(mkl_intel mkl_intel_c ${mkl_search_path})
endif()
......@@ -363,6 +371,18 @@ elseif(WIN32 AND NOT MINGW)
find_library(mkl_iomp libiomp5md ${mkl_search_path})
mark_as_advanced(mkl_thread mkl_iomp)
list(APPEND mkl_libs ${mkl_thread} ${mkl_iomp})
if (mkl_iomp)
# See if we can find the dll that goes with this, so we can copy it to
# the output folder, since a very large number of windows users don't
# understand that they need to add the Intel MKL's folders to their
# PATH to use the Intel MKL. They then complain on the dlib forums.
# Copying the Intel MKL dlls to the output directory removes the need
# to add the Intel MKL to the PATH.
find_file(mkl_iomp_dll "libiomp5md.dll" ${mkl_redist_path})
if (mkl_iomp_dll)
message(STATUS "FOUND libiomp5md.dll: ${mkl_iomp_dll}")
endif()
endif()
endif()
# If we found the MKL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment