removed /EHa flag for cuda compilation

This commit is contained in:
Anatoly Baksheev 2012-08-23 15:46:19 +04:00
parent 290030d030
commit e60a50c43c
4 changed files with 25 additions and 12 deletions

View File

@ -77,7 +77,17 @@ if(CUDA_FOUND)
unset(CUDA_npp_LIBRARY CACHE)
find_cuda_helper_libs(npp)
macro(OCV_CUDA_COMPILE VAR)
macro(ocv_cuda_compile VAR)
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
set(${var}_backup_in_cuda_compile_ "${${var}}")
# we reomove /EHa as it leasd warnings under windows
string(REPLACE "/EHa" "" ${var} "${${var}}")
# we remove -ggdb3 flag as it leads to preprocessor errors when compiling CUDA files (CUDA 4.1)
string(REPLACE "-ggdb3" "" ${var} "${${var}}")
endforeach()
if (BUILD_SHARED_LIBS)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -DCVAPI_EXPORTS)
endif()
@ -94,11 +104,12 @@ if(CUDA_FOUND)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-but-set-variable)
endif()
# we remove -ggdb3 flag as it leads to preprocessor errors when compiling CUDA files (CUDA 4.1)
set(CMAKE_CXX_FLAGS_DEBUG_ ${CMAKE_CXX_FLAGS_DEBUG})
string(REPLACE "-ggdb3" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
CUDA_COMPILE(${VAR} ${ARGN})
set(CMAKE_CXX_DEBUG_FLAGS ${CMAKE_CXX_FLAGS_DEBUG_})
CUDA_COMPILE(${VAR} ${ARGN})
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
set(${var} "${${var}_backup_in_cuda_compile_}")
unset(${var}_backup_in_cuda_compile_)
endforeach()
endmacro()
else()
unset(CUDA_ARCH_BIN CACHE)

View File

@ -44,8 +44,9 @@ if (HAVE_CUDA)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler /wd4251)
endif()
endif()
ocv_cuda_compile(cuda_objs ${lib_cuda} ${ncv_cuda})
#CUDA_BUILD_CLEAN_TARGET()
set(cuda_link_libs ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})

View File

@ -87,6 +87,7 @@ namespace {
unsigned char* source = (unsigned char*)image.data;
int width = image.cols;
int height = image.rows;
int step1 = (int)image.step1();
for (int j = 0; j < image.rows; ++j)
for (int i = 0; i < image.cols; ++i)
@ -102,7 +103,7 @@ namespace {
while (top >= stack)
{
int* dl = &dist_labels[p.y * pitch + p.x];
unsigned char* sp = &source[p.y * image.step1() + p.x];
unsigned char* sp = &source[p.y * step1 + p.x];
dl[0] = cc;
@ -115,11 +116,11 @@ namespace {
*top++ = dot::make(p.x - 1, p.y);
//bottom
if( p.y < (height - 1) && dl[+pitch] == -1 && inInt(sp[0], sp[+image.step1()]))
if( p.y < (height - 1) && dl[+pitch] == -1 && inInt(sp[0], sp[+step1]))
*top++ = dot::make(p.x, p.y + 1);
//top
if( p.y > 0 && dl[-pitch] == -1 && inInt(sp[0], sp[-image.step1()]))
if( p.y > 0 && dl[-pitch] == -1 && inInt(sp[0], sp[-step1]))
*top++ = dot::make(p.x, p.y - 1);
p = *--top;

View File

@ -52,8 +52,8 @@ PERF_TEST_P( TestRemap, Remap,
map1.at<Vec2f>(j, i)[1] = (float)j;
break;
case CV_16SC2:
map1.at<Vec2s>(j, i)[0] = (float)(src.cols - i);
map1.at<Vec2s>(j, i)[1] = (float)j;
map1.at<Vec2s>(j, i)[0] = (short)(src.cols - i);
map1.at<Vec2s>(j, i)[1] = (short)j;
break;
default:
CV_Assert(0);