diff --git a/core/tests/CMakeLists.txt b/core/tests/CMakeLists.txt index 434e6b3..bb2f4c2 100644 --- a/core/tests/CMakeLists.txt +++ b/core/tests/CMakeLists.txt @@ -7,6 +7,28 @@ function(stplugin_add_test name) if(WIN32) # loopback_server.h needs Winsock for the real-backend tests. target_link_libraries(${name} PRIVATE ws2_32) + + # stplugin_core links LiveKit::livekit PUBLICly (see + # ../CMakeLists.txt), so every test executable here is linked + # against livekit.dll / livekit_ffi.dll. Unlike the RPATH/$ORIGIN + # handling obs-adapter/CMakeLists.txt sets up for Linux/macOS, + # Windows has no way to find a DLL relative to the .exe -- it must + # physically sit next to it (or be on PATH) at process start, or + # the loader fails before main() with STATUS_DLL_NOT_FOUND + # (0xc0000135), which is exactly what CTest saw for test_session, + # test_integration_livekit and test_livekit_smoke. Copy the same + # LIVEKIT_SDK_RUNTIME_LIBS list (from cmake/LiveKitSDK.cmake) that + # obs-adapter stages next to the plugin module, next to each test + # binary instead. Applied to every test here, not just the three + # known to actually reference LiveKit symbols today -- harmless for + # the others and avoids re-diagnosing this if a future test starts + # touching stplugin_core's LiveKit-dependent code paths. + add_custom_command(TARGET ${name} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${LIVEKIT_SDK_RUNTIME_LIBS} "$" + COMMENT "Copying LiveKit runtime DLLs next to ${name}" + VERBATIM + ) endif() add_test(NAME ${name} COMMAND ${name}) # Nothing here should ever take a minute; a hang is a failure, not a