2012-01-25 10:04:49 +01:00
|
|
|
if(ANDROID OR IOS)
|
2012-02-03 12:26:49 +01:00
|
|
|
ocv_module_disable(gpu)
|
2012-01-25 10:04:49 +01:00
|
|
|
endif()
|
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
set(the_description "GPU-accelerated Computer Vision")
|
2012-06-05 15:32:04 +02:00
|
|
|
ocv_add_module(gpu opencv_imgproc opencv_calib3d opencv_objdetect opencv_video opencv_nonfree opencv_legacy)
|
2010-12-06 17:37:32 +01:00
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/cuda")
|
2010-12-17 16:41:26 +01:00
|
|
|
|
2012-04-17 09:12:16 +02:00
|
|
|
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../highgui/src")
|
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
file(GLOB lib_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
|
|
|
file(GLOB lib_int_hdrs "src/*.hpp" "src/*.h")
|
|
|
|
file(GLOB lib_cuda_hdrs "src/cuda/*.hpp" "src/cuda/*.h")
|
|
|
|
file(GLOB lib_device_hdrs "src/opencv2/gpu/device/*.hpp" "src/opencv2/gpu/device/*.h")
|
|
|
|
file(GLOB lib_device_hdrs_detail "src/opencv2/gpu/device/detail/*.hpp" "src/opencv2/gpu/device/detail/*.h")
|
|
|
|
file(GLOB lib_srcs "src/*.cpp")
|
|
|
|
file(GLOB lib_cuda "src/cuda/*.cu*")
|
2010-12-06 17:37:32 +01:00
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
source_group("Include" FILES ${lib_hdrs})
|
2010-12-06 17:37:32 +01:00
|
|
|
source_group("Src\\Host" FILES ${lib_srcs} ${lib_int_hdrs})
|
|
|
|
source_group("Src\\Cuda" FILES ${lib_cuda} ${lib_cuda_hdrs})
|
|
|
|
source_group("Device" FILES ${lib_device_hdrs})
|
2011-08-03 14:10:36 +02:00
|
|
|
source_group("Device\\Detail" FILES ${lib_device_hdrs_detail})
|
2010-12-06 17:37:32 +01:00
|
|
|
|
2011-02-04 19:29:05 +01:00
|
|
|
if (HAVE_CUDA)
|
2012-04-24 16:15:38 +02:00
|
|
|
file(GLOB_RECURSE ncv_srcs "src/nvidia/*.cpp")
|
2012-02-03 12:26:49 +01:00
|
|
|
file(GLOB_RECURSE ncv_cuda "src/nvidia/*.cu")
|
|
|
|
file(GLOB_RECURSE ncv_hdrs "src/nvidia/*.hpp" "src/nvidia/*.h")
|
|
|
|
set(ncv_files ${ncv_srcs} ${ncv_hdrs} ${ncv_cuda})
|
2011-01-13 14:04:00 +01:00
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
source_group("Src\\NVidia" FILES ${ncv_files})
|
2012-03-03 16:49:23 +01:00
|
|
|
ocv_include_directories("src/nvidia" "src/nvidia/core" "src/nvidia/NPP_staging" ${CUDA_INCLUDE_DIRS})
|
2011-02-04 19:29:05 +01:00
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-keep")
|
|
|
|
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;")
|
2012-04-24 16:15:38 +02:00
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
if(MSVC)
|
2012-04-13 23:50:59 +02:00
|
|
|
if(NOT ENABLE_NOISY_WARNINGS)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4211 /wd4201 /wd4100 /wd4505 /wd4408")
|
2012-04-24 16:15:38 +02:00
|
|
|
|
2012-04-13 23:50:59 +02:00
|
|
|
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
|
|
|
string(REPLACE "/W4" "/W3" ${var} "${${var}}")
|
|
|
|
endforeach()
|
2012-04-24 16:15:38 +02:00
|
|
|
|
2012-04-13 23:50:59 +02:00
|
|
|
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler /wd4251)
|
|
|
|
endif()
|
2012-02-03 12:26:49 +01:00
|
|
|
endif()
|
|
|
|
|
2012-05-22 15:15:22 +02:00
|
|
|
ocv_cuda_compile(cuda_objs ${lib_cuda} ${ncv_cuda})
|
2012-02-03 12:26:49 +01:00
|
|
|
#CUDA_BUILD_CLEAN_TARGET()
|
2012-04-24 16:15:38 +02:00
|
|
|
|
2012-06-05 15:32:04 +02:00
|
|
|
|
2012-05-22 15:15:22 +02:00
|
|
|
set(cuda_link_libs ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
2012-06-05 15:32:04 +02:00
|
|
|
|
|
|
|
|
2012-05-11 13:48:15 +02:00
|
|
|
if(NOT APPLE)
|
|
|
|
unset(CUDA_nvcuvid_LIBRARY CACHE)
|
|
|
|
find_cuda_helper_libs(nvcuvid)
|
2012-06-05 15:32:04 +02:00
|
|
|
set(cuda_link_libs ${cuda_link_libs} ${CUDA_nvcuvid_LIBRARY})
|
2012-05-11 13:48:15 +02:00
|
|
|
endif()
|
2012-04-17 09:12:16 +02:00
|
|
|
|
2012-04-24 16:15:38 +02:00
|
|
|
if(WIN32)
|
2012-04-17 09:12:16 +02:00
|
|
|
unset(CUDA_nvcuvenc_LIBRARY CACHE)
|
|
|
|
find_cuda_helper_libs(nvcuvenc)
|
2012-06-05 15:32:04 +02:00
|
|
|
set(cuda_link_libs ${cuda_link_libs} ${CUDA_nvcuvenc_LIBRARY})
|
2012-04-17 09:12:16 +02:00
|
|
|
endif()
|
2012-04-24 16:15:38 +02:00
|
|
|
|
2012-05-11 13:48:15 +02:00
|
|
|
if(NOT APPLE AND WITH_FFMPEG)
|
2012-04-24 16:15:38 +02:00
|
|
|
set(cuda_link_libs ${cuda_link_libs} ${HIGHGUI_LIBRARIES})
|
|
|
|
endif()
|
2012-02-03 12:26:49 +01:00
|
|
|
else()
|
|
|
|
set(lib_cuda "")
|
|
|
|
set(cuda_objs "")
|
|
|
|
set(cuda_link_libs "")
|
|
|
|
set(ncv_files "")
|
2010-12-06 17:37:32 +01:00
|
|
|
endif()
|
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
ocv_set_module_sources(
|
|
|
|
HEADERS ${lib_hdrs}
|
|
|
|
SOURCES ${lib_int_hdrs} ${lib_cuda_hdrs} ${lib_device_hdrs} ${lib_device_hdrs_detail} ${lib_srcs} ${lib_cuda} ${ncv_files} ${cuda_objs}
|
|
|
|
)
|
2012-04-24 16:15:38 +02:00
|
|
|
|
2012-04-24 09:49:55 +02:00
|
|
|
ocv_create_module(${cuda_link_libs})
|
2012-04-24 16:15:38 +02:00
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
if(HAVE_CUDA)
|
|
|
|
if(HAVE_CUFFT)
|
|
|
|
CUDA_ADD_CUFFT_TO_TARGET(${the_module})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_CUBLAS)
|
|
|
|
CUDA_ADD_CUBLAS_TO_TARGET(${the_module})
|
|
|
|
endif()
|
2012-04-24 16:15:38 +02:00
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
install(FILES src/nvidia/NPP_staging/NPP_staging.hpp src/nvidia/core/NCV.hpp
|
2012-04-24 16:15:38 +02:00
|
|
|
DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name}
|
|
|
|
COMPONENT main)
|
2012-02-03 12:26:49 +01:00
|
|
|
endif()
|
2011-04-25 18:07:48 +02:00
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
ocv_add_precompiled_headers(${the_module})
|
2011-02-18 13:23:18 +01:00
|
|
|
|
|
|
|
################################################################################################################
|
|
|
|
################################ GPU Module Tests #####################################################
|
|
|
|
################################################################################################################
|
2012-02-03 12:26:49 +01:00
|
|
|
file(GLOB test_srcs "test/*.cpp")
|
|
|
|
file(GLOB test_hdrs "test/*.hpp" "test/*.h")
|
|
|
|
if(HAVE_CUDA)
|
2012-04-24 16:15:38 +02:00
|
|
|
file(GLOB nvidia "test/nvidia/*.cpp" "test/nvidia/*.hpp" "test/nvidia/*.h")
|
2012-02-03 12:26:49 +01:00
|
|
|
set(nvidia FILES "Src\\\\\\\\NVidia" ${nvidia}) # 8 ugly backslashes :'(
|
|
|
|
else()
|
|
|
|
set(nvidia "")
|
2011-02-21 11:58:05 +01:00
|
|
|
endif()
|
2011-09-07 15:16:07 +02:00
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
ocv_add_accuracy_tests(FILES "Include" ${test_hdrs}
|
|
|
|
FILES "Src" ${test_srcs}
|
|
|
|
${nvidia})
|
|
|
|
ocv_add_perf_tests()
|
2012-05-22 10:29:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set(perf_cpu_path "${CMAKE_CURRENT_SOURCE_DIR}/perf_cpu")
|
|
|
|
if(BUILD_PERF_TESTS AND EXISTS "${perf_cpu_path}")
|
|
|
|
# opencv_highgui is required for imread/imwrite
|
2012-05-22 12:29:58 +02:00
|
|
|
set(perf_deps ${the_module} opencv_ts opencv_highgui opencv_imgproc opencv_calib3d opencv_objdetect opencv_video opencv_nonfree)
|
2012-05-22 10:29:08 +02:00
|
|
|
ocv_check_dependencies(${perf_deps})
|
|
|
|
|
|
|
|
if(OCV_DEPENDENCIES_FOUND)
|
|
|
|
set(the_target "opencv_perf_gpu_cpu")
|
|
|
|
|
|
|
|
ocv_module_include_directories(${perf_deps} "${perf_cpu_path}")
|
|
|
|
|
|
|
|
if(NOT OPENCV_PERF_${the_module}_CPU_SOURCES)
|
|
|
|
file(GLOB perf_srcs "${perf_cpu_path}/*.cpp")
|
|
|
|
file(GLOB perf_hdrs "${perf_cpu_path}/*.hpp" "${perf_cpu_path}/*.h")
|
|
|
|
source_group("Src" FILES ${perf_srcs})
|
|
|
|
source_group("Include" FILES ${perf_hdrs})
|
|
|
|
set(OPENCV_PERF_${the_module}_CPU_SOURCES ${perf_srcs} ${perf_hdrs})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(${the_target} ${OPENCV_PERF_${the_module}_CPU_SOURCES})
|
|
|
|
target_link_libraries(${the_target} ${OPENCV_MODULE_${the_module}_DEPS} ${perf_deps} ${OPENCV_LINKER_LIBS})
|
|
|
|
|
|
|
|
# Additional target properties
|
|
|
|
set_target_properties(${the_target} PROPERTIES
|
|
|
|
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}"
|
|
|
|
)
|
|
|
|
|
|
|
|
if(ENABLE_SOLUTION_FOLDERS)
|
|
|
|
set_target_properties(${the_target} PROPERTIES FOLDER "tests performance")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
ocv_add_precompiled_headers(${the_target})
|
|
|
|
else(OCV_DEPENDENCIES_FOUND)
|
|
|
|
#TODO: warn about unsatisfied dependencies
|
|
|
|
endif(OCV_DEPENDENCIES_FOUND)
|
|
|
|
endif()
|