Compile CUDA files as C++.
This commit is contained in:
parent
b2d6122769
commit
0f5692d1ea
@ -57,7 +57,7 @@ MARK_AS_ADVANCED (CUDA_FOUND CUDA_COMPILER CUDA_RUNTIME_LIBRARY)
|
||||
|
||||
|
||||
#SET(CUDA_OPTIONS "-ncfe")
|
||||
SET(CUDA_OPTIONS "")
|
||||
SET(CUDA_OPTIONS "--host-compilation=C++")
|
||||
|
||||
IF (CUDA_EMULATION)
|
||||
SET (CUDA_OPTIONS "${CUDA_OPTIONS} -deviceemu")
|
||||
@ -90,18 +90,18 @@ MACRO (GET_CUFILE_DEPENDENCIES dependencies file)
|
||||
GET_FILENAME_COMPONENT(filepath ${file} PATH)
|
||||
|
||||
# parse file for dependencies
|
||||
FILE(READ "${file}" CONTENTS)
|
||||
#STRING(REGEX MATCHALL "#[ \t]*include[ \t]+[<\"][^>\"]*" DEPS "${CONTENTS}")
|
||||
STRING(REGEX MATCHALL "#[ \t]*include[ \t]+\"[^\"]*" DEPS "${CONTENTS}")
|
||||
FILE(READ "${file}" CONTENTS)
|
||||
#STRING(REGEX MATCHALL "#[ \t]*include[ \t]+[<\"][^>\"]*" DEPS "${CONTENTS}")
|
||||
STRING(REGEX MATCHALL "#[ \t]*include[ \t]+\"[^\"]*" DEPS "${CONTENTS}")
|
||||
|
||||
SET(${dependencies})
|
||||
|
||||
FOREACH(DEP ${DEPS})
|
||||
STRING(REGEX REPLACE "#[ \t]*include[ \t]+\"" "" DEP "${DEP}")
|
||||
|
||||
|
||||
FIND_PATH(PATH_OF_${DEP} ${DEP}
|
||||
${filepath})
|
||||
|
||||
|
||||
IF(NOT ${PATH_OF_${DEP}} STREQUAL PATH_OF_${DEP}-NOTFOUND)
|
||||
#MESSAGE("${file} : ${PATH_OF_${DEP}}/${DEP}")
|
||||
SET(${dependencies} ${${dependencies}} ${PATH_OF_${DEP}}/${DEP})
|
||||
@ -119,22 +119,22 @@ MACRO (WRAP_CUDA outfiles)
|
||||
|
||||
FOREACH (CUFILE ${ARGN})
|
||||
GET_FILENAME_COMPONENT (CUFILE ${CUFILE} ABSOLUTE)
|
||||
GET_FILENAME_COMPONENT (CFILE ${CUFILE} NAME_WE)
|
||||
SET (CFILE ${CMAKE_CURRENT_BINARY_DIR}/${CFILE}.gen.c)
|
||||
GET_FILENAME_COMPONENT (CPPFILE ${CUFILE} NAME_WE)
|
||||
SET (CPPFILE ${CMAKE_CURRENT_BINARY_DIR}/${CPPFILE}.gen.cpp)
|
||||
|
||||
GET_CUFILE_DEPENDENCIES(CUDEPS ${CUFILE})
|
||||
#MESSAGE("${CUDEPS}")
|
||||
|
||||
ADD_CUSTOM_COMMAND (
|
||||
OUTPUT ${CFILE}
|
||||
OUTPUT ${CPPFILE}
|
||||
COMMAND ${CUDA_COMPILER}
|
||||
ARGS -cuda ${cuda_includes} ${CUDA_OPTIONS} -o ${CFILE} ${CUFILE}
|
||||
ARGS -cuda ${cuda_includes} ${CUDA_OPTIONS} -o ${CPPFILE} ${CUFILE}
|
||||
MAIN_DEPENDENCY ${CUFILE}
|
||||
DEPENDS ${CUDEPS})
|
||||
|
||||
#MACRO_ADD_FILE_DEPENDENCIES(${CUFILE} ${CFILE})
|
||||
#MACRO_ADD_FILE_DEPENDENCIES(${CUFILE} ${CPPFILE})
|
||||
|
||||
SET (${outfiles} ${${outfiles}} ${CFILE})
|
||||
SET (${outfiles} ${${outfiles}} ${CPPFILE})
|
||||
ENDFOREACH (CUFILE)
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(${outfiles} PROPERTIES GENERATED 1)
|
||||
|
Loading…
Reference in New Issue
Block a user