From 14e34187c5ee215a46c90878a0489a123e7dfdfb Mon Sep 17 00:00:00 2001 From: Gregor Burger Date: Fri, 7 Jun 2024 08:25:10 +0200 Subject: [PATCH] also link to CUDA::cufft_static in case of BUILD_SHARED_LIBS=OFF --- modules/cudaarithm/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/cudaarithm/CMakeLists.txt b/modules/cudaarithm/CMakeLists.txt index 6ee7a9f96bb..b1aacd68696 100644 --- a/modules/cudaarithm/CMakeLists.txt +++ b/modules/cudaarithm/CMakeLists.txt @@ -9,6 +9,9 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-d set(extra_dependencies "") set(optional_dependencies "") if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE) + if(UNIX AND NOT BUILD_SHARED_LIBS AND CUDA_VERSION_STRING VERSION_GREATER_EQUAL 9.2 AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.23) + set(CUDA_FFT_LIB_EXT "_static_nocallback") + endif() list(APPEND extra_dependencies CUDA::cudart_static CUDA::nppial${CUDA_LIB_EXT} CUDA::nppc${CUDA_LIB_EXT} CUDA::nppitc${CUDA_LIB_EXT} CUDA::nppig${CUDA_LIB_EXT} CUDA::nppist${CUDA_LIB_EXT} CUDA::nppidei${CUDA_LIB_EXT}) if(HAVE_CUBLAS) list(APPEND optional_dependencies CUDA::cublas${CUDA_LIB_EXT}) @@ -18,7 +21,8 @@ if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE) endif() if(HAVE_CUFFT) # static version requires seperable compilation which is incompatible with opencv's current library structure - list(APPEND optional_dependencies CUDA::cufft) + # the cufft_static_nocallback variant does not requires seperable compilation. callbacks are currently not used. + list(APPEND optional_dependencies CUDA::cufft${CUDA_FFT_LIB_EXT}) endif() else() if(HAVE_CUBLAS)