2012-01-25 17:04:49 +08:00
|
|
|
if(ANDROID OR IOS)
|
2012-02-03 19:26:49 +08:00
|
|
|
ocv_module_disable(gpu)
|
2012-01-25 17:04:49 +08:00
|
|
|
endif()
|
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
set(the_description "GPU-accelerated Computer Vision")
|
|
|
|
ocv_add_module(gpu opencv_imgproc opencv_calib3d opencv_objdetect)
|
2010-12-07 00:37:32 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/cuda")
|
2010-12-17 23:41:26 +08:00
|
|
|
|
2012-02-03 19:26:49 +08: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-07 00:37:32 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
source_group("Include" FILES ${lib_hdrs})
|
2010-12-07 00:37:32 +08: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 20:10:36 +08:00
|
|
|
source_group("Device\\Detail" FILES ${lib_device_hdrs_detail})
|
2010-12-07 00:37:32 +08:00
|
|
|
|
2011-02-05 02:29:05 +08:00
|
|
|
if (HAVE_CUDA)
|
2012-02-03 19:26:49 +08:00
|
|
|
file(GLOB_RECURSE ncv_srcs "src/nvidia/*.cpp")
|
|
|
|
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 21:04:00 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
source_group("Src\\NVidia" FILES ${ncv_files})
|
2012-02-03 20:54:52 +08:00
|
|
|
include_directories("src/nvidia" "src/nvidia/core" "src/nvidia/NPP_staging" ${CUDA_INCLUDE_DIRS})
|
2011-02-05 02:29:05 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-keep")
|
|
|
|
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;")
|
2011-06-01 21:57:14 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
|
|
|
string(REPLACE "/W4" "/W3" ${var} "${${var}}")
|
|
|
|
endforeach()
|
2011-02-05 02:29:05 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
if(MSVC)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4211 /wd4201 /wd4100 /wd4505 /wd4408 /wd4251")
|
2011-11-09 21:13:52 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
|
|
|
string(REPLACE "/EHsc-" "/EHs" ${var} "${${var}}")
|
|
|
|
endforeach()
|
2011-01-13 21:04:00 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler /wd4251)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
OCV_CUDA_COMPILE(cuda_objs ${lib_cuda} ${ncv_cuda})
|
|
|
|
#CUDA_BUILD_CLEAN_TARGET()
|
|
|
|
|
|
|
|
unset(CUDA_npp_LIBRARY CACHE)
|
|
|
|
find_cuda_helper_libs(npp)
|
|
|
|
set(cuda_link_libs ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
|
|
|
else()
|
|
|
|
set(lib_cuda "")
|
|
|
|
set(cuda_objs "")
|
|
|
|
set(cuda_link_libs "")
|
|
|
|
set(ncv_files "")
|
2010-12-07 00:37:32 +08:00
|
|
|
endif()
|
|
|
|
|
2012-02-03 19:26:49 +08: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}
|
|
|
|
)
|
|
|
|
|
|
|
|
ocv_create_module(${cuda_link_libs})
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
|
|
install(FILES src/nvidia/NPP_staging/NPP_staging.hpp src/nvidia/core/NCV.hpp
|
2011-06-29 00:02:09 +08:00
|
|
|
DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name}
|
2011-04-26 00:07:48 +08:00
|
|
|
COMPONENT main)
|
2012-02-03 19:26:49 +08:00
|
|
|
endif()
|
2011-04-26 00:07:48 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
ocv_add_precompiled_headers(${the_module})
|
2011-02-18 20:23:18 +08:00
|
|
|
|
|
|
|
################################################################################################################
|
|
|
|
################################ GPU Module Tests #####################################################
|
|
|
|
################################################################################################################
|
2012-02-03 19:26:49 +08:00
|
|
|
file(GLOB test_srcs "test/*.cpp")
|
|
|
|
file(GLOB test_hdrs "test/*.hpp" "test/*.h")
|
|
|
|
if(HAVE_CUDA)
|
|
|
|
file(GLOB nvidia "test/nvidia/*.cpp" "test/nvidia/*.hpp" "test/nvidia/*.h")
|
|
|
|
set(nvidia FILES "Src\\\\\\\\NVidia" ${nvidia}) # 8 ugly backslashes :'(
|
|
|
|
else()
|
|
|
|
set(nvidia "")
|
2011-02-21 18:58:05 +08:00
|
|
|
endif()
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2012-02-03 19:26:49 +08:00
|
|
|
ocv_add_accuracy_tests(FILES "Include" ${test_hdrs}
|
|
|
|
FILES "Src" ${test_srcs}
|
|
|
|
${nvidia})
|
|
|
|
ocv_add_perf_tests()
|