Packaging
You might notice that in order to run the app, one must add the environment path to QT’s dll (set path=%path%...). Otherwise, you must copy the depended DLL and QML to the app’s directory. You can use dependency walker to find out which .dll you needs. Then, ship your app with those dlls. You can use CMakeList.txt to copy the dlls to the installing package. To do so, install “WIX toolset”. Grasp it from here Wix toolset. The code below is the CMakeList.txt that generate the WIX’s project files and finally create the .msi installer.
#
================================================
#
Install files (Windows only)
#
================================================
IF(WIN32)
SET(CMAKE_INSTALL_PREFIX
"C:/DevBuild/MySimpleApp")
SET(CPACK_GENERATOR
WIX)
SET(CPACK_WIX_ROOT
"C:/Program
Files/WiX Toolset v3.8"
CACHE
PATH
"")
ENDIF()
SET(CPACK_WIX_UPGRADE_GUID
"8E9F80D5-452B-4333-B7A4-7FDAAE60CFAC")
INSTALL(
TARGETS
SimpleApp
RUNTIME
DESTINATION
programs
COMPONENT
applications
)
#
Copy QT's dynamic plugins
#
You do not need to copy all of these.
INSTALL(
DIRECTORY
${QT_INSTALLED_PATH}/plugins/platforms
DESTINATION
programs
COMPONENT
applications
)
INSTALL(
DIRECTORY
${QT_INSTALLED_PATH}/qml/QtQuick
DESTINATION
programs
COMPONENT
applications
)
INSTALL(
DIRECTORY
${QT_INSTALLED_PATH}/qml/QtQuick.2
DESTINATION
programs
COMPONENT
applications
)
INSTALL(FILES
"${QT_INSTALLED_PATH}/bin/Qt5Core.dll"
"${QT_INSTALLED_PATH}/bin/Qt5Widgets.dll"
"${QT_INSTALLED_PATH}/bin/Qt5Quick.dll"
"${QT_INSTALLED_PATH}/bin/Qt5Qml.dll"
"${QT_INSTALLED_PATH}/bin/Qt5Gui.dll"
"${QT_INSTALLED_PATH}/bin/Qt5Network.dll"
"${QT_INSTALLED_PATH}/bin/icuuc54.dll"
"${QT_INSTALLED_PATH}/bin/icuin54.dll"
"${QT_INSTALLED_PATH}/bin/icudt54.dll"
DESTINATION
programs
COMPONENT
applications)
#
Dont pack vc++ redist
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP
TRUE)
INCLUDE(InstallRequiredSystemLibraries)
INSTALL(PROGRAMS
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
DESTINATION
programs
COMPONENT
applications)
INCLUDE(CPack)
ENDIF()
|
Figure 1 Running the Installer |
No comments:
Post a Comment