Automatically add CUDA support to a module if it has CUDA sources.

Backport from master.
This commit is contained in:
Roman Donchenko
2013-04-10 12:20:54 +04:00
parent 71896544ca
commit e8721f1f6f
7 changed files with 50 additions and 76 deletions

View File

@@ -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)

View File

@@ -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 */