From e3f7be959d69486263f25d82ab56aec771629610 Mon Sep 17 00:00:00 2001 From: peizhilin Date: Wed, 7 Nov 2018 20:47:35 +0800 Subject: [PATCH] fix the debug flag for nvcc --- cmake/cuda.cmake | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cmake/cuda.cmake b/cmake/cuda.cmake index 45a4b13288..cdcbb79792 100644 --- a/cmake/cuda.cmake +++ b/cmake/cuda.cmake @@ -167,12 +167,8 @@ select_nvcc_arch_flags(NVCC_FLAGS_EXTRA) list(APPEND CUDA_NVCC_FLAGS ${NVCC_FLAGS_EXTRA}) message(STATUS "Added CUDA NVCC flags for: ${NVCC_FLAGS_EXTRA_readable}") -if (WIN32) - set(CUDA_PROPAGATE_HOST_FLAGS ON) -else (WIN32) - # Set C++11 support - set(CUDA_PROPAGATE_HOST_FLAGS OFF) -endif (WIN32) +# Set C++11 support +set(CUDA_PROPAGATE_HOST_FLAGS OFF) # Release/Debug flags set by cmake. Such as -O3 -g -DNDEBUG etc. # So, don't set these flags here. @@ -203,10 +199,12 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") list(APPEND CUDA_NVCC_FLAGS ${CMAKE_CXX_FLAGS_RELEASE}) endif() else(NOT WIN32) -if(CMAKE_BUILD_TYPE STREQUAL "Release") +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + list(APPEND CUDA_NVCC_FLAGS "-g -lineinfo -G") +elseif(CMAKE_BUILD_TYPE STREQUAL "Release") list(APPEND CUDA_NVCC_FLAGS "-O3 -DNDEBUG") else() - message(FATAL "Windows only support Release build now. Please set visual studio build type to Release, x64 build.") + message(FATAL "Windows only support Release or Debug build now. Please set visual studio build type to Release/Debug, x64 build.") endif() endif(NOT WIN32) -- GitLab