Qt 打包建议
发行版可能需要打包多个不同的 Qt 版本。以 Linux 发行版为例,我们建议采用以下方法:
- 配置 Qt,将可执行文件安装到
/usr/qt6/bin
。 - 在
/usr/bin
中创建版本后缀为/usr/qt6/bin
的面向用户应用程序的符号链接。例如,创建指向/usr/qt6/bin/designer
的 symlink/usr/bin/designer6
。
面向用户的应用程序是指应该由用户启动的 Qt 工具。这包括 qmake、Qt Widgets Designer 、Qt Linguist 等。其他工具,如 moc、rcc 和 uic,通常不是由用户手动调用,而是由用户项目的构建系统调用。
在 Qt 的构建系统中,我们认为是面向用户的工具都会被标记为面向用户,这些信息可以通过以下方式提取和使用。
使用 CMake 参数配置 Qt:
-DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_BINDIR=/usr/qt6/bin -DINSTALL_PUBLICBINDIR=/usr/bin
这将在 Qt 的构建目录中创建一个名为user_facing_tool_links.txt
的文件。该文件的每一行都包含INSTALL_BINDIR
中面向用户的工具的路径,以及INSTALL_PUBLICDIR
中版本控制链接的路径,中间用一个空格隔开。
该文件可用于创建所有版本控制的符号链接:
xargs ln -s < user_facing_tool_links.txt
© 2025 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. Qt and 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.