summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2017-08-16 15:25:53 +0300
committerSérgio Martins <sergio.martins@kdab.com>2017-08-23 10:57:28 +0000
commit28b1b88a0b85f4ce7765ed5cc5f3780f97e5ea4f (patch)
tree5dd3e999d33bde1248f7e54bcbf96f668522f55e
parentfdc5749b5603653c5d0c59db267f44fd1609457e (diff)
downloadqttools-28b1b88a0b85f4ce7765ed5cc5f3780f97e5ea4f.tar.gz
Android: copy the specified stdc++ library
It is needed to handle android-clang Qt builds Change-Id: Ie52e0faf6d971d4ada4d8fd9a3f1529f1145995c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r--src/androiddeployqt/main.cpp41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/androiddeployqt/main.cpp b/src/androiddeployqt/main.cpp
index 51b514f51..918bc0f6c 100644
--- a/src/androiddeployqt/main.cpp
+++ b/src/androiddeployqt/main.cpp
@@ -152,6 +152,10 @@ struct Options
QString rootPath;
QStringList qmlImportPaths;
+ // lib c++ path
+ QString stdCppPath;
+ QString stdCppName = QStringLiteral("gnustl_shared");
+
// Build information
QString androidPlatform;
QString architecture;
@@ -868,6 +872,19 @@ bool readInputFile(Options *options)
}
{
+ const QJsonValue stdcppPath = jsonObject.value(QStringLiteral("stdcpp-path"));
+ if (!stdcppPath.isUndefined()) {
+ options->stdCppPath = stdcppPath.toString();
+ auto name = QFileInfo(options->stdCppPath).baseName();
+ if (!name.startsWith(QLatin1String("lib"))) {
+ fprintf(stderr, "Invalid STD C++ library name.\n");
+ return false;
+ }
+ options->stdCppName = name.mid(3);
+ }
+ }
+
+ {
const QJsonValue qmlRootPath = jsonObject.value(QStringLiteral("qml-root-path"));
if (!qmlRootPath.isUndefined())
options->rootPath = qmlRootPath.toString();
@@ -1133,7 +1150,7 @@ bool updateLibsXml(const Options &options)
QString libsPath = QLatin1String("libs/") + options.architecture + QLatin1Char('/');
- QString qtLibs = QLatin1String("<item>gnustl_shared</item>\n");
+ QString qtLibs = QLatin1String("<item>") + options.stdCppName + QLatin1String("</item>\n");
QString bundledInLibs;
QString bundledInAssets;
for (const Options::BundledFile &bundledFile : options.bundledFiles) {
@@ -2517,22 +2534,23 @@ bool installApk(const Options &options)
return true;
}
-bool copyGnuStl(Options *options)
+bool copyStdCpp(Options *options)
{
if (options->deploymentMechanism == Options::Debug && !options->installApk)
return true;
if (options->verbose)
- fprintf(stdout, "Copying GNU STL library\n");
+ fprintf(stdout, "Copying STL library\n");
- QString filePath = options->ndkPath
+ QString filePath = !options->stdCppPath.isEmpty() ? options->stdCppPath
+ : options->ndkPath
+ QLatin1String("/sources/cxx-stl/gnu-libstdc++/")
+ options->toolchainVersion
+ QLatin1String("/libs/")
+ options->architecture
+ QLatin1String("/libgnustl_shared.so");
if (!QFile::exists(filePath)) {
- fprintf(stderr, "GNU STL library does not exist at %s\n", qPrintable(filePath));
+ fprintf(stderr, "STL library does not exist at %s\n", qPrintable(filePath));
return false;
}
@@ -2541,13 +2559,18 @@ bool copyGnuStl(Options *options)
? options->temporaryDirectoryName + QLatin1String("/lib")
: options->outputDirectory + QLatin1String("/libs/") + options->architecture;
- if (!copyFileIfNewer(filePath, destinationDirectory
- + QLatin1String("/libgnustl_shared.so"), options->verbose)) {
+ if (!copyFileIfNewer(filePath, destinationDirectory + QLatin1String("/lib")
+ + options->stdCppName + QLatin1String(".so"),
+ options->verbose)) {
return false;
}
- if (options->deploymentMechanism == Options::Debug && !deployToLocalTmp(options, QLatin1String("/lib/libgnustl_shared.so")))
+ if (options->deploymentMechanism == Options::Debug
+ && !deployToLocalTmp(options, QLatin1String("/lib/lib")
+ + options->stdCppName
+ + QLatin1String(".so"))) {
return false;
+ }
return true;
}
@@ -2982,7 +3005,7 @@ int main(int argc, char *argv[])
if (Q_UNLIKELY(options.timing))
fprintf(stdout, "[TIMING] %d ms: Read dependencies\n", options.timer.elapsed());
- if (options.deploymentMechanism != Options::Ministro && !copyGnuStl(&options))
+ if (options.deploymentMechanism != Options::Ministro && !copyStdCpp(&options))
return CannotCopyGnuStl;
if (Q_UNLIKELY(options.timing))