Internal
Public Access
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
"$<TARGET_FILE_DIR:orbithub>/platforms"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"$<TARGET_FILE:Qt6::QWindowsIntegrationPlugin>"
|
||||
"$<TARGET_FILE_DIR:orbithub>/platforms/"
|
||||
COMMENT "Deploying Qt Windows platform plugin"
|
||||
)
|
||||
install(FILES "$<TARGET_FILE:Qt6::QWindowsIntegrationPlugin>"
|
||||
DESTINATION "${CMAKE_INSTALL_BINDIR}/platforms"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TARGET Qt6::QSQLiteDriverPlugin)
|
||||
add_custom_command(TARGET orbithub POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory
|
||||
"$<TARGET_FILE_DIR:orbithub>/sqldrivers"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"$<TARGET_FILE:Qt6::QSQLiteDriverPlugin>"
|
||||
"$<TARGET_FILE_DIR:orbithub>/sqldrivers/"
|
||||
COMMENT "Deploying Qt SQLite driver plugin"
|
||||
)
|
||||
install(FILES "$<TARGET_FILE:Qt6::QSQLiteDriverPlugin>"
|
||||
DESTINATION "${CMAKE_INSTALL_BINDIR}/sqldrivers"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_target_properties(orbithub PROPERTIES
|
||||
BUILD_RPATH_USE_ORIGIN ON
|
||||
INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/orbithub"
|
||||
|
||||
Reference in New Issue
Block a user