diff options
author | Brad King <brad.king@kitware.com> | 2022-03-04 18:51:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-03-10 14:27:29 (GMT) |
commit | d1b48bfabd6157309b3056967e6e30cc0ce07983 (patch) | |
tree | 3ce109b078bf5da4d866f6e2994bbce8246e4df1 /Source/cmVisualStudioGeneratorOptions.cxx | |
parent | 632752d62e8de2730796f509dbb10551351309c2 (diff) | |
download | CMake-d1b48bfabd6157309b3056967e6e30cc0ce07983.zip CMake-d1b48bfabd6157309b3056967e6e30cc0ce07983.tar.gz CMake-d1b48bfabd6157309b3056967e6e30cc0ce07983.tar.bz2 |
CUDA: Add support for CUDA_ARCHITECTURES=native
CUDA 11.6 added the `nvcc -arch=native` flag to automatically compile
for the host GPUs' architectures. Add support for specifying this
special `native` value in `CMAKE_CUDA_ARCHITECTURES` and
`CUDA_ARCHITECTURES`. During the compiler ABI detection step,
detect the native architectures so we can pass them explicitly
when using Clang or older versions of nvcc.
Fixes: #22375
Diffstat (limited to 'Source/cmVisualStudioGeneratorOptions.cxx')
-rw-r--r-- | Source/cmVisualStudioGeneratorOptions.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 9045a4d..d5d08b8 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -182,7 +182,8 @@ void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration() // First entries for the -arch=<arch> [-code=<code>,...] pair. if (!arch.empty()) { std::string arch_name = arch[0]; - if (arch_name == "all" || arch_name == "all-major") { + if (arch_name == "all" || arch_name == "all-major" || + arch_name == "native") { AppendFlagString("AdditionalOptions", "-arch=" + arch_name); return; } |