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:
@@ -110,11 +110,6 @@ const QLatin1String X86ToolsPrefix("i686-linux-android");
|
||||
const QLatin1String AArch64ToolsPrefix("aarch64-linux-android");
|
||||
const QLatin1String X86_64ToolsPrefix("x86_64-linux-android");
|
||||
|
||||
const QLatin1String ArmToolsDisplayName("arm");
|
||||
const QLatin1String X86ToolsDisplayName("i686");
|
||||
const QLatin1String AArch64ToolsDisplayName("aarch64");
|
||||
const QLatin1String X86_64ToolsDisplayName("x86_64");
|
||||
|
||||
const QLatin1String Unknown("unknown");
|
||||
const QLatin1String keytoolName("keytool");
|
||||
const QLatin1String changeTimeStamp("ChangeTimeStamp");
|
||||
@@ -174,12 +169,12 @@ QLatin1String AndroidConfig::displayName(const Abi &abi)
|
||||
switch (abi.architecture()) {
|
||||
case Abi::ArmArchitecture:
|
||||
if (abi.wordWidth() == 64)
|
||||
return AArch64ToolsDisplayName;
|
||||
return ArmToolsDisplayName;
|
||||
return QLatin1String(Constants::AArch64ToolsDisplayName);
|
||||
return QLatin1String(Constants::ArmToolsDisplayName);
|
||||
case Abi::X86Architecture:
|
||||
if (abi.wordWidth() == 64)
|
||||
return X86_64ToolsDisplayName;
|
||||
return X86ToolsDisplayName;
|
||||
return QLatin1String(Constants::X86_64ToolsDisplayName);
|
||||
return QLatin1String(Constants::X86ToolsDisplayName);
|
||||
default:
|
||||
return Unknown;
|
||||
}
|
||||
|
@@ -76,4 +76,11 @@ const Utils::Id AndroidAvdPath = "AndroidAvdPath";
|
||||
const char cmdlineToolsName[] = "cmdline-tools";
|
||||
const char ndkPackageName[] = "ndk";
|
||||
|
||||
// For AndroidQtVersion
|
||||
const char ArmToolsDisplayName[] = "arm";
|
||||
const char ArmV7ToolsDisplayName[] = "armv7";
|
||||
const char X86ToolsDisplayName[] = "i686";
|
||||
const char AArch64ToolsDisplayName[] = "aarch64";
|
||||
const char X86_64ToolsDisplayName[] = "x86_64";
|
||||
|
||||
} // Android::Constants
|
||||
|
@@ -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)
|
||||
|
@@ -37,6 +37,7 @@ public:
|
||||
struct BuiltWith {
|
||||
int apiVersion = -1;
|
||||
QVersionNumber ndkVersion;
|
||||
QString androidAbi;
|
||||
};
|
||||
static BuiltWith parseBuiltWith(const QByteArray &modulesCoreJsonData, bool *ok = nullptr);
|
||||
BuiltWith builtWith(bool *ok = nullptr) const;
|
||||
|
Reference in New Issue
Block a user