Add CMake option to control CUDA host compiler

This revision allows to specify CUDA host compiler (nvcc's -ccbin command
line option) when configuring the build. It addresses the case where the
C/C++ compiler to be used in CUDA toolchain should be different from the
default C/C++ compiler, for instance in case of compilers versions conflicts
or multiple installed compilers.

The new CMake option is named `CUDA_HOST_COMPILER` and can be used as follows:
`cmake -DCUDA_HOST_COMPILER=<path-to-host-compiler>`

If the option is not specified, the build configuration behaves as previously.

Differential Revision: https://developer.blender.org/D14248
This commit is contained in:
howetuft 2022-03-07 15:42:47 +01:00 committed by Brecht Van Lommel
parent 6aaae44473
commit 013d0631e6
1 changed files with 5 additions and 0 deletions

View File

@ -407,6 +407,11 @@ if(WITH_CYCLES_CUDA_BINARIES)
-o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_file}
-Wno-deprecated-gpu-targets)
if(CUDA_HOST_COMPILER)
set(cuda_flags ${cuda_flags}
-ccbin="${CUDA_HOST_COMPILER}")
endif()
if(WITH_NANOVDB)
set(cuda_flags ${cuda_flags}
-D WITH_NANOVDB