Page MenuHomePhabricator

Qt5 plugins installation/packaging
Closed, ResolvedPublic

Description

When making a package of an MITK application build with Qt5 and MITK 2014.10, some of the shared libraries needed for execution of the application are not packaged. This includes the platform plugins (Qt/plugins/platforms) and some other shared libraries, depending on the target OS.

The problem was noticed in Ubuntu 14.04 with custom-built Qt 5.3.2.
To solve the problem, I have found the DeployQt5.cmake in the web, which is a somewhat modified version of DeployQt4.cmake. Seemingly, the "porting" wasn't really done completely, so I have modified it for better compatibility (See attachment).

How I used it (and it worked correctly on both Win and Lin) is - in the application CMakeLists.txt file - add the following lines:

include(DeployQt5)
install_qt5_executable("bin/${MY_APP_NAME}${CMAKE_EXECUTABLE_SUFFIX}" "${Qt5Gui_PLUGINS};${Qt5Sql_PLUGINS}" "" "" "plugins")

The reason for putting these into the application CMakeLists.txt is that the application executable has to be installed before these lines are executed.

Event Timeline

Actually it's better also to request qt.conf file, so the call is like
install_qt5_executable("bin/${MY_APP_NAME}${CMAKE_EXECUTABLE_SUFFIX}" "${Qt5Gui_PLUGINS};${Qt5Sql_PLUGINS}" "" "" "plugins", TRUE)

Comma is of course redundant
install_qt5_executable("bin/${MY_APP_NAME}${CMAKE_EXECUTABLE_SUFFIX}" "${Qt5Gui_PLUGINS};${Qt5Sql_PLUGINS}" "" "" "plugins" TRUE)

Also, for SVG icons to work, it is necessary to install svg plugin as well, so the line should be:

install_qt5_executable("bin/${MY_APP_NAME}${CMAKE_EXECUTABLE_SUFFIX}" "${Qt5Gui_PLUGINS};${Qt5Sql_PLUGINS};${Qt5Svg_PLUGINS}" "" "" "plugins" TRUE)

Qt5 deployment is fixed in the current master and successfully tested on our installer dartclients. Hence, I close this bug.