[cudnn] remove hardcoded version in cmake module (#3738)

collateral fixes: 
* handle opencv4 upgrade on vcpkg
* add yasm (ffmpeg prerequisite) on travis
* install ffmpeg separately from opencv to circumvent time limits
* build only release to halve ci time
* do not build as shared libs when using vcpkg, since default triplets are static
* remove debug configs from appveyor matrix
This commit is contained in:
Stefano Sinigardi
2019-08-24 13:46:45 +02:00
committed by GitHub
parent 4c315ea26b
commit 35346d2ef8
4 changed files with 37 additions and 46 deletions

View File

@ -34,10 +34,7 @@ if(NOT CUDNN_LIBRARY)
PATH_SUFFIXES lib lib64 cuda/lib cuda/lib64 lib/x64)
endif()
find_package_handle_standard_args(
CUDNN DEFAULT_MSG CUDNN_INCLUDE_DIR CUDNN_LIBRARY)
if(CUDNN_FOUND)
if(EXISTS "${CUDNN_INCLUDE_DIR}/cudnn.h")
file(READ ${CUDNN_INCLUDE_DIR}/cudnn.h CUDNN_HEADER_CONTENTS)
string(REGEX MATCH "define CUDNN_MAJOR * +([0-9]+)"
CUDNN_VERSION_MAJOR "${CUDNN_HEADER_CONTENTS}")
@ -60,21 +57,17 @@ endif()
set(CUDNN_INCLUDE_DIRS ${CUDNN_INCLUDE_DIR})
set(CUDNN_LIBRARIES ${CUDNN_LIBRARY})
if(CUDNN_FOUND)
message(STATUS "Found cuDNN: v${CUDNN_VERSION} (include: ${CUDNN_INCLUDE_DIR}, library: ${CUDNN_LIBRARY})")
endif()
mark_as_advanced(CUDNN_LIBRARY CUDNN_INCLUDE_DIR)
# Register imported libraries:
# 1. If we can find a Windows .dll file (or if we can find both Debug and
# Release libraries), we will set appropriate target properties for these.
# 2. However, for most systems, we will only register the import location and
# include directory.
find_package_handle_standard_args(CUDNN
REQUIRED_VARS CUDNN_INCLUDE_DIR CUDNN_LIBRARY
VERSION_VAR CUDNN_VERSION
)
if(WIN32)
set(CUDNN_DLL_DIR ${CUDNN_INCLUDE_DIR})
list(TRANSFORM CUDNN_DLL_DIR APPEND "/../bin")
message(STATUS "CUDNN_DLL_DIR: ${CUDNN_DLL_DIR}")
find_file(CUDNN_LIBRARY_DLL NAMES cudnn64_7.dll PATHS ${CUDNN_DLL_DIR})
find_file(CUDNN_LIBRARY_DLL NAMES cudnn64_${CUDNN_VERSION_MAJOR}.dll PATHS ${CUDNN_DLL_DIR})
endif()
if( CUDNN_FOUND AND NOT TARGET CuDNN::CuDNN )