fix gpu::DeviceInfo compilation under linux
glibc defines major and minor macros which conflict with gpu::DeviceInfo methods with the same name
This commit is contained in:
@@ -529,10 +529,10 @@ public:
|
||||
size_t totalConstMem() const;
|
||||
|
||||
//! major compute capability
|
||||
int major() const;
|
||||
int majorVersion() const;
|
||||
|
||||
//! minor compute capability
|
||||
int minor() const;
|
||||
int minorVersion() const;
|
||||
|
||||
//! alignment requirement for textures
|
||||
size_t textureAlignment() const;
|
||||
|
||||
@@ -619,7 +619,7 @@ size_t DeviceInfo::totalMemory() const
|
||||
inline
|
||||
bool DeviceInfo::supports(FeatureSet feature_set) const
|
||||
{
|
||||
int version = major() * 10 + minor();
|
||||
int version = majorVersion() * 10 + minorVersion();
|
||||
return version >= feature_set;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ bool cv::gpu::deviceSupports(FeatureSet feature_set)
|
||||
else
|
||||
{
|
||||
DeviceInfo dev(devId);
|
||||
version = dev.major() * 10 + dev.minor();
|
||||
version = dev.majorVersion() * 10 + dev.minorVersion();
|
||||
if (devId < cache_size)
|
||||
versions[devId] = version;
|
||||
}
|
||||
@@ -455,7 +455,7 @@ size_t cv::gpu::DeviceInfo::totalConstMem() const
|
||||
#endif
|
||||
}
|
||||
|
||||
int cv::gpu::DeviceInfo::major() const
|
||||
int cv::gpu::DeviceInfo::majorVersion() const
|
||||
{
|
||||
#ifndef HAVE_CUDA
|
||||
throw_no_cuda();
|
||||
@@ -465,7 +465,7 @@ int cv::gpu::DeviceInfo::major() const
|
||||
#endif
|
||||
}
|
||||
|
||||
int cv::gpu::DeviceInfo::minor() const
|
||||
int cv::gpu::DeviceInfo::minorVersion() const
|
||||
{
|
||||
#ifndef HAVE_CUDA
|
||||
throw_no_cuda();
|
||||
@@ -908,12 +908,12 @@ bool cv::gpu::DeviceInfo::isCompatible() const
|
||||
return false;
|
||||
#else
|
||||
// Check PTX compatibility
|
||||
if (TargetArchs::hasEqualOrLessPtx(major(), minor()))
|
||||
if (TargetArchs::hasEqualOrLessPtx(majorVersion(), minorVersion()))
|
||||
return true;
|
||||
|
||||
// Check BIN compatibility
|
||||
for (int i = minor(); i >= 0; --i)
|
||||
if (TargetArchs::hasBin(major(), i))
|
||||
for (int i = minorVersion(); i >= 0; --i)
|
||||
if (TargetArchs::hasBin(majorVersion(), i))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user