diff options
author | Raul Tambre <raul@tambre.ee> | 2020-03-12 11:31:47 (GMT) |
---|---|---|
committer | Raul Tambre <raul@tambre.ee> | 2020-04-15 14:55:41 (GMT) |
commit | e98588aabad578a9b33aae05e77f6ec5b3ff2e46 (patch) | |
tree | 34c2ee6ab9b11721b5287a6a9a2b01afb04a5943 /Tests/CudaOnly | |
parent | 71a06093795efc55c4ef3575b5c4177d38894870 (diff) | |
download | CMake-e98588aabad578a9b33aae05e77f6ec5b3ff2e46.zip CMake-e98588aabad578a9b33aae05e77f6ec5b3ff2e46.tar.gz CMake-e98588aabad578a9b33aae05e77f6ec5b3ff2e46.tar.bz2 |
CUDA: Add CUDA_ARCHITECTURES target property
Simplifies CUDA target architecture handling.
Required for Clang support as Clang doesn't automatically select a supported architecture.
We detect a supported architecture during compiler identification and set CMAKE_CUDA_ARCHITECTURES to it.
Introduces CMP0104 for backwards compatibility with manually setting code generation flags with NVCC.
Implements #17963.
Diffstat (limited to 'Tests/CudaOnly')
-rw-r--r-- | Tests/CudaOnly/Architecture/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/CudaOnly/Architecture/main.cu | 9 | ||||
-rw-r--r-- | Tests/CudaOnly/CMakeLists.txt | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/Tests/CudaOnly/Architecture/CMakeLists.txt b/Tests/CudaOnly/Architecture/CMakeLists.txt new file mode 100644 index 0000000..7270b56 --- /dev/null +++ b/Tests/CudaOnly/Architecture/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.17) +project(Architecture CUDA) + +set(CMAKE_CUDA_ARCHITECTURES 52) +add_executable(Architecture main.cu) diff --git a/Tests/CudaOnly/Architecture/main.cu b/Tests/CudaOnly/Architecture/main.cu new file mode 100644 index 0000000..8c817d5 --- /dev/null +++ b/Tests/CudaOnly/Architecture/main.cu @@ -0,0 +1,9 @@ +#ifdef __CUDA_ARCH__ +# if __CUDA_ARCH__ != 520 +# error "Passed architecture 52, but got something else." +# endif +#endif + +int main() +{ +} diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index cc1ee1a..0b2628c 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -1,4 +1,5 @@ +ADD_TEST_MACRO(CudaOnly.Architecture Architecture) ADD_TEST_MACRO(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine) ADD_TEST_MACRO(CudaOnly.EnableStandard CudaOnlyEnableStandard) ADD_TEST_MACRO(CudaOnly.ExportPTX CudaOnlyExportPTX) |