Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ if(STRATA_BUILD_CONVERSATION_TESTS)
endif()

if(STRATA_ENABLE_CUDA)
# #585: the CUDA language links the runtime per CMAKE_CUDA_RUNTIME_LIBRARY, whose default is "Static"
# (cudart_static.lib), while the targets below link the imported CUDA::cudart explicitly (the dynamic
# import library). Both end up on the link line; MSVC rejects the duplicated runtime symbols
# (LNK2005/LNK1169) - seen on a Windows sm_70 source build - while GNU ld tolerates them, so Linux
# never noticed. "Shared" makes the language rule agree with CUDA::cudart; an explicit -D keeps winning.
if(NOT DEFINED CMAKE_CUDA_RUNTIME_LIBRARY)
set(CMAKE_CUDA_RUNTIME_LIBRARY Shared)
endif()
enable_language(CUDA)
# `enable_language(CUDA)` gives the .cu compile rules but NOT the imported targets, so `CUDA::cudart` has to
# be brought in explicitly for the host-side tests that call cudaMalloc themselves.
Expand Down