diff options
author | Brad King <brad.king@kitware.com> | 2020-01-28 15:52:23 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-01-28 15:52:33 (GMT) |
commit | 1f9321c68399c8cc37a2cb9c78ef45949412bd7b (patch) | |
tree | d6119155229ec9948d8c1e6d1399bf7139b5d4db /Modules | |
parent | 2e4a948fb821612d8317f7fe4a33792af73472d1 (diff) | |
parent | 0d0145138fe7cd60edc7f0b97e860e9a4fae1555 (diff) | |
download | CMake-1f9321c68399c8cc37a2cb9c78ef45949412bd7b.zip CMake-1f9321c68399c8cc37a2cb9c78ef45949412bd7b.tar.gz CMake-1f9321c68399c8cc37a2cb9c78ef45949412bd7b.tar.bz2 |
Merge topic 'cuda_runtime_library_controls'
0d0145138f CUDA: Add abstraction for cuda runtime selection
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4178
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeTestCUDACompiler.cmake | 11 | ||||
-rw-r--r-- | Modules/Compiler/NVIDIA-CUDA.cmake | 5 | ||||
-rw-r--r-- | Modules/Platform/Windows-NVIDIA-CUDA.cmake | 5 |
3 files changed, 21 insertions, 0 deletions
diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake index a0f6bc9..d80b55a 100644 --- a/Modules/CMakeTestCUDACompiler.cmake +++ b/Modules/CMakeTestCUDACompiler.cmake @@ -67,6 +67,17 @@ else() set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}") endif() + # Remove the following libraries from CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES and + # CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES + # + # - cudart + # - cudart_static + # - cudadevrt + # + # These are controlled by CMAKE_CUDA_RUNTIME_LIBRARY + list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES cudart cudart_static cudadevrt) + list(REMOVE_ITEM CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES cudart cudart_static cudadevrt) + # Re-configure to save learned information. configure_file( ${CMAKE_ROOT}/Modules/CMakeCUDACompiler.cmake.in diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index fb1fc20..a786fb9 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -43,6 +43,11 @@ endif() set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS -shared) set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA -isystem=) +set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC") +set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static") +set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart") +set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "") + if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "") set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "") diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake index 30b5aa9..f809094 100644 --- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake @@ -69,6 +69,11 @@ else() endif() unset(_cmp0092) +set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC") +set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static") +set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart") +set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "") + string(APPEND CMAKE_CUDA_FLAGS_INIT " ${PLATFORM_DEFINES_CUDA} -D_WINDOWS -Xcompiler=\"${_W3}${_FLAGS_CXX}\"") string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=\"${_MDd}-Zi -Ob0 -Od ${_RTC1}\"") string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=\"${_MD}-O2 -Ob2\" -DNDEBUG") |