[CMake] [FindCUDA] CUDA_COMPILE_PTX

Denis Taniguchi taniguchi at tpn.usp.br
Wed Feb 17 14:37:59 EST 2010


Hi all,

I was trying to use CUDA_COMPILE_PTX to make nvcc compile *.cu files
to .ptx files but with no success.
Running make just compile my regular .cpp files and does nothing to .cu
files. I want the ptx files to use them with CUDA driver API.
I checked in the trunk SVN repository of FindCUDA but the line for
CUDA_COMPILE_PTX was commented out in the example.
Regards,

Denis

#####################################################################

# habilitar o módulo FindBoost
find_package (Boost 1.42.0 COMPONENTS thread)
# habilitar o módulo FindCUDA
find_package (CUDA)

file (GLOB_RECURSE sources *.cpp)
file (GLOB_RECURSE cufiles *.cu)
cuda_compile_ptx (ptxfiles cufiles)
add_executable (cuda_core_test ${sources})

# para poder usar variadic template parameters
set_target_properties (cuda_core_test PROPERTIES COMPILE_FLAGS -std=c
++0x)
# gcc version < 4.4 não possuem o header initilizer_list
add_definitions (-DBOOST_NO_0X_HDR_INITIALIZER_LIST)

include_directories (${CUDA_TOOLKIT_INCLUDE})
target_link_libraries (cuda_core_test ${CUDA_CUDA_LIBRARY}
${Boost_LIBRARIES})



More information about the CMake mailing list