Commit c4246bc5 authored by Vladislav Vinogradov's avatar Vladislav Vinogradov

update FindCUDA CMake module to the latest version from upstream

parent fd6ef87c
This diff is collapsed.
...@@ -37,12 +37,11 @@ ...@@ -37,12 +37,11 @@
file(READ ${input_file} depend_text) file(READ ${input_file} depend_text)
if (${depend_text} MATCHES ".+") if (NOT "${depend_text}" STREQUAL "")
# message("FOUND DEPENDS") # message("FOUND DEPENDS")
# Remember, four backslashes is escaped to one backslash in the string. string(REPLACE "\\ " " " depend_text ${depend_text})
string(REGEX REPLACE "\\\\ " " " depend_text ${depend_text})
# This works for the nvcc -M generated dependency files. # This works for the nvcc -M generated dependency files.
string(REGEX REPLACE "^.* : " "" depend_text ${depend_text}) string(REGEX REPLACE "^.* : " "" depend_text ${depend_text})
......
...@@ -37,11 +37,10 @@ ...@@ -37,11 +37,10 @@
file(READ ${input_file} file_text) file(READ ${input_file} file_text)
if (${file_text} MATCHES ".+") if (NOT "${file_text}" STREQUAL "")
# Remember, four backslashes is escaped to one backslash in the string. string(REPLACE ";" "\\;" file_text ${file_text})
string(REGEX REPLACE ";" "\\\\;" file_text ${file_text}) string(REPLACE "\ncode" ";code" file_text ${file_text})
string(REGEX REPLACE "\ncode" ";code" file_text ${file_text})
list(LENGTH file_text len) list(LENGTH file_text len)
...@@ -57,7 +56,7 @@ if (${file_text} MATCHES ".+") ...@@ -57,7 +56,7 @@ if (${file_text} MATCHES ".+")
# Extract kernel names. # Extract kernel names.
if (${entry} MATCHES "[^g]name = ([^ ]+)") if (${entry} MATCHES "[^g]name = ([^ ]+)")
string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry}) set(entry "${CMAKE_MATCH_1}")
# Check to see if the kernel name starts with "_" # Check to see if the kernel name starts with "_"
set(skip FALSE) set(skip FALSE)
...@@ -76,19 +75,19 @@ if (${file_text} MATCHES ".+") ...@@ -76,19 +75,19 @@ if (${file_text} MATCHES ".+")
# Registers # Registers
if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)") if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)")
string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry}) set(entry "${CMAKE_MATCH_3}")
message("Registers: ${entry}") message("Registers: ${entry}")
endif() endif()
# Local memory # Local memory
if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)") if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)")
string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry}) set(entry "${CMAKE_MATCH_3}")
message("Local: ${entry}") message("Local: ${entry}")
endif() endif()
# Shared memory # Shared memory
if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)") if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)")
string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry}) set(entry "${CMAKE_MATCH_3}")
message("Shared: ${entry}") message("Shared: ${entry}")
endif() endif()
......
...@@ -62,7 +62,7 @@ set(cmake_dependency_file "@cmake_dependency_file@") # path ...@@ -62,7 +62,7 @@ set(cmake_dependency_file "@cmake_dependency_file@") # path
set(CUDA_make2cmake "@CUDA_make2cmake@") # path set(CUDA_make2cmake "@CUDA_make2cmake@") # path
set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path
set(build_cubin @build_cubin@) # bool set(build_cubin @build_cubin@) # bool
set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # bool set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # path
# We won't actually use these variables for now, but we need to set this, in # We won't actually use these variables for now, but we need to set this, in
# order to force this file to be run again if it changes. # order to force this file to be run again if it changes.
set(generated_file_path "@generated_file_path@") # path set(generated_file_path "@generated_file_path@") # path
...@@ -106,7 +106,7 @@ list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}}) ...@@ -106,7 +106,7 @@ list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority # Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority
list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 ) list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 )
list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 ) list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 )
if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 ) if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN) if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN)
set(CCBIN -ccbin "${CCBIN}") set(CCBIN -ccbin "${CCBIN}")
else() else()
...@@ -126,7 +126,7 @@ endif() ...@@ -126,7 +126,7 @@ endif()
# and other return variables are present after executing the process. # and other return variables are present after executing the process.
macro(cuda_execute_process status command) macro(cuda_execute_process status command)
set(_command ${command}) set(_command ${command})
if(NOT _command STREQUAL "COMMAND") if(NOT "x${_command}" STREQUAL "xCOMMAND")
message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})") message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})")
endif() endif()
if(verbose) if(verbose)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment