3

I am using yocto build. I have .pro files and recipes(.bb) which build all cpp files present in .pro file. Recently I added two new cpp file i.e. gtest_main.cpp and lgeplugin_Test.cpp in .pro file. As show below

lgeplugin.pro

QMAKE_CXXFLAGS += -g
QMAKE_CFLAGS += -g
CFLAGS += \
           -Wall \
          -Wextra \
          -fPIC \
          -std=c++11



TARGET = lgeplugin
TEMPLATE = lib

message(Building)

INCLUDEPATH += ${Root}/include/ALL \
               ${Root}/include/gtest \

 DEFINES += USE_LGE_TREE
 SOURCES += ../../src/lgeplugin.cpp

 contains(DEFINES, LGE_PLUGIN) {
   
SOURCES     += \
                ../../src/internalclient.cpp \
                ../../src/Event.cpp \
                ../../src/gtest_main.cpp \
                ../../src/lgeplugin_Test.cpp
LIBS += -lLGEFramework -lgtest
    } 

lgeplugin.bb

QMAKE_PROFILES = "${S}/lgeplugin.pro"
do_install() {
        install -d ${D}/usr/lib
        cp -a ${B}/liblgeplugin.so* ${D}/usr/lib
}

Requirement : I need executable(a.out) of the newly added file i.e. gtest_main.cpp and lgeplugin_Test.cpp

Yakk - Adam Nevraumont
  • 262,606
  • 27
  • 330
  • 524
sonika
  • 31
  • 1
  • I'm fairly new to yocto; but we use it to build embedded Qt projects at my workplace. We use the meta-qt5 layer from openembedded: https://github.com/meta-qt5/meta-qt5. There's a `qmake5.bbclass` which you can inherit, and it will configure the build environment so that `qmake` can find Qt5, and then use it to build and install the target. Note, this has dependencies on Qt5, so using this layer will build Qt5 as part of your distro and it's a pretty hefty chunk of code to be compiling. – Ipiano Jun 29 '21 at 14:36

0 Answers0