Getting Started
入门
You can use the Qt Installer Framework to create installation programs for all kinds of applications, including (but not limited to) applications built with Qt.
可以使用Qt安装程序框架为各种应用程序创建安装程序,包括(但不限于)使用Qt构建的应用程序。
Supported Platforms
支持的平台
You can use the Qt Installer Framework to create installers for all platforms supported by desktop Qt.
可以使用Qt安装程序框架为桌面Qt支持的所有平台创建安装程序。
If you use Linux, install also Platform Plugin dependencies.
如果使用Linux,请同时安装平台插件依赖项。
Building from Sources
从源构建
The following steps describe how to build the Qt Installer Framework yourself. You can skip this if you have downloaded a pre-built version of the framework.
以下步骤描述了如何自己构建Qt安装程序框架。如果已经下载了该框架的预构建版本,则可以跳过此步骤。
Supported Compilers
支持的编译器
You can compile the Qt Installer Framework with Microsoft Visual Studio 2019 and newer, GCC 9 and newer, and Clang 13.0.0 and newer. Currently, the tested combination for Windows is Qt 6.6.0 with MSVC 2019 (Windows 10).
可以使用Microsoft Visual Studio 2019和更新版本、GCC 9和更新版本以及Clang 13.0.0和更新版本编译Qt安装程序框架。目前,Windows的测试组合是Qt 6.6.0和MSVC 2019(Windows 10)。
Configuring Qt
配置Qt
If you use a statically built Qt to build the Qt Installer Framework you do not have to deliver Qt libraries, which enables you to distribute installers as one file. For more information about statically linking against OpenSSL libraries, see SSL Import and Export Restrictions.
如果使用静态构建的Qt来构建Qt安装程序框架,就不必分发Qt库,这能够将安装程序作为一个文件分发。有关针对OpenSSL库进行静态链接的更多信息,请参阅SSL导入和导出限制。
The supported Qt version is 6.6.0.
支持的Qt版本是6.6.0。
Get Qt sources:
获取Qt源代码:
\l{https://wiki.qt.io/Building_Qt_6_from_Git}{Get Qt sources from git}.
Call init-repository with --module-subset=qt5compat, qtbase, qtdeclarative, qttools, qttranslations
Configuring Qt for Windows
为Windows配置Qt
Use the following configuration options for Windows:
使用以下Windows配置选项:
configure -prefix %CD%\qtbase -release -static -static-runtime -accessibility -no-icu -no-sql-sqlite -no-qml-debug -nomake examples -nomake tests
Configuring Qt for Linux
为Linux配置Qt
Use the following configuration options for Linux:
为Linux使用以下配置选项:
configure -prefix $PWD/qtbase -release -static -accessibility -qt-zlib -qt-libpng -qt-libjpeg -qt-pcre -no-glib -no-cups -no-sql-sqlite -no-feature-gssapi -no-qml-debug -no-opengl -no-egl -no-xinput2 -no-sm -no-icu -nomake examples -nomake tests -no-libudev -bundled-xcb-xinput -qt-harfbuzz -qt-doubleconversion
Configuring Qt for macOS
为macOS配置Qt
Use the following configuration options for macOS:
为macOS使用以下配置选项:
configure -prefix $PWD/qtbase -release -static -accessibility -qt-zlib -qt-libpng -no-cups -no-sql-sqlite -no-qml-debug -nomake examples -nomake tests -no-freetype
Build Qt:
构建Qt:
cmake --build . --parallel cmake --install .
Third Party Dependencies
第三方依赖
The Qt Installer Framework sources contain a redistribution of parts of the libarchive compression and archive library, which requires you to link against the following libraries; liblzma, zlib, libbzip2, and on macOS, libiconv.
Qt安装程序框架源代码包含libarchive压缩和归档库的部分重新分发,这要求链接到以下库;liblzma、zlib、libbzip2,以及macOS上的libiconv。
To enable the use of libarchive, add the libarchive configuration feature to the list of values specified by the CONFIG variable. Installers created with this configuration support the creating and extracting of 7zip, zip, and tar archive files, with gzip, bzip2, and xz as available compression methods.
要启用libarchive,请将libarchive配置功能添加到CONFIG变量指定的值列表中。使用此配置创建的安装程序支持创建和提取7zip、zip和tar存档文件,其中gzip、bzip2和xz是可用的压缩方法。
qmake CONFIG+=libarchive
You can use the IFW_ZLIB_LIBRARY, IFW_BZIP2_LIBRARY, IFW_LZMA_LIBRARY, and IFW_ICONV_LIBRARY variables to specify the exact library files.
可以使用IFW_ZLIB_LIBRARY、IFW_BZIP2_LIBRARY、IFW_LZMA_LIBRARY和IFW_ICONV_LIBRARY变量来指定确切的库文件。
If you add the -qt-zlib configuration to the Qt version used to build the Qt Installer Framework, and IFW_ZLIB_LIBRARY variable is empty, libarchive will try to use the zlib library compiled into the QtCore module, which removes the need for an external library.
如果将-qt-zlib配置添加到用于构建qt安装程序框架的qt版本中,并且IFW_ZLIB_LIBRARY 变量为空,libarchive将尝试使用编译到QtCore模块中的zlib库,从而消除了对外部库的需求。
If you do not enable libarchive support, the builtin LZMA SDK library will act as a fallback and installation of the extra dependencies will not occur, but created installers will only support the 7zip format.
如果不启用libarchive支持,内置的LZMA SDK库将作为回退,不会安装额外的依赖项,但创建的安装程序将仅支持7zip格式。
Note: Building IFW with LZMA SDK is deprecated and may not be available in future versions.
注意:使用LZMA SDK构建IFW已被弃用,在未来的版本中可能不可用。
Installing Dependencies for Windows
安装Windows依赖项
You can download the source archives for the dependencies from:
可以从以下网址下载依赖关系的源文件:
When building the third party libraries with MSVC, make sure to use the same version that you used to build Qt, and that the compiler option used to select the run-time library matches the configuration options for Qt (debug/release, static/dynamic runtime).
使用MSVC构建第三方库时,请确保使用与构建Qt相同的版本,并且用于选择运行时库的编译器选项与Qt的配置选项(调试/发布、静态/动态运行时)匹配。
Installing Dependencies for Linux
安装Linux依赖项
The required third party compression libraries are likely available from your distribution's package manager repositories.
所需的第三方压缩库可能可以从发行版的包管理器存储库中获得。
For example, on Ubuntu 18.04 you can invoke the following to install the development packages containing headers for the libraries:
例如,在Ubuntu 18.04上,您可以调用以下命令来安装包含库头文件的开发包:
sudo apt install zlib1g-dev liblzma-dev libbz2-dev
Installing Dependencies for macOS
为macOS安装依赖项
The easiest way to install the missing libraries is with a third party package manager solution, like Homebrew or MacPorts. On macOS 10.15 you should only need to additionally install the liblzma library.
安装缺失库的最简单方法是使用第三方包管理器解决方案,如Homebrew或MacPorts。在macOS 10.15上,只需要额外安装liblzma库。
On Homebrew this would be:
在Homebrew上,这将是:
brew install xz
Troubleshooting
疑难解答
For libarchive related compilation errors, you may need to edit the definitions in a configuration header file respective to your platform. You can find this file in the src/libs/3rdparty/libarchive/config/ directory of the Installer Framework sources.
对于与libarchive相关的编译错误,可能需要根据平台编辑配置头文件中的定义。可以在安装程序框架源代码的src/libs/3rdparty/libarchive/config/目录中找到此文件。
Setting up Qt Installer Framework
设置Qt安装程序框架
1.Clone the Qt Installer Framework source code from installer-framework/installer-framework.git - Qt Installer Framework to get the sources for the tools.
1.从Installer Framework/Installer-Framework.git-Qt Installer Framework中克隆Qt Installer Framework源代码,以获取工具的源代码。
2.Build the tools by running the "qmake" from the static Qt, followed by "make" or "nmake".
2.通过从静态Qt运行“qmake”,然后运行“make”或“nmake”来构建工具。
Note: To contribute patches to Qt Installer Framework, follow the standard Qt processes and guidelines. For more information, see Contribute to Qt.
注意:要为Qt安装程序框架贡献补丁,请遵循标准的Qt流程和指南。有关更多信息,请参阅为Qt做出贡献。
Overview of Qt Installer FrameworkEnd User Workflows
© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. The Qt Company, Qt and their respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

6967

被折叠的 条评论
为什么被折叠?



