Skip to content

Commit 570ca2d

Browse files
tcladetTristan Cladetprobonopd
authored
Add -qtlibinfix support in order to precise the libinfix set for a custom Qt distribution. Without this option, linuxdeployqt is not able to look at the Qt plugins directory. (#463)
* Add -qtlibinfix support in order to precise the libinfix set for a custom Qt distribution. Without this option, linuxdeployqt is not able to look at the Qt plugins directory. * Add dedicated qtlibinfix section in documentation. * Missing lib prefix for the -qtlibinfix example in documentation. * Update README.md Co-authored-by: Tristan Cladet <tristan.cladet@siemens.com> Co-authored-by: probonopd <probonopd@users.noreply.github.com>
1 parent b469748 commit 570ca2d

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ Usage examples:
155155
2. `-extra-plugins=sqldrivers,iconengines/libqsvgicon.so`
156156
3. `-extra-plugins=sqldrivers,iconengines,mediaservice,gamepads`
157157

158+
#### Handle Qt libraries infix
159+
160+
If you prepared a custom Qt distribution using the option `-qtlibinfix` during Qt configuration (resulting in library names such as `libQt5CoreCustom.so`), you must mention this infix on `linuxdeployqt` call. As an example, let's see if we configure our distribution using the infix `Custom`.
161+
162+
On Qt build chain: `configure -qtlibinfix "Custom" [...]`. This will generate Qt libraries (.so) like `libQt5CoreCustom.so`
163+
164+
So, on `linuxdeployqt` call: `linuxdeployqt [...] -qtlibinfix "Custom" [...]`.
165+
166+
If you don't mention this infix, `linuxdeployqt` won't be able to detect Qt Core and Widgets libraries.
167+
158168
## Using linuxdeployqt with Travis CI
159169

160170
A common use case for `linuxdeployqt` is to use it on Travis CI after the `make` command. The following example illustrates how to use `linuxdeployqt` with Travis CI. Create a `.travis.yml` file similar to this one (be sure to customize it, e.g., change `APPNAME` to the name of your application as it is spelled in the `Name=` entry of the `.desktop` file):

tools/linuxdeployqt/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ int main(int argc, char **argv)
7474
extern QStringList ignoreGlob;
7575
extern bool copyCopyrightFiles;
7676
extern QString updateInformation;
77+
extern QString qtLibInfix;
7778

7879
// Check arguments
7980
// Due to the structure of the argument parser, we have to check all arguments at first to check whether the user
@@ -173,6 +174,10 @@ int main(int argc, char **argv)
173174
LogDebug() << "Argument found:" << argument;
174175
int index = argument.indexOf("=");
175176
updateInformation = QString(argument.mid(index+1));
177+
} else if (argument.startsWith("-qtlibinfix=")) {
178+
LogDebug() << "Argument found:" << argument;
179+
int index = argument.indexOf("=");
180+
qtLibInfix = QString(argument.mid(index+1));
176181
} else if (argument.startsWith("--")) {
177182
LogError() << "Error: arguments must not start with --, only -:" << argument << "\n";
178183
return 1;
@@ -233,6 +238,7 @@ int main(int argc, char **argv)
233238
qInfo() << " -verbose=<0-3> : 0 = no output, 1 = error/warning (default),";
234239
qInfo() << " 2 = normal, 3 = debug.";
235240
qInfo() << " -updateinformation=<update string> : Embed update information STRING; if zsyncmake is installed, generate zsync file";
241+
qInfo() << " -qtlibinfix=<infix> : Adapt the .so search if your Qt distribution has infix.";
236242
qInfo() << " -version : Print version statement and exit.";
237243
qInfo() << "";
238244
qInfo() << "linuxdeployqt takes an application as input and makes it";

tools/linuxdeployqt/shared.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ QStringList excludeLibs;
6464
QStringList ignoreGlob;
6565
bool copyCopyrightFiles = true;
6666
QString updateInformation;
67+
QString qtLibInfix;
6768

6869
using std::cout;
6970
using std::endl;
@@ -1010,12 +1011,12 @@ DeploymentInfo deployQtLibraries(QList<LibraryInfo> libraries,
10101011
const LibraryInfo library = libraries.takeFirst();
10111012
copiedLibraries.append(library.libraryName);
10121013

1013-
if(library.libraryName.contains("libQt") and library.libraryName.contains("Core.so")) {
1014+
if(library.libraryName.contains("libQt") and library.libraryName.contains("Core" + qtLibInfix + ".so")) {
10141015
LogNormal() << "Setting deploymentInfo.qtPath to:" << library.libraryDirectory;
10151016
deploymentInfo.qtPath = library.libraryDirectory;
10161017
}
10171018

1018-
if(library.libraryName.contains("libQt") and library.libraryName.contains("Widgets.so")) {
1019+
if(library.libraryName.contains("libQt") and library.libraryName.contains("Widgets" + qtLibInfix + ".so")) {
10191020
deploymentInfo.requiresQtWidgetsLibrary = true;
10201021
}
10211022

0 commit comments

Comments
 (0)