在 Docker 设备上构建
除了为Docker 构建应用程序外,您还可以使用 Docker 中的工具链在Docker 中构建应用程序。
注意: 启用 Docker 插件才能使用它。
在 Docker 设备上构建应用程序:
- 转到首选项>Devices >Devices ,然后选择Add 添加 Docker 设备。
- 转到Preferences >CMake >Tools ,然后选择Add 。
- 在Path 中,从Browse (macOS 上为Choose )的下拉菜单中选择Remote ,以添加 Docker 设备上 CMake 可执行文件的路径。
- 转到Preferences >Kits >Qt Versions ,然后选择并按住Shift键并选择Add 按钮,在 Docker 设备上添加 Qt XML 版本。
- 转到Preferences >Kits >Compilers ,然后在Add 中选择编译器类型。
- 在C compiler path 中,从Browse 的下拉菜单中选择Remote (macOS 上为Choose ),以添加 Docker 设备上编译器的路径。
- 转到Preferences >Kits ,添加用于在设备上构建的工具包。
- 选择上面添加的设备、CMake 工具、Qt 版本和编译器。
- 在Type 中的Run device 和Build device ,选择Docker device 。在Device 中选择要运行和构建的实际设备。
- 指定构建设置:
- 为要在设备上开发的应用程序打开一个项目。
- 选择Projects >Build & Run 激活您在上面指定的工具包。
- 选择Run 以指定运行设置。通常可以使用默认设置。
运行项目时,Qt Creator 会按照部署步骤的指定部署应用程序。
另请参阅 "添加 CMake 工具"、"启用和禁用插件"、"如何:为 Docker 开发"和 "如何:管理工具包"。
Copyright © The Qt Company Ltd. and other contributors. 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.