From 30f013474859737a0ddc6168a82f8cdc45240ff7 Mon Sep 17 00:00:00 2001 From: Keith Smith Date: Tue, 8 Sep 2026 08:20:17 -0600 Subject: [PATCH] Deploy Qt platform and SQLite plugins automatically on Windows Qt loads its platform integration and SQL driver plugins dynamically (QFactoryLoader) rather than importing them at link time, so they never show up in orbithub.exe's import table and vcpkg's automatic DLL deployment never copies them. Without this, the app fails to launch on Windows with "Could not find the Qt platform plugin" or "can not load requested driver 'QSQLITE'". Copy them out explicitly via Qt's own exported plugin targets after each build, plus matching install() rules for future packaging. Co-Authored-By: Claude Sonnet 5 --- CMakeLists.txt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8e3387..e076fc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,6 +129,42 @@ else() message(FATAL_ERROR "Vendored FreeRDP targets were not produced as expected.") endif() +# Qt loads platform integration and SQL driver plugins dynamically at +# runtime (QFactoryLoader), so they never appear in orbithub.exe's import +# table. vcpkg's automatic DLL deployment only follows the import table, so +# these plugins have to be copied out explicitly or the app fails to start +# with "Could not find the Qt platform plugin" / "can not load requested +# driver 'QSQLITE'". +if(WIN32) + if(TARGET Qt6::QWindowsIntegrationPlugin) + add_custom_command(TARGET orbithub POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + "$/platforms" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "$" + "$/platforms/" + COMMENT "Deploying Qt Windows platform plugin" + ) + install(FILES "$" + DESTINATION "${CMAKE_INSTALL_BINDIR}/platforms" + ) + endif() + + if(TARGET Qt6::QSQLiteDriverPlugin) + add_custom_command(TARGET orbithub POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + "$/sqldrivers" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "$" + "$/sqldrivers/" + COMMENT "Deploying Qt SQLite driver plugin" + ) + install(FILES "$" + DESTINATION "${CMAKE_INSTALL_BINDIR}/sqldrivers" + ) + endif() +endif() + set_target_properties(orbithub PROPERTIES BUILD_RPATH_USE_ORIGIN ON INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/orbithub"