From f15a167df4791f74ebcaa006373b19f4f48758b5 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 3 Feb 2014 11:52:43 +0400 Subject: [PATCH] turn on CUDA part of nonfree module on Android for non-dynamic build(cherry picked from commit d8f7377122a65512db2f443535a9d01ea336470c) --- modules/nonfree/CMakeLists.txt | 6 +++--- modules/nonfree/include/opencv2/nonfree/gpu.hpp | 8 +------- modules/nonfree/perf/perf_gpu.cpp | 4 +++- modules/nonfree/src/cuda/surf.cu | 2 +- modules/nonfree/src/precomp.hpp | 2 +- modules/nonfree/src/surf_gpu.cpp | 6 +----- modules/nonfree/test/test_gpu.cpp | 4 +++- 7 files changed, 13 insertions(+), 19 deletions(-) diff --git a/modules/nonfree/CMakeLists.txt b/modules/nonfree/CMakeLists.txt index d5c5562eca..53fb2f73e9 100644 --- a/modules/nonfree/CMakeLists.txt +++ b/modules/nonfree/CMakeLists.txt @@ -4,9 +4,9 @@ endif() set(the_description "Functionality with possible limitations on the use") ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef) -if (ENABLE_DYNAMIC_CUDA) - set(HAVE_CUDA FALSE) +if(ENABLE_DYNAMIC_CUDA) + add_definitions(-DDYNAMIC_CUDA_SUPPORT) ocv_define_module(nonfree opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_ocl) else() ocv_define_module(nonfree opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_gpu opencv_ocl) -endif() \ No newline at end of file +endif() diff --git a/modules/nonfree/include/opencv2/nonfree/gpu.hpp b/modules/nonfree/include/opencv2/nonfree/gpu.hpp index c8730fb3b9..722ef26a25 100644 --- a/modules/nonfree/include/opencv2/nonfree/gpu.hpp +++ b/modules/nonfree/include/opencv2/nonfree/gpu.hpp @@ -43,11 +43,7 @@ #ifndef __OPENCV_NONFREE_GPU_HPP__ #define __OPENCV_NONFREE_GPU_HPP__ -#include "opencv2/opencv_modules.hpp" - -#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) - -#include "opencv2/gpu/gpu.hpp" +#include "opencv2/core/gpumat.hpp" namespace cv { namespace gpu { @@ -129,6 +125,4 @@ public: } // namespace cv -#endif // defined(HAVE_OPENCV_GPU) - #endif // __OPENCV_NONFREE_GPU_HPP__ diff --git a/modules/nonfree/perf/perf_gpu.cpp b/modules/nonfree/perf/perf_gpu.cpp index 9f451deaba..e29eeb2fa8 100644 --- a/modules/nonfree/perf/perf_gpu.cpp +++ b/modules/nonfree/perf/perf_gpu.cpp @@ -42,7 +42,9 @@ #include "perf_precomp.hpp" -#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA) +#include "cvconfig.h" + +#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA) && !defined(DYNAMIC_CUDA_SUPPORT) #include "opencv2/ts/gpu_perf.hpp" diff --git a/modules/nonfree/src/cuda/surf.cu b/modules/nonfree/src/cuda/surf.cu index df5905d31d..65345a363d 100644 --- a/modules/nonfree/src/cuda/surf.cu +++ b/modules/nonfree/src/cuda/surf.cu @@ -42,7 +42,7 @@ #include "opencv2/opencv_modules.hpp" -#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) +#if defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT) #include "opencv2/gpu/device/common.hpp" #include "opencv2/gpu/device/limits.hpp" diff --git a/modules/nonfree/src/precomp.hpp b/modules/nonfree/src/precomp.hpp index 0d2e180fc5..28531390d6 100644 --- a/modules/nonfree/src/precomp.hpp +++ b/modules/nonfree/src/precomp.hpp @@ -51,7 +51,7 @@ #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/core/internal.hpp" -#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) +#if defined(HAVE_OPENCV_GPU) && !defined(DYNAMIC_CUDA_SUPPORT) #include "opencv2/nonfree/gpu.hpp" #if defined(HAVE_CUDA) diff --git a/modules/nonfree/src/surf_gpu.cpp b/modules/nonfree/src/surf_gpu.cpp index e0cf6ff517..b3c2ce22b2 100644 --- a/modules/nonfree/src/surf_gpu.cpp +++ b/modules/nonfree/src/surf_gpu.cpp @@ -42,12 +42,10 @@ #include "precomp.hpp" -#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID) - using namespace cv; using namespace cv::gpu; -#if !defined (HAVE_CUDA) +#if !defined (HAVE_CUDA) || !defined(HAVE_OPENCV_GPU) || defined(DYNAMIC_CUDA_SUPPORT) cv::gpu::SURF_GPU::SURF_GPU() { throw_nogpu(); } cv::gpu::SURF_GPU::SURF_GPU(double, int, int, bool, float, bool) { throw_nogpu(); } @@ -421,5 +419,3 @@ void cv::gpu::SURF_GPU::releaseMemory() } #endif // !defined (HAVE_CUDA) - -#endif // defined(HAVE_OPENCV_GPU) && !defined(ANDROID) diff --git a/modules/nonfree/test/test_gpu.cpp b/modules/nonfree/test/test_gpu.cpp index 3f63eeddf2..938bc1d328 100644 --- a/modules/nonfree/test/test_gpu.cpp +++ b/modules/nonfree/test/test_gpu.cpp @@ -42,7 +42,9 @@ #include "test_precomp.hpp" -#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA) +#include "cvconfig.h" + +#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA) && !defined(DYNAMIC_CUDA_SUPPORT) using namespace cvtest;