Skip to content

Commit cd93bda

Browse files
committed
dll attempt 1
1 parent 118cb0e commit cd93bda

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

backends/cuda/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ set(_aoti_cuda_sources
4444
runtime/shims/int4mm.cu
4545
runtime/platform/platform.cpp
4646
)
47-
add_library(aoti_cuda STATIC ${_aoti_cuda_sources})
47+
# Build as SHARED library (.dll) on Windows MSVC, otherwise STATIC
48+
if(MSVC)
49+
add_library(aoti_cuda SHARED ${_aoti_cuda_sources})
50+
# Define export macro for Windows DLL
51+
target_compile_definitions(aoti_cuda PRIVATE EXPORT_AOTI_FUNCTIONS)
52+
else()
53+
add_library(aoti_cuda STATIC ${_aoti_cuda_sources})
54+
endif()
4855
target_include_directories(
4956
aoti_cuda
5057
PUBLIC ${CUDAToolkit_INCLUDE_DIRS}

examples/models/voxtral/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,17 @@ list(
8888
if(EXECUTORCH_BUILD_CUDA)
8989
find_package(CUDAToolkit REQUIRED)
9090
list(APPEND link_libraries aoti_cuda)
91+
# Handle both static library and shared library (.dll on Windows MSVC)
9192
executorch_target_link_options_shared_lib(aoti_cuda)
93+
# On MSVC, ensure the DLL is copied to the output directory
94+
if(MSVC)
95+
add_custom_command(TARGET voxtral_runner POST_BUILD
96+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
97+
$<TARGET_FILE:aoti_cuda>
98+
$<TARGET_FILE_DIR:voxtral_runner>
99+
COMMENT "Copying aoti_cuda.dll to output directory"
100+
)
101+
endif()
92102
endif()
93103

94104
if(EXECUTORCH_BUILD_METAL)

0 commit comments

Comments
 (0)