From 8981e3e7ccba26084d86504e47b906bd55cb0a13 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Wed, 2 Dec 2020 17:31:02 +0100 Subject: NVIDIA-CUDA: rely on new capabilities for deps generation --- Modules/CMakeCUDAInformation.cmake | 15 --------------- Modules/Compiler/NVIDIA-CUDA.cmake | 7 +++---- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index 58e6e29..cb03ef4 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -154,21 +154,6 @@ if(NOT CMAKE_CUDA_COMPILE_WHOLE_COMPILATION) " ${_CMAKE_CUDA_EXTRA_FLAGS} ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c -o ") endif() -if(CMAKE_GENERATOR STREQUAL "Ninja" AND NOT CMAKE_DEPFILE_FLAGS_CUDA) - set(CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION - " ${_CMAKE_CUDA_EXTRA_FLAGS} ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M -MT -o $DEP_FILE") - #The Ninja generator uses the make file dependency files to determine what - #files need to be recompiled. Unfortunately, nvcc < 10.2 doesn't support building - #a source file and generating the dependencies of said file in a single - #invocation. Instead we have to state that you need to chain two commands. - # - #The makefile generators uses the custom CMake dependency scanner, and thus - #it is exempt from this logic. - list(APPEND CMAKE_CUDA_COMPILE_PTX_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}") - list(APPEND CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}") - list(APPEND CMAKE_CUDA_COMPILE_WHOLE_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}") -endif() - # compile a cu file into an executable if(NOT CMAKE_CUDA_LINK_EXECUTABLE) set(CMAKE_CUDA_LINK_EXECUTABLE diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index 3e8d4eb..eb80675 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -29,13 +29,12 @@ if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89) # before that we had to invoke the compiler twice # to get header dependency information set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT -MF ") +else() + set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS " ${_CMAKE_CUDA_EXTRA_FLAGS} ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M -MT -o ") endif() +set(CMAKE_CUDA_DEPFILE_FORMAT gcc) if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") - if (NOT CMAKE_DEPFILE_FLAGS_CUDA) - set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS " ${_CMAKE_CUDA_EXTRA_FLAGS} ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M -MT -o ") - endif() - set(CMAKE_CUDA_DEPFILE_FORMAT gcc) set(CMAKE_CUDA_DEPENDS_USE_COMPILER TRUE) endif() -- cgit v0.12