|
|
|
@ -362,7 +362,7 @@ if(CUDA_FOUND) |
|
|
|
|
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --use_fast_math) |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
OCV_OPTION(CUDA_ENABLE_DELAYLOAD "Enable delayed loading of CUDA DLLs" OFF VISIBLE_IF MSVC AND (CMAKE_GENERATOR MATCHES "Visual Studio")) |
|
|
|
|
OCV_OPTION(CUDA_ENABLE_DELAYLOAD "Enable delayed loading of CUDA DLLs" OFF VISIBLE_IF MSVC) |
|
|
|
|
|
|
|
|
|
mark_as_advanced(CUDA_BUILD_CUBIN CUDA_BUILD_EMULATION CUDA_VERBOSE_BUILD CUDA_SDK_ROOT_DIR) |
|
|
|
|
|
|
|
|
@ -565,13 +565,17 @@ if(HAVE_CUDA) |
|
|
|
|
endforeach() |
|
|
|
|
|
|
|
|
|
if(MSVC AND CUDA_ENABLE_DELAYLOAD) |
|
|
|
|
set(DELAYFLAGS "delayimp.lib") |
|
|
|
|
file(GLOB CUDA_DLLS "${CUDA_TOOLKIT_ROOT_DIR}/bin/*.dll") |
|
|
|
|
foreach(d ${CUDA_DLLS}) |
|
|
|
|
cmake_path(GET "d" FILENAME DLL_NAME) |
|
|
|
|
if(NOT ${DLL_NAME} MATCHES "cudart") |
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:${DLL_NAME}") |
|
|
|
|
set(DELAYFLAGS "${DELAYFLAGS} /DELAYLOAD:${DLL_NAME}") |
|
|
|
|
endif() |
|
|
|
|
endforeach() |
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /IGNORE:4199") |
|
|
|
|
set(DELAYFLAGS "${DELAYFLAGS} /DELAYLOAD:nvcuda.dll /DELAYLOAD:nvml.dll /IGNORE:4199") |
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${DELAYFLAGS}") |
|
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${DELAYFLAGS}") |
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${DELAYFLAGS}") |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|