In CMAKE with FindCUDA, given an input file filename.cu
, the cuda_compile_ptx
command generates output filenames of the form cuda_compile_ptx_generated_filename.cu.ptx
, but I need the output filenames to be of the form filename.ptx
.
Is there a simple way to make this work?
Ideally you should be able to specify -o <outputName>
. However the issue is that the CUDA_COMPILE_PTX
macro actually overrides the -o
option with cuda_compile_ptx_generated_${filename}.ptx
Here are two alternate ways add CUDA compilation to your project
CUDA_COMPILE_PTX
but work around the issue by renaming it with add_custom_command
: add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/my_ptx.ptx COMMAND ${CMAKE_COMMAND} -E copy ${cuda_ptx_files} ${CMAKE_BINARY_DIR}/my_ptx.ptx DEPENDS ${cuda_ptx_files})
and use ${CMAKE_BINARY_DIR}/my_ptx.ptx
in add_custom_target
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With