summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Shelhamer <shelhamer@imaginarynumber.net>2016-08-19 23:18:36 -0700
committerGitHub <noreply@github.com>2016-08-19 23:18:36 -0700
commit14643685a4693df0ea8364f4688211316ffb8ba1 (patch)
tree2ed7fb2de8350ca2630605c2236a7f4f0f3136cc
parent2b55c9302793e293183c00dabef94d20adbd852d (diff)
parent1110d2ba7b52c35f898da8febdd53524761ecb97 (diff)
downloadcaffeonacl-14643685a4693df0ea8364f4688211316ffb8ba1.tar.gz
caffeonacl-14643685a4693df0ea8364f4688211316ffb8ba1.tar.bz2
caffeonacl-14643685a4693df0ea8364f4688211316ffb8ba1.zip
Merge pull request #4605 from shelhamer/osx-cudnn-dylib
[build] Help CMake Find cuDNN on OS X
-rw-r--r--cmake/Cuda.cmake15
1 files changed, 11 insertions, 4 deletions
diff --git a/cmake/Cuda.cmake b/cmake/Cuda.cmake
index 286a4280..eeeb7325 100644
--- a/cmake/Cuda.cmake
+++ b/cmake/Cuda.cmake
@@ -174,11 +174,18 @@ function(detect_cuDNN)
PATHS ${CUDNN_ROOT} $ENV{CUDNN_ROOT} ${CUDA_TOOLKIT_INCLUDE}
DOC "Path to cuDNN include directory." )
- get_filename_component(__libpath_hist ${CUDA_CUDART_LIBRARY} PATH)
- find_library(CUDNN_LIBRARY NAMES libcudnn.so # libcudnn_static.a
- PATHS ${CUDNN_ROOT} $ENV{CUDNN_ROOT} ${CUDNN_INCLUDE} ${__libpath_hist}
- DOC "Path to cuDNN library.")
+ # dynamic libs have different suffix in mac and linux
+ if(APPLE)
+ set(CUDNN_LIB_NAME "libcudnn.dylib")
+ else()
+ set(CUDNN_LIB_NAME "libcudnn.so")
+ endif()
+ get_filename_component(__libpath_hist ${CUDA_CUDART_LIBRARY} PATH)
+ find_library(CUDNN_LIBRARY NAMES ${CUDNN_LIB_NAME}
+ PATHS ${CUDNN_ROOT} $ENV{CUDNN_ROOT} ${CUDNN_INCLUDE} ${__libpath_hist} ${__libpath_hist}/../lib
+ DOC "Path to cuDNN library.")
+
if(CUDNN_INCLUDE AND CUDNN_LIBRARY)
set(HAVE_CUDNN TRUE PARENT_SCOPE)
set(CUDNN_FOUND TRUE PARENT_SCOPE)