Skip to content

Commit 2e3fa15

Browse files
authored
Merge pull request #3 from SimeonEhrig/CUDAdeviceCodeDebugging
2 parents 58506bb + 3d9c176 commit 2e3fa15

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

examples/basic/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
cmake_minimum_required(VERSION 3.24)
22

3+
option(ENABLE_CUDA_DEVICE_DEBUG "Enable generating CUDA device code debug information." OFF)
4+
35
set(_TARGET_NORMAL normal)
46

57
add_executable(${_TARGET_NORMAL})
@@ -9,6 +11,9 @@ target_sources(${_TARGET_NORMAL}
911
set_target_properties(${_TARGET_NORMAL} PROPERTIES
1012
CUDA_CXX_STANDARD 17
1113
)
14+
if(ENABLE_CUDA_DEVICE_DEBUG)
15+
target_compile_options(${_TARGET_NORMAL} PRIVATE "$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:CUDA>>:-G;-src-in-ptx>")
16+
endif()
1217

1318
# add include path to the cuda_mav.cuh header
1419
target_link_libraries(${_TARGET_NORMAL} PRIVATE CUDA_MAV_HEADER)
@@ -22,3 +27,6 @@ target_sources(${_TARGET_ANNOTATED}
2227
set_target_properties(${_TARGET_ANNOTATED} PROPERTIES
2328
CUDA_CXX_STANDARD 17
2429
)
30+
if(ENABLE_CUDA_DEVICE_DEBUG)
31+
target_compile_options(${_TARGET_ANNOTATED} PRIVATE "$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:CUDA>>:-G;-src-in-ptx>")
32+
endif()

0 commit comments

Comments
 (0)