在远程 Linux 设备上构建应用程序

除了通用 Linux 设备构建应用程序外,您还可以使用设备上的工具链在该设备构建应用程序。

要在已连接的远程 Linux 设备上构建应用程序,源代码必须可在该设备上访问。如果源代码尚未存在于该设备上,您可以将其复制或挂载到设备上。要打开已连接设备上的文件,请转至File >Open From Device

要在远程 Linux 设备上构建应用程序:

  1. 转至Preferences >Devices >Devices ,然后选择“Add ”以添加远程 Linux 设备。
  2. 访问Preferences >CMake >Tools ,然后选择“Add ”。
  3. 在“Path ”中,于“Browse ”(macOS 系统中为“Choose ”)的下拉菜单中选择“Remote ”,以添加远程 Linux 设备上 CMake 可执行文件的路径。
  4. 转至Preferences >Kits >Qt Versions ,然后按住Shift 键并点击Add 按钮,以添加远程 Linux 设备上的 Qt XML 版本。
  5. 转到Preferences >Kits >Compilers ,然后在“Add ”中选择编译器类型。
  6. C compiler path 中,于Browse (macOS 系统中为Choose )的下拉菜单中选择Remote ,以添加远程 Linux 设备上编译器的路径。
  7. 转至Preferences >Kits ,添加用于在该设备上进行构建的套件。
  8. 选择您在上一步中添加的设备、CMake 工具、Qt 版本和编译器。
  9. TypeRun deviceBuild device 中,选择remote Linux device 。在Device 中,选择要运行和构建的实际设备。
  10. 要指定构建设置:
    1. 打开要为该设备开发的应用程序项目。
    2. 选择“Projects ” > “Build & Run ”,以激活您在上文中指定的开发套件。
  11. 转至“Run Settings ”以指定运行设置。通常,您可以使用默认设置。
  12. 运行项目时,Qt Creator 会根据“Deploy Settings ”中的设置部署应用程序。

另请参阅 “添加 CMake 工具”、“操作指南:为远程 Linux 开发”“操作指南:管理套件”以及“为远程 Linux 设备开发”

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.