diff options
author | Brad King <brad.king@kitware.com> | 2024-01-23 19:55:56 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-01-23 19:56:16 (GMT) |
commit | 4571ce5f1a7181f71794fc03837482e0a388a862 (patch) | |
tree | 9c88728ac6966e3719fca40b1a71baad13ecf916 /Modules/Platform | |
parent | 77dc558d1ed595887477410c5ac69b3e57cfbf0e (diff) | |
parent | 88c740462c63b09a20b4eeac0aa6ef182cb0c5dd (diff) | |
download | CMake-4571ce5f1a7181f71794fc03837482e0a388a862.zip CMake-4571ce5f1a7181f71794fc03837482e0a388a862.tar.gz CMake-4571ce5f1a7181f71794fc03837482e0a388a862.tar.bz2 |
Merge topic 'cuda-clang-windows'
88c740462c CUDA/Clang: Add support for MSVC ABI on Windows using GNU-like frontend
Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Raul Tambre <raul@tambre.ee>
Merge-request: !9172
Diffstat (limited to 'Modules/Platform')
-rw-r--r-- | Modules/Platform/Windows-Clang-CUDA.cmake | 16 | ||||
-rw-r--r-- | Modules/Platform/Windows-Clang.cmake | 7 |
2 files changed, 21 insertions, 2 deletions
diff --git a/Modules/Platform/Windows-Clang-CUDA.cmake b/Modules/Platform/Windows-Clang-CUDA.cmake new file mode 100644 index 0000000..c37df3b --- /dev/null +++ b/Modules/Platform/Windows-Clang-CUDA.cmake @@ -0,0 +1,16 @@ +include(Platform/Windows-Clang) +__windows_compiler_clang(CUDA) + +# Tell Clang where to find the CUDA libraries. +set(__IMPLICIT_LINKS) +foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}) + string(APPEND __IMPLICIT_LINKS " -L\"${dir}\"") +endforeach() +string(APPEND CMAKE_CUDA_LINK_EXECUTABLE "${__IMPLICIT_LINKS}") +string(APPEND CMAKE_CUDA_CREATE_SHARED_LIBRARY "${__IMPLICIT_LINKS}") +string(APPEND CMAKE_CUDA_CREATE_SHARED_MODULE "${__IMPLICIT_LINKS}") +unset(__IMPLICIT_LINKS) + +# Device linking is just regular linking so these are the same. +set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG ${CMAKE_CUDA_LINKER_WRAPPER_FLAG}) +set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG_SEP ${CMAKE_CUDA_LINKER_WRAPPER_FLAG_SEP}) diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index f081f42..db48150 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -53,6 +53,7 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_${lang}_LINK_OPTIONS_PIE "") set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "") set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD UNICITY=ALL) @@ -184,18 +185,19 @@ endmacro() if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC" OR "x${CMAKE_HIP_SIMULATE_ID}" STREQUAL "xMSVC") __verify_same_language_values(COMPILER_ID "The current configuration mixes Clang and MSVC or " "some other CL compatible compiler tool. This is not supported. " - "Use either clang or MSVC as both C, C++ and/or HIP compilers.") + "Use either Clang or MSVC as the compiler for all of C, C++, CUDA and/or HIP.") __verify_same_language_values(COMPILER_FRONTEND_VARIANT "The current configuration uses the Clang compiler " "tool with mixed frontend variants, both the GNU and in MSVC CL " "like variants. This is not supported. Use either clang/clang++ " - "or clang-cl as both C, C++ and/or HIP compilers.") + "or clang-cl as all C, C++, CUDA and/or HIP compilers.") if(NOT CMAKE_RC_COMPILER_INIT) # Check if rc is already in the path @@ -217,6 +219,7 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" if ( "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" OR "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" + OR "x${CMAKE_CUDA_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" OR "x${CMAKE_HIP_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") include(Platform/Windows-MSVC) |