mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 03:30:34 +08:00
Merge pull request #793 from SpecLad:auto-cuda
This commit is contained in:
commit
62b593ca8b
@ -432,11 +432,19 @@ macro(ocv_glob_module_sources)
|
||||
file(GLOB lib_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
||||
file(GLOB lib_hdrs_detail "include/opencv2/${name}/detail/*.hpp" "include/opencv2/${name}/detail/*.h")
|
||||
|
||||
file(GLOB cl_kernels "src/opencl/*.cl")
|
||||
file(GLOB lib_cuda_srcs "src/cuda/*.cu")
|
||||
set(cuda_objs "")
|
||||
set(lib_cuda_hdrs "")
|
||||
|
||||
source_group("Src" FILES ${lib_srcs} ${lib_int_hdrs})
|
||||
source_group("Include" FILES ${lib_hdrs})
|
||||
source_group("Include\\detail" FILES ${lib_hdrs_detail})
|
||||
if(HAVE_CUDA AND lib_cuda_srcs)
|
||||
ocv_include_directories(${CUDA_INCLUDE_DIRS})
|
||||
file(GLOB lib_cuda_hdrs "src/cuda/*.hpp")
|
||||
|
||||
ocv_cuda_compile(cuda_objs ${lib_cuda_srcs} ${lib_cuda_hdrs})
|
||||
source_group("Src\\Cuda" FILES ${lib_cuda_srcs} ${lib_cuda_hdrs})
|
||||
endif()
|
||||
|
||||
file(GLOB cl_kernels "src/opencl/*.cl")
|
||||
|
||||
if(HAVE_OPENCL AND cl_kernels)
|
||||
ocv_include_directories(${OPENCL_INCLUDE_DIRS})
|
||||
@ -448,7 +456,12 @@ macro(ocv_glob_module_sources)
|
||||
list(APPEND lib_srcs ${cl_kernels} "${CMAKE_CURRENT_BINARY_DIR}/kernels.cpp")
|
||||
endif()
|
||||
|
||||
ocv_set_module_sources(${ARGN} HEADERS ${lib_hdrs} ${lib_hdrs_detail} SOURCES ${lib_srcs} ${lib_int_hdrs})
|
||||
source_group("Src" FILES ${lib_srcs} ${lib_int_hdrs})
|
||||
source_group("Include" FILES ${lib_hdrs})
|
||||
source_group("Include\\detail" FILES ${lib_hdrs_detail})
|
||||
|
||||
ocv_set_module_sources(${ARGN} HEADERS ${lib_hdrs} ${lib_hdrs_detail}
|
||||
SOURCES ${lib_srcs} ${lib_int_hdrs} ${cuda_objs} ${lib_cuda_srcs} ${lib_cuda_hdrs})
|
||||
endmacro()
|
||||
|
||||
# creates OpenCV module in current folder
|
||||
@ -461,6 +474,9 @@ macro(ocv_create_module)
|
||||
|
||||
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
|
||||
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
|
||||
if (HAVE_CUDA)
|
||||
target_link_libraries(${the_module} ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
||||
endif()
|
||||
if(HAVE_OPENCL AND OPENCL_LIBRARIES)
|
||||
target_link_libraries(${the_module} ${OPENCL_LIBRARIES})
|
||||
endif()
|
||||
@ -545,8 +561,8 @@ endmacro()
|
||||
# ocv_define_module(module_name [INTERNAL] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>])
|
||||
macro(ocv_define_module module_name)
|
||||
ocv_add_module(${module_name} ${ARGN})
|
||||
ocv_glob_module_sources()
|
||||
ocv_module_include_directories()
|
||||
ocv_glob_module_sources()
|
||||
ocv_create_module()
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
|
||||
|
@ -3,25 +3,21 @@ ocv_add_module(core ${ZLIB_LIBRARIES})
|
||||
ocv_module_include_directories(${ZLIB_INCLUDE_DIR})
|
||||
|
||||
if(HAVE_CUDA)
|
||||
ocv_source_group("Src\\Cuda" GLOB "src/cuda/*.cu")
|
||||
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/include" ${CUDA_INCLUDE_DIRS})
|
||||
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/include")
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
|
||||
|
||||
file(GLOB lib_cuda "src/cuda/*.cu")
|
||||
ocv_cuda_compile(cuda_objs ${lib_cuda})
|
||||
|
||||
set(cuda_link_libs ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
||||
else()
|
||||
set(lib_cuda "")
|
||||
set(cuda_objs "")
|
||||
set(cuda_link_libs "")
|
||||
endif()
|
||||
|
||||
ocv_glob_module_sources(SOURCES ${lib_cuda} ${cuda_objs} "${opencv_core_BINARY_DIR}/version_string.inc")
|
||||
file(GLOB lib_cuda_hdrs "include/opencv2/${name}/cuda/*.hpp" "include/opencv2/${name}/cuda/*.h")
|
||||
file(GLOB lib_cuda_hdrs_detail "include/opencv2/${name}/cuda/detail/*.hpp" "include/opencv2/${name}/cuda/detail/*.h")
|
||||
|
||||
ocv_create_module(${cuda_link_libs})
|
||||
source_group("Cuda Headers" FILES ${lib_cuda_hdrs})
|
||||
source_group("Cuda Headers\\Detail" FILES ${lib_cuda_hdrs_detail})
|
||||
|
||||
ocv_glob_module_sources(SOURCES "${opencv_core_BINARY_DIR}/version_string.inc"
|
||||
HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
|
||||
|
||||
ocv_create_module()
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
|
||||
ocv_add_accuracy_tests()
|
||||
ocv_add_perf_tests()
|
||||
|
||||
|
@ -3,28 +3,5 @@ if(BUILD_ANDROID_PACKAGE)
|
||||
endif()
|
||||
|
||||
set(the_description "Functionality with possible limitations on the use")
|
||||
ocv_add_module(nonfree opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_gpu opencv_ocl)
|
||||
ocv_module_include_directories()
|
||||
|
||||
if(HAVE_CUDA AND HAVE_opencv_gpu)
|
||||
ocv_source_group("Src\\Cuda" GLOB "src/cuda/*.cu")
|
||||
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/include" ${CUDA_INCLUDE_DIRS})
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
|
||||
|
||||
file(GLOB lib_cuda "src/cuda/*.cu")
|
||||
ocv_cuda_compile(cuda_objs ${lib_cuda})
|
||||
|
||||
set(cuda_link_libs ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
||||
else()
|
||||
set(lib_cuda "")
|
||||
set(cuda_objs "")
|
||||
set(cuda_link_libs "")
|
||||
endif()
|
||||
|
||||
ocv_glob_module_sources(SOURCES ${lib_cuda} ${cuda_objs})
|
||||
|
||||
ocv_create_module(${cuda_link_libs})
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
|
||||
ocv_add_accuracy_tests()
|
||||
ocv_add_perf_tests()
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
|
||||
ocv_define_module(nonfree opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_gpu opencv_ocl)
|
||||
|
@ -40,7 +40,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#if !defined CUDA_DISABLER
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
|
||||
#include "opencv2/gpu/device/common.hpp"
|
||||
#include "opencv2/gpu/device/limits.hpp"
|
||||
@ -956,4 +958,4 @@ namespace cv { namespace gpu { namespace device
|
||||
}}} // namespace cv { namespace gpu { namespace device
|
||||
|
||||
|
||||
#endif /* CUDA_DISABLER */
|
||||
#endif /* HAVE_OPENCV_GPU */
|
||||
|
@ -40,7 +40,9 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#if !defined CUDA_DISABLER
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
|
||||
#include "opencv2/gpu/device/common.hpp"
|
||||
|
||||
@ -266,5 +268,4 @@ namespace cv { namespace gpu { namespace device
|
||||
}
|
||||
}}}
|
||||
|
||||
|
||||
#endif /* CUDA_DISABLER */
|
||||
#endif /* HAVE_OPENCV_GPU */
|
||||
|
@ -3,29 +3,5 @@ if(ANDROID OR IOS)
|
||||
endif()
|
||||
|
||||
set(the_description "Super Resolution")
|
||||
ocv_add_module(superres opencv_imgproc opencv_video OPTIONAL opencv_gpu opencv_highgui)
|
||||
ocv_module_include_directories()
|
||||
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef /wd4127)
|
||||
|
||||
if(HAVE_CUDA)
|
||||
ocv_source_group("Src\\Cuda" GLOB "src/cuda/*.cu")
|
||||
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/include" ${CUDA_INCLUDE_DIRS})
|
||||
|
||||
file(GLOB lib_cuda "src/cuda/*.cu")
|
||||
ocv_cuda_compile(cuda_objs ${lib_cuda})
|
||||
|
||||
set(cuda_link_libs ${CUDA_LIBRARIES})
|
||||
else()
|
||||
set(lib_cuda "")
|
||||
set(cuda_objs "")
|
||||
set(cuda_link_libs "")
|
||||
endif()
|
||||
|
||||
ocv_glob_module_sources(SOURCES ${lib_cuda} ${cuda_objs})
|
||||
|
||||
ocv_create_module(${cuda_link_libs})
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
|
||||
ocv_add_accuracy_tests()
|
||||
ocv_add_perf_tests()
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 -Wundef)
|
||||
ocv_define_module(superres opencv_imgproc opencv_video OPTIONAL opencv_gpu opencv_highgui)
|
||||
|
@ -40,6 +40,10 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
|
||||
#include "opencv2/gpu/device/common.hpp"
|
||||
#include "opencv2/gpu/device/transform.hpp"
|
||||
#include "opencv2/gpu/device/vec_traits.hpp"
|
||||
@ -232,3 +236,5 @@ namespace btv_l1_device
|
||||
template void calcBtvRegularization<3>(PtrStepSzb src, PtrStepSzb dst, int ksize);
|
||||
template void calcBtvRegularization<4>(PtrStepSzb src, PtrStepSzb dst, int ksize);
|
||||
}
|
||||
|
||||
#endif /* HAVE_OPENCV_GPU */
|
||||
|
Loading…
Reference in New Issue
Block a user