forked from qt-creator/qt-creator
Android: Speed up startup by using existing Qt6 Information
This will use the available information from modules/Core.json and determine the abi version from the "compiler_target" used to build Qt. This is only available with Qt6. Qt 6.4 and 6.5 have this information. Otherwise the "android-clang" qmake mkspec will be parsed and evalauted to get the Qt ABIs. Change-Id: Ia0c73f5c87983f44a156b54335dc8b36698c15b2 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -112,13 +112,24 @@ QString AndroidQtVersion::description() const
|
||||
|
||||
const QStringList &AndroidQtVersion::androidAbis() const
|
||||
{
|
||||
ensureMkSpecParsed();
|
||||
if (m_androidAbis.isEmpty()) {
|
||||
bool sanityCheckNotUsed;
|
||||
const BuiltWith bw = builtWith(&sanityCheckNotUsed);
|
||||
if (!bw.androidAbi.isEmpty()) {
|
||||
m_androidAbis << bw.androidAbi;
|
||||
m_minNdk = bw.apiVersion;
|
||||
} else {
|
||||
ensureMkSpecParsed();
|
||||
}
|
||||
}
|
||||
|
||||
return m_androidAbis;
|
||||
}
|
||||
|
||||
int AndroidQtVersion::minimumNDK() const
|
||||
{
|
||||
ensureMkSpecParsed();
|
||||
if (m_minNdk == -1)
|
||||
ensureMkSpecParsed();
|
||||
return m_minNdk;
|
||||
}
|
||||
|
||||
@@ -170,6 +181,25 @@ static int versionFromPlatformString(const QString &string, bool *ok = nullptr)
|
||||
return match.hasMatch() ? match.captured(1).toInt(ok) : -1;
|
||||
}
|
||||
|
||||
static QString abiFromCompilerTarget(const QString &string)
|
||||
{
|
||||
const QStringList components = string.split("-");
|
||||
if (components.isEmpty())
|
||||
return {};
|
||||
|
||||
QString qtAbi;
|
||||
const QString compilerAbi = components.first();
|
||||
if (compilerAbi == Constants::AArch64ToolsDisplayName)
|
||||
qtAbi = ProjectExplorer::Constants::ANDROID_ABI_ARM64_V8A;
|
||||
else if (compilerAbi == Constants::ArmV7ToolsDisplayName)
|
||||
qtAbi = ProjectExplorer::Constants::ANDROID_ABI_ARMEABI_V7A;
|
||||
else if (compilerAbi == Constants::X86_64ToolsDisplayName)
|
||||
qtAbi = ProjectExplorer::Constants::ANDROID_ABI_X86_64;
|
||||
else if (compilerAbi == Constants::X86ToolsDisplayName)
|
||||
qtAbi = ProjectExplorer::Constants::ANDROID_ABI_X86;
|
||||
return qtAbi;
|
||||
}
|
||||
|
||||
AndroidQtVersion::BuiltWith AndroidQtVersion::parseBuiltWith(const QByteArray &modulesCoreJsonData,
|
||||
bool *ok)
|
||||
{
|
||||
@@ -189,6 +219,10 @@ AndroidQtVersion::BuiltWith AndroidQtVersion::parseBuiltWith(const QByteArray &m
|
||||
result.ndkVersion = QVersionNumber::fromString(version.toString());
|
||||
}
|
||||
}
|
||||
if (const QJsonValue compilerTarget = builtWith["compiler_target"];
|
||||
!compilerTarget.isUndefined()) {
|
||||
result.androidAbi = abiFromCompilerTarget(compilerTarget.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (ok)
|
||||
|
||||
Reference in New Issue
Block a user