Code review fixes.
This commit is contained in:
parent
529bd41751
commit
bc72f4d2a2
@ -201,7 +201,7 @@ OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help wi
|
||||
|
||||
# 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_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 )
|
||||
@ -459,6 +459,23 @@ if(WITH_OPENCL)
|
||||
include(cmake/OpenCVDetectOpenCL.cmake)
|
||||
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:
|
||||
# ----------------------------------------------------------------------------
|
||||
|
@ -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_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*")
|
||||
ocv_include_directories(${CUDA_INCLUDE_DIRS})
|
||||
ocv_cuda_compile(cuda_objs ${lib_cuda})
|
||||
endif()
|
||||
|
||||
source_group("Cuda Headers" FILES ${lib_cuda_hdrs})
|
||||
@ -43,7 +45,7 @@ if (NOT HAVE_CUDA OR ENABLE_DYNAMIC_CUDA)
|
||||
ocv_glob_module_sources(SOURCES "${opencv_core_BINARY_DIR}/version_string.inc"
|
||||
HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
|
||||
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})
|
||||
endif()
|
||||
|
||||
|
@ -112,13 +112,13 @@ namespace cv { namespace gpu
|
||||
// Creates DeviceInfo object for the given GPU
|
||||
DeviceInfo(int device_id) : device_id_(device_id) { query(); }
|
||||
|
||||
std::string name() const;
|
||||
std::string name() const { return name_; }
|
||||
|
||||
// Return compute capability versions
|
||||
int majorVersion() const;
|
||||
int minorVersion() const;
|
||||
int majorVersion() const { return majorVersion_; }
|
||||
int minorVersion() const { return minorVersion_; }
|
||||
|
||||
int multiProcessorCount() const;
|
||||
int multiProcessorCount() const { return multi_processor_count_; }
|
||||
|
||||
size_t sharedMemPerBlock() const;
|
||||
|
||||
@ -132,12 +132,9 @@ namespace cv { namespace gpu
|
||||
// Checks whether the GPU module can be run on the given device
|
||||
bool isCompatible() const;
|
||||
|
||||
int deviceID() const;
|
||||
int deviceID() const { return device_id_; }
|
||||
|
||||
private:
|
||||
// Private section is fictive to preserve bin compatibility.
|
||||
// Changes in the private fields there have no effects.
|
||||
// see deligate code.
|
||||
void query();
|
||||
|
||||
int device_id_;
|
||||
|
@ -263,12 +263,15 @@ size_t cv::gpu::DeviceInfo::freeMemory() const { return deviceInfoFuncTable()->f
|
||||
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::isCompatible() const { return deviceInfoFuncTable()->isCompatible(); }
|
||||
int cv::gpu::DeviceInfo::deviceID() const { return deviceInfoFuncTable()->deviceID(); };
|
||||
int cv::gpu::DeviceInfo::majorVersion() const { return deviceInfoFuncTable()->majorVersion(); }
|
||||
int cv::gpu::DeviceInfo::minorVersion() const { return deviceInfoFuncTable()->minorVersion(); }
|
||||
std::string cv::gpu::DeviceInfo::name() const { return deviceInfoFuncTable()->name(); }
|
||||
int cv::gpu::DeviceInfo::multiProcessorCount() const { return deviceInfoFuncTable()->multiProcessorCount(); }
|
||||
void cv::gpu::DeviceInfo::query() { deviceInfoFuncTable()->query(); }
|
||||
|
||||
void cv::gpu::DeviceInfo::query()
|
||||
{
|
||||
deviceInfoFuncTable()->query();
|
||||
name_ = deviceInfoFuncTable()->name();
|
||||
multi_processor_count_ = deviceInfoFuncTable()->multiProcessorCount();
|
||||
majorVersion_ = deviceInfoFuncTable()->majorVersion();
|
||||
minorVersion_ = deviceInfoFuncTable()->minorVersion();
|
||||
}
|
||||
|
||||
void cv::gpu::printCudaDeviceInfo(int device) { deviceInfoFuncTable()->printCudaDeviceInfo(device); }
|
||||
void cv::gpu::printShortCudaDeviceInfo(int device) { deviceInfoFuncTable()->printShortCudaDeviceInfo(device); }
|
||||
|
@ -1,4 +1,4 @@
|
||||
if(NOT ANDROID OR NOT HAVE_CUDA)
|
||||
if(NOT DYNAMIC_CUDA_SUPPORT)
|
||||
ocv_module_disable(dynamicuda)
|
||||
endif()
|
||||
|
||||
@ -11,5 +11,5 @@ set(OPENCV_MODULE_TYPE SHARED)
|
||||
if (BUILD_FAT_JAVA_LIB)
|
||||
ocv_define_module(dynamicuda opencv_java PRIVATE_REQUIRED ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
||||
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()
|
||||
|
@ -539,7 +539,7 @@ private:
|
||||
|
||||
DeviceProps deviceProps;
|
||||
|
||||
class CudaDeviceInfoFuncTable: DeviceInfoFuncTable
|
||||
class CudaDeviceInfoFuncTable : public DeviceInfoFuncTable
|
||||
{
|
||||
public:
|
||||
size_t sharedMemPerBlock() const
|
||||
@ -1109,4 +1109,4 @@ public:
|
||||
}
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1,2 +1,6 @@
|
||||
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()
|
@ -227,7 +227,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
|
||||
class CV_EXPORTS GraphCutSeamFinderGpu : public GraphCutSeamFinderBase, public PairwiseSeamFinder
|
||||
{
|
||||
public:
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
|
||||
# include "opencv2/gpu/gpu.hpp"
|
||||
#endif
|
||||
|
||||
@ -331,7 +331,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
|
||||
class CV_EXPORTS PlaneWarperGpu : public PlaneWarper
|
||||
{
|
||||
public:
|
||||
|
@ -145,7 +145,7 @@ public:
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
#if defined(HAVE_OPENCV_GPU) && !defined(ANDROID)
|
||||
class PlaneWarperGpu: public WarperCreator
|
||||
{
|
||||
public:
|
||||
|
@ -1,2 +1,6 @@
|
||||
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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user