Backport from master.
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})
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
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()
# 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})
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)
+endif()
- file(GLOB lib_cuda "src/cuda/*.cu")
- ocv_cuda_compile(cuda_objs ${lib_cuda})
+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")
- set(cuda_link_libs ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
-else()
- set(lib_cuda "")
- set(cuda_objs "")
- set(cuda_link_libs "")
-endif()
+source_group("Cuda Headers" FILES ${lib_cuda_hdrs})
+source_group("Cuda Headers\\Detail" FILES ${lib_cuda_hdrs_detail})
-ocv_glob_module_sources(SOURCES ${lib_cuda} ${cuda_objs} "${opencv_core_BINARY_DIR}/version_string.inc")
+ocv_glob_module_sources(SOURCES "${opencv_core_BINARY_DIR}/version_string.inc"
+ HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
-ocv_create_module(${cuda_link_libs})
+ocv_create_module()
ocv_add_precompiled_headers(${the_module})
ocv_add_accuracy_tests()
ocv_add_perf_tests()
-
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)
//
//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"
}}} // namespace cv { namespace gpu { namespace device
-#endif /* CUDA_DISABLER */
+#endif /* HAVE_OPENCV_GPU */
//
//M*/
-#if !defined CUDA_DISABLER
+#include "opencv2/opencv_modules.hpp"
+
+#ifdef HAVE_OPENCV_GPU
#include "opencv2/gpu/device/common.hpp"
}
}}}
-
-#endif /* CUDA_DISABLER */
+#endif /* HAVE_OPENCV_GPU */
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)
//
//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"
template void calcBtvRegularization<3>(PtrStepSzb src, PtrStepSzb dst, int ksize);
template void calcBtvRegularization<4>(PtrStepSzb src, PtrStepSzb dst, int ksize);
}
+
+#endif /* HAVE_OPENCV_GPU */