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
This commit is contained in:
Ray Molenkamp
2024-12-09 19:14:21 +01:00
committed by Ray molenkamp
parent 4d8f9bb88e
commit 776ca8d585

View File

@@ -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()