forked from qt-creator/qt-creator
Android: Deploy libgnustl_shared.so directly from android-ndk
Task-number: QTCREATORBUG-8688 Change-Id: I890663c96d11a38275724b792eca0be782df673f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -121,6 +121,10 @@ bool AndroidDeployStep::init()
|
||||
return false;
|
||||
}
|
||||
m_ndkToolChainVersion = static_cast<AndroidToolChain *>(tc)->ndkToolChainVersion();
|
||||
|
||||
QString arch = static_cast<Qt4Project *>(project())->rootQt4ProjectNode()->singleVariableValue(Qt4ProjectManager::AndroidArchVar);
|
||||
if (!arch.isEmpty())
|
||||
m_libgnustl = AndroidManager::libGnuStl(arch, m_ndkToolChainVersion);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -402,6 +406,22 @@ bool AndroidDeployStep::deployPackage()
|
||||
remoteRoot + QLatin1String("/lib"),
|
||||
true,
|
||||
QStringList() << QLatin1String("*.so"));
|
||||
|
||||
// don't use the libgnustl_shared.so from the qt directory
|
||||
for (int i = 0; i < deployList.count(); ++i) {
|
||||
if (deployList.at(i).remoteFileName == QLatin1String("/data/local/tmp/qt/lib/libgnustl_shared.so")) {
|
||||
deployList.removeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// We want to deploy that *always*
|
||||
// since even if the timestamps did not change, the toolchain might have changed
|
||||
// leading to a different file
|
||||
deployList.append(DeployItem(m_libgnustl,
|
||||
QDateTime::currentDateTimeUtc().toTime_t(),
|
||||
QLatin1String("/data/local/tmp/qt/lib/libgnustl_shared.so"), false));
|
||||
|
||||
collectFiles(&deployList,
|
||||
m_qtVersionSourcePath + QLatin1String("/plugins"),
|
||||
remoteRoot + QLatin1String("/plugins"),
|
||||
|
||||
@@ -154,7 +154,7 @@ private:
|
||||
QString m_runQASIPackagePath;
|
||||
AndroidDeployAction m_runDeployAction;
|
||||
QString m_ndkToolChainVersion;
|
||||
|
||||
QString m_libgnustl;
|
||||
static const Core::Id Id;
|
||||
};
|
||||
|
||||
|
||||
@@ -585,7 +585,12 @@ QStringList AndroidManager::availableQtLibs(ProjectExplorer::Target *target)
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target->kit());
|
||||
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
|
||||
return QStringList();
|
||||
|
||||
Qt4ProjectManager::Qt4Project *project = static_cast<Qt4ProjectManager::Qt4Project *>(target->project());
|
||||
QString arch = project->rootQt4ProjectNode()->singleVariableValue(Qt4ProjectManager::AndroidArchVar);
|
||||
|
||||
AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
|
||||
QString libgnustl = libGnuStl(arch, atc->ndkToolChainVersion());
|
||||
|
||||
Utils::FileName readelfPath = AndroidConfigurations::instance().readelfPath(target->activeRunConfiguration()->abi().architecture(),
|
||||
atc->ndkToolChainVersion());
|
||||
@@ -613,6 +618,9 @@ QStringList AndroidManager::availableQtLibs(ProjectExplorer::Target *target)
|
||||
mapLibs[library].dependencies = dependencies(readelfPath, libPath.absolutePath());
|
||||
}
|
||||
|
||||
const QString library = libgnustl.mid(libgnustl.lastIndexOf(QLatin1Char('/')) + 1);
|
||||
mapLibs[library] = Library();;
|
||||
|
||||
// clean dependencies
|
||||
foreach (const QString &key, mapLibs.keys()) {
|
||||
int it = 0;
|
||||
@@ -950,5 +958,14 @@ bool AndroidManager::qtLibrariesLessThan(const Library &a, const Library &b)
|
||||
return a.level < b.level;
|
||||
}
|
||||
|
||||
QString AndroidManager::libGnuStl(const QString &arch, const QString &ndkToolChainVersion)
|
||||
{
|
||||
return AndroidConfigurations::instance().config().ndkLocation.toString()
|
||||
+ QLatin1String("/sources/cxx-stl/gnu-libstdc++/")
|
||||
+ ndkToolChainVersion + QLatin1String("/libs/")
|
||||
+ arch
|
||||
+ QLatin1String("/libgnustl_shared.so");
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
@@ -112,6 +112,8 @@ public:
|
||||
static QStringList prebundledLibs(ProjectExplorer::Target *target);
|
||||
static bool setPrebundledLibs(ProjectExplorer::Target *target, const QStringList &libs);
|
||||
|
||||
static QString libGnuStl(const QString &arch, const QString &ndkToolChainVersion);
|
||||
|
||||
private:
|
||||
static void raiseError(const QString &reason);
|
||||
static bool openXmlFile(QDomDocument &doc, const Utils::FileName &fileName);
|
||||
|
||||
Reference in New Issue
Block a user