Skip to content

Add 'CUDA' awareness#106

Merged
MarkSchofield merged 1 commit intomainfrom
mschofie/cuda
Jul 20, 2024
Merged

Add 'CUDA' awareness#106
MarkSchofield merged 1 commit intomainfrom
mschofie/cuda

Conversation

@MarkSchofield
Copy link
Copy Markdown
Owner

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.

@MarkSchofield MarkSchofield merged commit 8b6bd31 into main Jul 20, 2024
@MarkSchofield MarkSchofield deleted the mschofie/cuda branch July 20, 2024 15:43
InCom-0 pushed a commit to InCom-0/cmake_WindowsToolchain that referenced this pull request Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant