Pra*_*ady 2 qt openembedded bitbake yocto
我设置了yocto开发环境,在其中我可以在目标中进行 bitbake 并运行一个简单的 C++ 应用程序。现在我想尝试使用简单的 Qt 应用程序。当我执行bitbake-layers show-layers时,它在列表中显示 meta-qt5...
meta-qt5
/home/prc1cob/repo/out/salt/kawa/../../..//os/external/meta-qt5 7 元-oe
/home/prc1cob/repo/out/salt/kawa/ ../../../build/yocto/meta-openembedded/meta-oe 6
有了这个,我假设 qt5 已经存在于我的 yocto 构建中。如何编写 .bb 文件来构建一个简单的 HelloWorld qt 应用程序,如下所示...
#include <QCoreApplication>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
qDebug() << "Hello World";
return a.exec();
}Run Code Online (Sandbox Code Playgroud)
谢谢你!!
Yocto 提供了一个很棒的类qmake5来编译基于 QMake 的 QT 项目。
为了使用它,.pro为项目创建一个文件:
qtexample.pro
\nQT += core\nSOURCES += qtexample.cpp\nRun Code Online (Sandbox Code Playgroud)\nqtexample.cpp
\n#include <QCoreApplication>\n#include <QDebug>\nint main(int argc, char *argv[])\n{\n QCoreApplication a(argc, argv);\n \n qDebug() << "Hello World";\n\n return a.exec();\n}\nRun Code Online (Sandbox Code Playgroud)\n现在,在您的层中,您可以添加一个编译该项目的简单配方。
\n例如:meta-custom/recipes-project/qtexample
在qtexample文件夹中创建files文件夹并复制qtexample.pro到qtexample.cpp其中。
在qtexample文件夹中直接创建qtexample_0.1.bb菜谱:
SUMMARY = "QT Example Recipe"\nLICENSE = "CLOSED"\n\nSRC_URI = "file://qtexample.pro \\\n file://qtexample.cpp"\n\nDEPENDS += "qtbase"\nRDEPENDS_${PN} += "qtwayland"\n\nS = "${WORKDIR}"\n\ninherit qmake5\nRun Code Online (Sandbox Code Playgroud)\n当然,您可以更改版本(0.1)。
\n布局应该如下所示:
\nmeta-custom/\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 recipes-project/\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 qtexample_0.1.bb\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 files/\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 qtexample.pro\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 qtexample.cpp\nRun Code Online (Sandbox Code Playgroud)\n然后,bitbake qtexample应该工作并创建一个qtexample您可以在其中找到的二进制文件${WORKDIR}