使用 QtCreator 部署自定义构建的项目

Deploy a custom built project with QtCreator

我在 Linux 上使用带有 QtCreator 4.6.0 IDE 的自定义构建系统(不是 CMake 或 qmake),尽管我安装了这两个插件。

我的项目是为嵌入式 Linux 设备交叉编译的,我已经为其设置了套件。 构建良好,但问题出在部署步骤,自定义构建系统没有告诉它可执行文件,所以它不知道要将哪些文件部署到设备。我一直在参考这个页面:

http://doc.qt.io/qtcreator/creator-deployment-embedded-linux.html

在我的 运行 设置页面中,我有 "Upload files via SFTP" 的部署部分,但是 "Files to deploy" 列表是空的 (请参阅上面的第一个屏幕截图 link)。当我尝试 deploy/run 时,它确认没有部署文件,因为它输出:

No deployment action necessary. Skipping.
Deploy step finished.

文档link 首先说到"Edit the qmake INSTALLS variable in the project .pro file to add the missing files.",但是,我的项目根本没有.pro 文件。我为了好玩而创建了一个,而 QtCreator 不知道它的存在是为了能够查看 INSTALLS 行,所以这是行不通的。

在底部的 "Deploying CMake Projects to Embedded Linux Devices" 部分,然后显示 "You must specify all other files in the QtCreatorDeployment.txt file that you create and place in either the root directory of the CMake project or the build directory of the active build configuration." 所以我在主项目目录中创建了这样一个文件,以及构建目录:

/home/root
build/test:.

该文件对 "Files to deploy" 列表没有影响,即使在重新启动后也是如此。无论如何,这似乎表明此方法适用于 CMake。但是,我什至没有在 Build&运行 > Kits 中明确关闭 CMake 构建,所以我什至不知道如何开始使用 CMake 构建它(并且文档页面没有任何见解:https://doc.qt.io/qtcreator/creator-project-cmake.html).我在构建设置页面上所做的一件事是在 "Build Steps" 中执行 "Custom Process Step" 而不是通常的 Make 步骤。

如何将文件添加到 "Files to deploy" 列表?

QtCreator 4.9 现在支持为通用(非 CMake)项目指定 QtCreatorDeployment.txt 文件以实现此目的。

https://doc.qt.io/qtcreator/creator-deployment-embedded-linux.html#deploying-cmake-projects-to-embedded-linux-devices

https://blog.qt.io/blog/2019/02/21/qt-creator-4-9-beta-released/