Commit bc72f4d2 authored by Alexander Smorkalov's avatar Alexander Smorkalov

Code review fixes.

parent 529bd417
...@@ -201,7 +201,7 @@ OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help wi ...@@ -201,7 +201,7 @@ OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help wi
# OpenCV build options # OpenCV build options
# =================================================== # ===================================================
OCV_OPTION(ENABLE_DYNAMIC_CUDA "Enabled dynamic CUDA linkage" ON IF ANDROID OR LINUX) OCV_OPTION(ENABLE_DYNAMIC_CUDA "Enabled dynamic CUDA linkage" ON IF ANDROID )
OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS) ) OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS) )
OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) IF (CMAKE_VERSION VERSION_GREATER "2.8.0") ) OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CMAKE_COMPILER_IS_GNUCXX ) OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CMAKE_COMPILER_IS_GNUCXX )
...@@ -459,6 +459,23 @@ if(WITH_OPENCL) ...@@ -459,6 +459,23 @@ if(WITH_OPENCL)
include(cmake/OpenCVDetectOpenCL.cmake) include(cmake/OpenCVDetectOpenCL.cmake)
endif() endif()
# ----------------------------------------------------------------------------
# Add CUDA libraries (needed for apps/tools, samples)
# ----------------------------------------------------------------------------
if(NOT HAVE_CUDA)
set(ENABLE_DYNAMIC_CUDA OFF)
endif()
if(HAVE_CUDA AND NOT ENABLE_DYNAMIC_CUDA)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
if(HAVE_CUBLAS)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cublas_LIBRARY})
endif()
if(HAVE_CUFFT)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cufft_LIBRARY})
endif()
endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Solution folders: # Solution folders:
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
......
...@@ -28,8 +28,10 @@ endif() ...@@ -28,8 +28,10 @@ endif()
file(GLOB lib_cuda_hdrs "include/opencv2/${name}/cuda/*.hpp" "include/opencv2/${name}/cuda/*.h") 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") file(GLOB lib_cuda_hdrs_detail "include/opencv2/${name}/cuda/detail/*.hpp" "include/opencv2/${name}/cuda/detail/*.h")
if (HAVE_CUDA AND NOT ENABLE_DYNAMIC_CUDA) if(HAVE_CUDA AND NOT ENABLE_DYNAMIC_CUDA)
file(GLOB lib_cuda "../dynamicuda/src/cuda/*.cu*") file(GLOB lib_cuda "../dynamicuda/src/cuda/*.cu*")
ocv_include_directories(${CUDA_INCLUDE_DIRS})
ocv_cuda_compile(cuda_objs ${lib_cuda})
endif() endif()
source_group("Cuda Headers" FILES ${lib_cuda_hdrs}) source_group("Cuda Headers" FILES ${lib_cuda_hdrs})
...@@ -43,7 +45,7 @@ if (NOT HAVE_CUDA OR ENABLE_DYNAMIC_CUDA) ...@@ -43,7 +45,7 @@ if (NOT HAVE_CUDA OR ENABLE_DYNAMIC_CUDA)
ocv_glob_module_sources(SOURCES "${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}) HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
else() else()
ocv_glob_module_sources(SOURCES "${opencv_core_BINARY_DIR}/version_string.inc" ${lib_cuda} ocv_glob_module_sources(SOURCES "${opencv_core_BINARY_DIR}/version_string.inc" ${lib_cuda} ${cuda_objs}
HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail}) HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
endif() endif()
......
...@@ -112,13 +112,13 @@ namespace cv { namespace gpu ...@@ -112,13 +112,13 @@ namespace cv { namespace gpu
// Creates DeviceInfo object for the given GPU // Creates DeviceInfo object for the given GPU
DeviceInfo(int device_id) : device_id_(device_id) { query(); } DeviceInfo(int device_id) : device_id_(device_id) { query(); }
std::string name() const; std::string name() const { return name_; }
// Return compute capability versions // Return compute capability versions
int majorVersion() const; int majorVersion() const { return majorVersion_; }
int minorVersion() const; int minorVersion() const { return minorVersion_; }
int multiProcessorCount() const; int multiProcessorCount() const { return multi_processor_count_; }
size_t sharedMemPerBlock() const; size_t sharedMemPerBlock() const;
...@@ -132,12 +132,9 @@ namespace cv { namespace gpu ...@@ -132,12 +132,9 @@ namespace cv { namespace gpu
// Checks whether the GPU module can be run on the given device // Checks whether the GPU module can be run on the given device
bool isCompatible() const; bool isCompatible() const;
int deviceID() const; int deviceID() const { return device_id_; }
private: private:
// Private section is fictive to preserve bin compatibility.
// Changes in the private fields there have no effects.
// see deligate code.
void query(); void query();
int device_id_; int device_id_;
......
...@@ -263,12 +263,15 @@ size_t cv::gpu::DeviceInfo::freeMemory() const { return deviceInfoFuncTable()->f ...@@ -263,12 +263,15 @@ size_t cv::gpu::DeviceInfo::freeMemory() const { return deviceInfoFuncTable()->f
size_t cv::gpu::DeviceInfo::totalMemory() const { return deviceInfoFuncTable()->totalMemory(); } size_t cv::gpu::DeviceInfo::totalMemory() const { return deviceInfoFuncTable()->totalMemory(); }
bool cv::gpu::DeviceInfo::supports(FeatureSet feature_set) const { return deviceInfoFuncTable()->supports(feature_set); } bool cv::gpu::DeviceInfo::supports(FeatureSet feature_set) const { return deviceInfoFuncTable()->supports(feature_set); }
bool cv::gpu::DeviceInfo::isCompatible() const { return deviceInfoFuncTable()->isCompatible(); } bool cv::gpu::DeviceInfo::isCompatible() const { return deviceInfoFuncTable()->isCompatible(); }
int cv::gpu::DeviceInfo::deviceID() const { return deviceInfoFuncTable()->deviceID(); };
int cv::gpu::DeviceInfo::majorVersion() const { return deviceInfoFuncTable()->majorVersion(); } void cv::gpu::DeviceInfo::query()
int cv::gpu::DeviceInfo::minorVersion() const { return deviceInfoFuncTable()->minorVersion(); } {
std::string cv::gpu::DeviceInfo::name() const { return deviceInfoFuncTable()->name(); } deviceInfoFuncTable()->query();
int cv::gpu::DeviceInfo::multiProcessorCount() const { return deviceInfoFuncTable()->multiProcessorCount(); } name_ = deviceInfoFuncTable()->name();
void cv::gpu::DeviceInfo::query() { deviceInfoFuncTable()->query(); } multi_processor_count_ = deviceInfoFuncTable()->multiProcessorCount();
majorVersion_ = deviceInfoFuncTable()->majorVersion();
minorVersion_ = deviceInfoFuncTable()->minorVersion();
}
void cv::gpu::printCudaDeviceInfo(int device) { deviceInfoFuncTable()->printCudaDeviceInfo(device); } void cv::gpu::printCudaDeviceInfo(int device) { deviceInfoFuncTable()->printCudaDeviceInfo(device); }
void cv::gpu::printShortCudaDeviceInfo(int device) { deviceInfoFuncTable()->printShortCudaDeviceInfo(device); } void cv::gpu::printShortCudaDeviceInfo(int device) { deviceInfoFuncTable()->printShortCudaDeviceInfo(device); }
......
if(NOT ANDROID OR NOT HAVE_CUDA) if(NOT DYNAMIC_CUDA_SUPPORT)
ocv_module_disable(dynamicuda) ocv_module_disable(dynamicuda)
endif() endif()
...@@ -11,5 +11,5 @@ set(OPENCV_MODULE_TYPE SHARED) ...@@ -11,5 +11,5 @@ set(OPENCV_MODULE_TYPE SHARED)
if (BUILD_FAT_JAVA_LIB) if (BUILD_FAT_JAVA_LIB)
ocv_define_module(dynamicuda opencv_java PRIVATE_REQUIRED ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) ocv_define_module(dynamicuda opencv_java PRIVATE_REQUIRED ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
else() else()
ocv_define_module(dynamicuda opencv_core PRIVATE_REQUIRED q${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) ocv_define_module(dynamicuda opencv_core PRIVATE_REQUIRED ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
endif() endif()
...@@ -539,7 +539,7 @@ private: ...@@ -539,7 +539,7 @@ private:
DeviceProps deviceProps; DeviceProps deviceProps;
class CudaDeviceInfoFuncTable: DeviceInfoFuncTable class CudaDeviceInfoFuncTable : public DeviceInfoFuncTable
{ {
public: public:
size_t sharedMemPerBlock() const size_t sharedMemPerBlock() const
...@@ -1109,4 +1109,4 @@ public: ...@@ -1109,4 +1109,4 @@ public:
} }
}; };
#endif #endif
#endif #endif
\ No newline at end of file
set(the_description "Images stitching") set(the_description "Images stitching")
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect OPTIONAL opencv_gpu opencv_nonfree) if (ENABLE_DYNAMIC_CUDA)
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect OPTIONAL opencv_nonfree)
else()
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect OPTIONAL opencv_gpu opencv_nonfree)
endif()
\ No newline at end of file
...@@ -227,7 +227,7 @@ private: ...@@ -227,7 +227,7 @@ private:
}; };
#ifdef HAVE_OPENCV_GPU #if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
class CV_EXPORTS GraphCutSeamFinderGpu : public GraphCutSeamFinderBase, public PairwiseSeamFinder class CV_EXPORTS GraphCutSeamFinderGpu : public GraphCutSeamFinderBase, public PairwiseSeamFinder
{ {
public: public:
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp" #include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/opencv_modules.hpp" #include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_GPU #if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
# include "opencv2/gpu/gpu.hpp" # include "opencv2/gpu/gpu.hpp"
#endif #endif
...@@ -331,7 +331,7 @@ public: ...@@ -331,7 +331,7 @@ public:
}; };
#ifdef HAVE_OPENCV_GPU #if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
class CV_EXPORTS PlaneWarperGpu : public PlaneWarper class CV_EXPORTS PlaneWarperGpu : public PlaneWarper
{ {
public: public:
......
...@@ -145,7 +145,7 @@ public: ...@@ -145,7 +145,7 @@ public:
#ifdef HAVE_OPENCV_GPU #if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
class PlaneWarperGpu: public WarperCreator class PlaneWarperGpu: public WarperCreator
{ {
public: public:
......
set(the_description "Video stabilization") set(the_description "Video stabilization")
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d opencv_highgui OPTIONAL opencv_gpu) if(ENABLE_DYNAMIC_CUDA)
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d opencv_highgui)
else()
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d opencv_highgui OPTIONAL opencv_gpu)
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment