From 570ca2dcb16f59ce0a2721f780093db8037cc9e0 Mon Sep 17 00:00:00 2001 From: Tristan Cladet Date: Sat, 28 Aug 2021 22:16:28 +0200 Subject: [PATCH] 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 Co-authored-by: probonopd --- README.md | 10 ++++++++++ tools/linuxdeployqt/main.cpp | 6 ++++++ tools/linuxdeployqt/shared.cpp | 5 +++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a3a1961..8a7e7bc 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,16 @@ Usage examples: 2. `-extra-plugins=sqldrivers,iconengines/libqsvgicon.so` 3. `-extra-plugins=sqldrivers,iconengines,mediaservice,gamepads` +#### Handle Qt libraries infix + +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`. + +On Qt build chain: `configure -qtlibinfix "Custom" [...]`. This will generate Qt libraries (.so) like `libQt5CoreCustom.so` + +So, on `linuxdeployqt` call: `linuxdeployqt [...] -qtlibinfix "Custom" [...]`. + +If you don't mention this infix, `linuxdeployqt` won't be able to detect Qt Core and Widgets libraries. + ## Using linuxdeployqt with Travis CI 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): diff --git a/tools/linuxdeployqt/main.cpp b/tools/linuxdeployqt/main.cpp index d7d5f82..338a0e2 100644 --- a/tools/linuxdeployqt/main.cpp +++ b/tools/linuxdeployqt/main.cpp @@ -74,6 +74,7 @@ int main(int argc, char **argv) extern QStringList ignoreGlob; extern bool copyCopyrightFiles; extern QString updateInformation; + extern QString qtLibInfix; // Check arguments // 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) LogDebug() << "Argument found:" << argument; int index = argument.indexOf("="); updateInformation = QString(argument.mid(index+1)); + } else if (argument.startsWith("-qtlibinfix=")) { + LogDebug() << "Argument found:" << argument; + int index = argument.indexOf("="); + qtLibInfix = QString(argument.mid(index+1)); } else if (argument.startsWith("--")) { LogError() << "Error: arguments must not start with --, only -:" << argument << "\n"; return 1; @@ -233,6 +238,7 @@ int main(int argc, char **argv) qInfo() << " -verbose=<0-3> : 0 = no output, 1 = error/warning (default),"; qInfo() << " 2 = normal, 3 = debug."; qInfo() << " -updateinformation= : Embed update information STRING; if zsyncmake is installed, generate zsync file"; + qInfo() << " -qtlibinfix= : Adapt the .so search if your Qt distribution has infix."; qInfo() << " -version : Print version statement and exit."; qInfo() << ""; qInfo() << "linuxdeployqt takes an application as input and makes it"; diff --git a/tools/linuxdeployqt/shared.cpp b/tools/linuxdeployqt/shared.cpp index 1cff203..03f299e 100644 --- a/tools/linuxdeployqt/shared.cpp +++ b/tools/linuxdeployqt/shared.cpp @@ -64,6 +64,7 @@ QStringList excludeLibs; QStringList ignoreGlob; bool copyCopyrightFiles = true; QString updateInformation; +QString qtLibInfix; using std::cout; using std::endl; @@ -1010,12 +1011,12 @@ DeploymentInfo deployQtLibraries(QList libraries, const LibraryInfo library = libraries.takeFirst(); copiedLibraries.append(library.libraryName); - if(library.libraryName.contains("libQt") and library.libraryName.contains("Core.so")) { + if(library.libraryName.contains("libQt") and library.libraryName.contains("Core" + qtLibInfix + ".so")) { LogNormal() << "Setting deploymentInfo.qtPath to:" << library.libraryDirectory; deploymentInfo.qtPath = library.libraryDirectory; } - if(library.libraryName.contains("libQt") and library.libraryName.contains("Widgets.so")) { + if(library.libraryName.contains("libQt") and library.libraryName.contains("Widgets" + qtLibInfix + ".so")) { deploymentInfo.requiresQtWidgetsLibrary = true; }