qmake subdir deploy internal library
-
Hello guys,
I have a subdir project and have a kit to a remote linux device. I have set it up to build the application(s), deploy, and run on the remote device.
In the applications I added internal libraries from the top level project and set up the dependency in the pro file as well. Basically to run the executable I also need the library files to be deployed as well, but I can only get it to deploy the executable, not the library files.
My question is what do I need to write and in which .pro file I need to write it in (or anyhting else required) to get it to also deploy the .so files as well. Below is an example .pro for the subdir, application, and lib.
TEMPLATE = subdirs SUBDIRS += \ class1/class1.pro \ class2/class2.pro \ app/app.pro app.depends = class1 class2 CONFIG += orderedQT -= gui QT += serialbus CONFIG += c++14 console CONFIG -= app_bundle TEMPLATE = lib DEFINES += CLASS1_LIBRARY target.path = /usr/lib INSTALLS += target # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ class1.cpp \ HEADERS += \ $$PWD/class1.h \ class1_global.h # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += targetQT -= gui QT += network CONFIG += c++14 console CONFIG -= app_bundle # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ server.cpp target.path = /usr/bin INSTALLS += target HEADERS += \ server.h CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT unix:!macx: LIBS += -L$$OUT_PWD/../../class1/ -lclass1 INCLUDEPATH += $$PWD/../../class1 DEPENDPATH += $$PWD/../../class1 unix:!macx: LIBS += -L$$OUT_PWD/../../class2/ -lclass2 INCLUDEPATH += $$PWD/../../class2 DEPENDPATH += $$PWD/../../class2I greatly simplified my .pro files /project structure but it should illustrate what I have and what I am trying to do. I believe the solution lies with doing something right with the target.path in the library .pro file or something similar but I am unsure.
Thank you!
-
@ChrisW67 Was a typo, I just tried to simplify for example here and made that mistake. In reality I have a lot of libs and apps.
I did figure it out however here is the solution that needs to be put in the .pro files for the libraries.
libraryFiles.path = /usr/lib CONFIG(debug, debug|release):libraryFiles.files = $$OUT_PWD/library.so $$OUT_PWD/library.so.1 $$OUT_PWD/library.so.1.0 $$OUT_PWD/library.so.1.0.0 CONFIG(release, debug|release):libraryFiles.files = $$OUT_PWD/library.so $$OUT_PWD/library.so.1 $$OUT_PWD/libmooscommsbase.so.1.0 $$OUT_PWD/library.so.1.0.0 INSTALLS += libraryFilesBasically now when I build/run any app, in the deployment step it will also make sure I have the library file in the target device's /usr/lib folder for the libraries that the application depends on. This way the application can find the shared library when it gets executed on the target device.
-
You do not seem to reference lib1.pro anywhere; only app.pro, class1.pro, and class2.pro
-
@ChrisW67 Was a typo, I just tried to simplify for example here and made that mistake. In reality I have a lot of libs and apps.
I did figure it out however here is the solution that needs to be put in the .pro files for the libraries.
libraryFiles.path = /usr/lib CONFIG(debug, debug|release):libraryFiles.files = $$OUT_PWD/library.so $$OUT_PWD/library.so.1 $$OUT_PWD/library.so.1.0 $$OUT_PWD/library.so.1.0.0 CONFIG(release, debug|release):libraryFiles.files = $$OUT_PWD/library.so $$OUT_PWD/library.so.1 $$OUT_PWD/libmooscommsbase.so.1.0 $$OUT_PWD/library.so.1.0.0 INSTALLS += libraryFilesBasically now when I build/run any app, in the deployment step it will also make sure I have the library file in the target device's /usr/lib folder for the libraries that the application depends on. This way the application can find the shared library when it gets executed on the target device.