From 776ca8d58555a3ea8d003dddc18f49f8bd74f458 Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Mon, 9 Dec 2024 19:14:21 +0100 Subject: [PATCH] Fix: deps_builder: fix CUDA detection The deps builder currently uses `check/enable_language(CUDA)` but given it's just a coordinator for external builds, doesn't actually build any cuda code. The problem there is, for enable_language(CUDA) to work, the CUDA Visual studio integration needs to be installed which they refuse to install when only the VS buildtools are installed, they somehow require the full IDE to be available. Cmake will try to compile some code and fail. (this worked previously since i had a full VS install on my build machine, but that should not be used due to ms not providing a back catalog of older versions of VS community) This change, changes things over to use the FindCUDAToolkit module (not to be confused with the deprecated FindCUDA module), which just locates the libraries, includes and nvcc but doesn't compile anything. which neatly sidesteps the issue. None of our downstream deps rely on the VS integration either, so we are in the clear..... for now.. Pull Request: https://projects.blender.org/blender/blender/pulls/130913 --- .../build_environment/cmake/check_compilers.cmake | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/build_files/build_environment/cmake/check_compilers.cmake b/build_files/build_environment/cmake/check_compilers.cmake index 99a495fc4af..1ba96825fdc 100644 --- a/build_files/build_environment/cmake/check_compilers.cmake +++ b/build_files/build_environment/cmake/check_compilers.cmake @@ -19,14 +19,12 @@ if(UNIX AND NOT APPLE) endif() if(NOT APPLE) - include(CheckLanguage) - check_language(CUDA) - if(NOT CMAKE_CUDA_COMPILER) + find_package(CUDAToolkit) + if(NOT CUDAToolkit_NVCC_EXECUTABLE) message(STATUS "Missing CUDA compiler") else() - enable_language(CUDA) - message(STATUS "Found CUDA Compiler: ${CMAKE_CUDA_COMPILER_ID} ${CMAKE_CUDA_COMPILER_VERSION}") - if(NOT CMAKE_CUDA_COMPILER_VERSION MATCHES ${RELEASE_CUDA_VERSION}) + message(STATUS "Found CUDA Compiler: ${CUDAToolkit_NVCC_EXECUTABLE} ${CUDAToolkit_VERSION}") + if(NOT CUDAToolkit_VERSION MATCHES ${RELEASE_CUDA_VERSION}) message(STATUS " NOTE: Official releases uses CUDA ${RELEASE_CUDA_VERSION}") endif() endif()