Search code examples
qtyocto

How to add and compile my QT application in Yocto image (which contains QT-5 layer.)?


I am trying to add a qt widgets application/project to my yocto image and compile it through it. I know that I have to add a custom layer and make a recipe which has reference to the files of the qt application. I have also inherited qmake5 and inserted DEPENDS += "qtbase", but I am confused about which files to refer through SRC_UI in my recipe. The QT application file is a bare bone project called "hi" which contains no additional code and pops up a plain helloworld window. The project file contains following files:

    main.cpp 
    hi.pro 
    hi.pro.user
    mainwindow.cpp 
    mainwindow.h 
    ui_mainwindow.h

A reference recipe using above mentioned files would be really helpful.Thanks.


Solution

  • I have an old response about QT recipes in Yocto.

    Check: how to build simple qt application using yocto?

    It contains a reference hello world recipe.

    You just need to copy your files into recipes' folder and specify all files in SRC_URI or:

    If your project is collected under one folder hi:

    Place hi under: qtexample/files and specify it in the recipe:

    SRC_URI = "file://hi"
    S = "${WORKDIR}/hi"
    

    EDIT:

    Do not forget to mention the files to package:

    FILES_${PN} = "/opt/*"
    

    EDIT2:

    If your recipe depends on a library or set of tools at run time, check what recipes are providing those libraries and add in your recipe:

    RDEPENDS_${PN} += "recipe"
    

    where recipe is what providing your runtime dependency.