qmake SUBDIRS and Qt libraries dependencies
-
Hi!
I have quite complex project divided on libraries.
In qmake file I'm using SUBDIRS template, more-less like this:SUBDIRS = src/lib1\ src/lib2\ src/main\In
mainthere are files for android build and I'm adding the libraries with the following statement:ANDROID_EXTRA_LIBS += $$OUT_PWD/lib1.so\ $$OUT_PWD/lib2.so\All works fine, Android apk is built correctly.
The problem occurs when some library, i.e.
lib1depends on Qt module thatmainapplication library doesn't.
Concretely, lib1 uses QtNetwork mod but main doesn't
In that case the application crashes during launch due to unable to load QtNetwork lib (even if I'm trying to add it withANDROID_EXTRA_LIBSand apk contains it).
My workaround for it is to add some dummy method inmain(never called) that uses something from QtNetwork mod. This way all works.So, is there any better way ?
-
Hi!
I have quite complex project divided on libraries.
In qmake file I'm using SUBDIRS template, more-less like this:SUBDIRS = src/lib1\ src/lib2\ src/main\In
mainthere are files for android build and I'm adding the libraries with the following statement:ANDROID_EXTRA_LIBS += $$OUT_PWD/lib1.so\ $$OUT_PWD/lib2.so\All works fine, Android apk is built correctly.
The problem occurs when some library, i.e.
lib1depends on Qt module thatmainapplication library doesn't.
Concretely, lib1 uses QtNetwork mod but main doesn't
In that case the application crashes during launch due to unable to load QtNetwork lib (even if I'm trying to add it withANDROID_EXTRA_LIBSand apk contains it).
My workaround for it is to add some dummy method inmain(never called) that uses something from QtNetwork mod. This way all works.So, is there any better way ?
-
@kshegunov
Thank You for the answer and sorry for my late response....SUBDIRS documentation was quite interesting but a solution is rather not there.
To properly load all dependencies during launching under Android, the apk has to have the list of them andandroiddeployqtis responsible for that.
I dig its doc and foundANDROID_DEPLOYMENT_DEPENDENCIESvariable which can overwrite the list of libs automatically detected byandroiddeployqtbut I have to take responsibility to put there all dependencies in proper order.
I will try so...Thanks