Cut path to CUDA libraries to prevent generation of OpenCVModules.cmake with abs path.

pull/2449/head
Alexander Smorkalov 11 years ago
parent a1e5bd71f1
commit 284b2fc1e7
  1. 11
      CMakeLists.txt
  2. 6
      cmake/OpenCVDetectAndroidSDK.cmake
  3. 39
      cmake/OpenCVDetectCUDA.cmake

@ -467,7 +467,6 @@ include(cmake/OpenCVFindLibsGUI.cmake)
include(cmake/OpenCVFindLibsVideo.cmake)
include(cmake/OpenCVFindLibsPerf.cmake)
# ----------------------------------------------------------------------------
# Detect other 3rd-party libraries/tools
# ----------------------------------------------------------------------------
@ -513,16 +512,6 @@ if(NOT HAVE_CUDA)
set(ENABLE_DYNAMIC_CUDA OFF)
endif()
if(HAVE_CUDA AND NOT ENABLE_DYNAMIC_CUDA)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
if(HAVE_CUBLAS)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cublas_LIBRARY})
endif()
if(HAVE_CUFFT)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cufft_LIBRARY})
endif()
endif()
# ----------------------------------------------------------------------------
# Solution folders:
# ----------------------------------------------------------------------------

@ -326,12 +326,12 @@ macro(add_android_project target path)
# copy all needed CUDA libs to project if EMBED_CUDA flag is present
if(android_proj_EMBED_CUDA)
set(android_proj_culibs ${CUDA_npp_LIBRARY} ${CUDA_LIBRARIES})
set(android_proj_culibs ${CUDA_npp_LIBRARY_ABS} ${CUDA_LIBRARIES_ABS})
if(HAVE_CUFFT)
list(INSERT android_proj_culibs 0 ${CUDA_cufft_LIBRARY})
list(INSERT android_proj_culibs 0 ${CUDA_cufft_LIBRARY_ABS})
endif()
if(HAVE_CUBLAS)
list(INSERT android_proj_culibs 0 ${CUDA_cublas_LIBRARY})
list(INSERT android_proj_culibs 0 ${CUDA_cublas_LIBRARY_ABS})
endif()
foreach(lib ${android_proj_culibs})
get_filename_component(f "${lib}" NAME)

@ -219,3 +219,42 @@ else()
unset(CUDA_ARCH_BIN CACHE)
unset(CUDA_ARCH_PTX CACHE)
endif()
if(HAVE_CUDA)
set(CUDA_LIBS_PATH "")
foreach(p ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
get_filename_component(_tmp ${p} PATH)
list(APPEND CUDA_LIBS_PATH ${_tmp})
endforeach()
if(HAVE_CUBLAS)
foreach(p ${CUDA_cublas_LIBRARY})
get_filename_component(_tmp ${p} PATH)
list(APPEND CUDA_LIBS_PATH ${_tmp})
endforeach()
endif()
if(HAVE_CUFFT)
foreach(p ${CUDA_cufft_LIBRARY})
get_filename_component(_tmp ${p} PATH)
list(APPEND CUDA_LIBS_PATH ${_tmp})
endforeach()
endif()
list(REMOVE_DUPLICATES CUDA_LIBS_PATH)
link_directories(${CUDA_LIBS_PATH})
set(CUDA_LIBRARIES_ABS ${CUDA_LIBRARIES})
ocv_convert_to_lib_name(CUDA_LIBRARIES ${CUDA_LIBRARIES})
set(CUDA_npp_LIBRARY_ABS ${CUDA_npp_LIBRARY})
ocv_convert_to_lib_name(CUDA_npp_LIBRARY ${CUDA_npp_LIBRARY})
if(HAVE_CUBLAS)
set(CUDA_cublas_LIBRARY_ABS ${CUDA_cublas_LIBRARY})
ocv_convert_to_lib_name(CUDA_cublas_LIBRARY ${CUDA_cublas_LIBRARY})
endif()
if(HAVE_CUFFT)
set(CUDA_cufft_LIBRARY_ABS ${CUDA_cufft_LIBRARY})
ocv_convert_to_lib_name(CUDA_cufft_LIBRARY ${CUDA_cufft_LIBRARY})
endif()
endif()
Loading…
Cancel
Save