diff --git a/cmake/CuteDsl.cmake b/cmake/CuteDsl.cmake index a0e2b9f..c6d099c 100644 --- a/cmake/CuteDsl.cmake +++ b/cmake/CuteDsl.cmake @@ -769,25 +769,34 @@ function(cute_dsl_setup) # Link the static archive + shim + driver lib into LINK_TARGETS. # - # For STATIC libraries, use PUBLIC so executables that link edgellmCore / - # edgellmKernels also inherit the CuTe DSL archive. Otherwise unresolved AOT - # wrapper symbols only show up at the final executable link step. + # For STATIC libraries, propagate the archive, cudart shim, driver library, + # and wrap option to dependents. The final executable performs the actual link + # step, so it must inherit all CuTe DSL runtime compatibility pieces. foreach(_tgt ${ARG_LINK_TARGETS}) get_target_property(_tgt_type ${_tgt} TYPE) if(_tgt_type STREQUAL "STATIC_LIBRARY") - target_link_libraries(${_tgt} PUBLIC "${_static_lib}") + target_link_libraries(${_tgt} PUBLIC "${_static_lib}" + trt_edgellm_cutedsl_cudart_shim) else() target_link_libraries(${_tgt} PRIVATE "${_static_lib}" trt_edgellm_cutedsl_cudart_shim) endif() if(CUDA_DRIVER_LIB AND NOT CUDA_DRIVER_LIB MATCHES "-NOTFOUND$") - target_link_libraries(${_tgt} PRIVATE "${CUDA_DRIVER_LIB}") + if(_tgt_type STREQUAL "STATIC_LIBRARY") + target_link_libraries(${_tgt} PUBLIC "${CUDA_DRIVER_LIB}") + else() + target_link_libraries(${_tgt} PRIVATE "${CUDA_DRIVER_LIB}") + endif() endif() # CUDA < 12.8: wrap _cudaLaunchKernelEx (cudaKernel_t → CUfunction, e.g. # JetPack 6). if(NOT _cute_dsl_cuda_ver STREQUAL "" AND _cute_dsl_cuda_ver VERSION_LESS 12.8) - target_link_options(${_tgt} PRIVATE "-Wl,--wrap=_cudaLaunchKernelEx") + if(_tgt_type STREQUAL "STATIC_LIBRARY") + target_link_options(${_tgt} INTERFACE "-Wl,--wrap=_cudaLaunchKernelEx") + else() + target_link_options(${_tgt} PRIVATE "-Wl,--wrap=_cudaLaunchKernelEx") + endif() endif() endforeach()