@@ -328,20 +328,30 @@ if(LIVEKIT_IS_TOPLEVEL)
328328 )
329329 endif ()
330330
331- # Copy third-party DLL dependencies to lib directory (Windows only)
331+ # Copy third-party DLL and LIB dependencies to lib directory (Windows only)
332332 if (WIN32 AND LIVEKIT_USE_VCPKG)
333- # Determine vcpkg bin directory based on configuration
333+ # Determine vcpkg directories based on configuration
334334 set (VCPKG_BIN_DIR_DEBUG "${LIVEKIT_ROOT_DIR} /vcpkg_installed/x64-windows/debug/bin" )
335335 set (VCPKG_BIN_DIR_RELEASE "${LIVEKIT_ROOT_DIR} /vcpkg_installed/x64-windows/bin" )
336+ set (VCPKG_LIB_DIR_DEBUG "${LIVEKIT_ROOT_DIR} /vcpkg_installed/x64-windows/debug/lib" )
337+ set (VCPKG_LIB_DIR_RELEASE "${LIVEKIT_ROOT_DIR} /vcpkg_installed/x64-windows/lib" )
336338
337- # List of required DLL files
339+ # List of required DLL files (runtime)
338340 set (REQUIRED_DLLS
339341 "libprotobuf.dll"
340342 # "libprotobuf-lite.dll"
341343 # "libprotoc.dll"
342344 "abseil_dll.dll"
343345 )
344346
347+ # List of required LIB files (for linking)
348+ set (REQUIRED_LIBS
349+ "libprotobuf.lib"
350+ # "libprotobuf-lite.lib"
351+ # "libprotoc.lib"
352+ "abseil_dll.lib"
353+ )
354+
345355 # Copy DLLs to the lib output directory
346356 foreach (DLL_FILE ${REQUIRED_DLLS} )
347357 add_custom_command (
@@ -354,7 +364,20 @@ if(LIVEKIT_IS_TOPLEVEL)
354364 )
355365 endforeach ()
356366
367+ # Copy LIBs (import libraries) to the lib output directory
368+ foreach (LIB_FILE ${REQUIRED_LIBS} )
369+ add_custom_command (
370+ TARGET livekit POST_BUILD
371+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
372+ "$<IF:$<CONFIG:Debug>,${VCPKG_LIB_DIR_DEBUG} /${LIB_FILE} ,${VCPKG_LIB_DIR_RELEASE} /${LIB_FILE} >"
373+ "$<TARGET_FILE_DIR:livekit>/${LIB_FILE} "
374+ COMMENT "Copying ${LIB_FILE} to lib directory"
375+ VERBATIM
376+ )
377+ endforeach ()
378+
357379 message (STATUS "Third-party DLLs will be copied to lib directory: ${REQUIRED_DLLS} " )
380+ message (STATUS "Third-party LIBs will be copied to lib directory: ${REQUIRED_LIBS} " )
358381 endif ()
359382endif ()
360383
0 commit comments