This PR adds awareness of CUDA, based on the work of @bowie7070, in #104.
In #104, @bowie7070 was setting the CMAKE_CUDA_HOST_COMPILER to the resolved path of the MSVC compiler. Based on the discussion there, it makes sense to set CMAKE_CUDA_HOST_COMPILER, but I'd like to be a little more defensive. With this change, if the CMAKE_CUDA_COMPILER value is set - so demonstrating that the caller wants Cuda support - and the CMAKE_CUDA_HOST_COMPILER isn't set, and the CUDAHOSTCXX environment variable isn't set (both ways that a caller could specify the compiler), then the toolchain will set CMAKE_CUDA_HOST_COMPILER to the value of CMAKE_CXX_COMPILER.
Since Cuda only supports MSVC on Windows - as per the documentation here - this PR only adds support to the Windows.MSVC.toolchain.cmake toolchain.
The PR also adds a Cuda example, that simply calls into the Cuda runtime, and builds it in the CI build, when the CMake preset is windows-msvc-x64.
This PR adds awareness of CUDA, based on the work of @bowie7070, in #104.
In #104, @bowie7070 was setting the
CMAKE_CUDA_HOST_COMPILER
to the resolved path of the MSVC compiler. Based on the discussion there, it makes sense to setCMAKE_CUDA_HOST_COMPILER
, but I'd like to be a little more defensive. With this change, if theCMAKE_CUDA_COMPILER
value is set - so demonstrating that the caller wants Cuda support - and theCMAKE_CUDA_HOST_COMPILER
isn't set, and theCUDAHOSTCXX
environment variable isn't set (both ways that a caller could specify the compiler), then the toolchain will setCMAKE_CUDA_HOST_COMPILER
to the value ofCMAKE_CXX_COMPILER
.Since Cuda only supports MSVC on Windows - as per the documentation here - this PR only adds support to the
Windows.MSVC.toolchain.cmake
toolchain.The PR also adds a Cuda example, that simply calls into the Cuda runtime, and builds it in the CI build, when the CMake preset is
windows-msvc-x64
.