Skip to content

Commit a6b20e6

Browse files
committed
fix test build and have some unintuitive linkage for now
1 parent 5596c45 commit a6b20e6

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,9 @@ endif()
591591
if(EXECUTORCH_BUILD_CUDA)
592592
# Build CUDA-specific AOTI functionality
593593
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/cuda)
594-
# Add aoti_cuda to backends - it already depends on aoti_common
595-
list(APPEND _executorch_backends aoti_cuda)
594+
# Add aoti_cuda_backend to backends - it transitively includes aoti_cuda_shims
595+
# and cuda_platform
596+
list(APPEND _executorch_backends aoti_cuda_backend)
596597
endif()
597598

598599
if(EXECUTORCH_BUILD_METAL)

backends/cuda/CMakeLists.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,21 @@ target_link_options(
168168
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wl,--export-dynamic>
169169
)
170170

171-
# Link against shims library and other dependencies
171+
# Link against shims library and other dependencies On Windows (MSVC), use
172+
# PRIVATE linkage for aoti_cuda_shims since the DLL is copied to the executable
173+
# directory. On other platforms, use PUBLIC so the dependency propagates to
174+
# consumers.
172175
target_link_libraries(
173-
aoti_cuda_backend
174-
PRIVATE aoti_cuda_shims cuda_platform
175-
PUBLIC extension_tensor cuda_tensor_maker CUDA::cudart ${CMAKE_DL_LIBS}
176+
aoti_cuda_backend PUBLIC cuda_platform extension_tensor cuda_tensor_maker
177+
CUDA::cudart ${CMAKE_DL_LIBS}
176178
)
177179

180+
if(MSVC)
181+
target_link_libraries(aoti_cuda_backend PRIVATE aoti_cuda_shims)
182+
else()
183+
target_link_libraries(aoti_cuda_backend PUBLIC aoti_cuda_shims)
184+
endif()
185+
178186
executorch_target_link_options_shared_lib(aoti_cuda_backend)
179187

180188
install(

0 commit comments

Comments
 (0)