Skip to content

Commit 0c0ff42

Browse files
committed
Make: NVCC kernel debugging symbols
1 parent fa4b0f4 commit 0c0ff42

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,25 @@ function (set_compiler_flags target cpp_standard target_arch compiler_id)
210210
${compiler_id} STREQUAL "GNU"
211211
OR ${compiler_id} STREQUAL "Clang"
212212
OR ${compiler_id} STREQUAL "AppleClang"
213-
OR ${compiler_id} STREQUAL "NVIDIA"
214213
)
215214
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
216215
target_compile_options(${target} PRIVATE "-O0;-g")
217216
endif ()
218217
if (${CMAKE_BUILD_TYPE} STREQUAL "Release" OR ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
219218
target_compile_options(${target} PRIVATE "-O3")
220219
endif ()
220+
elseif (${compiler_id} STREQUAL "NVIDIA")
221+
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
222+
target_compile_options(${target} PRIVATE "-O0;-g")
223+
target_compile_options(${target} PRIVATE "-G;-no-compress") # for device code debug symbols
224+
target_compile_options(${target} PRIVATE "-Xptxas=-O0") # pass to the PTX assembler
225+
target_compile_options(${target} PRIVATE "-Xcompiler=-fno-omit-frame-pointer")
226+
target_compile_options(${target} PRIVATE "-Xcompiler=-fno-inline")
227+
target_compile_options(${target} PRIVATE "-maxrregcount=0")
228+
endif ()
229+
if (${CMAKE_BUILD_TYPE} STREQUAL "Release" OR ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
230+
target_compile_options(${target} PRIVATE "-O3")
231+
endif ()
221232
endif ()
222233

223234
# If available, enable Position Independent Code

0 commit comments

Comments
 (0)