forked from qt-creator/qt-creator
Add the support for target-based android-build directories
When building using CMake it's possible that single CMakeLists.txt may contain multiple android executables. In this case android-build directory mixes the build artifacts from multiple targets. This patch allows using per-target android-build directories in case if Qt support this. The QT_INTERNAL_ANDROID_TARGET_BUILD_DIR_SUPPORT cache variable indicates that Qt has builtin support of this feature and the QT_USE_TARGET_ANDROID_BUILD_DIR cache variable should be set to TRUE by user to enable the functionality project-wide. Task-number: QTBUG-117443 Change-Id: Ic8f576e528ee918a3ebf075a25fa2a414ef85736 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
@@ -57,6 +57,9 @@ const char AndroidTargets[] = "AndroidTargets"; // QStringList
|
||||
const char AndroidApplicationArgs[] = "AndroidApplicationArgs"; // QString
|
||||
const char AndroidClassPaths[] = "AndroidClassPath"; // QStringList
|
||||
|
||||
const char AndroidBuildTargetDirSupport[] = "AndroidBuildTargetDirSupport"; // bool
|
||||
const char UseAndroidBuildTargetDir[] = "UseAndroidBuildTargetDir"; // bool
|
||||
|
||||
// For qbs support
|
||||
const char AndroidApk[] = "Android.APK"; // QStringList
|
||||
const char AndroidManifest[] = "Android.Manifest"; // QStringList
|
||||
|
||||
@@ -221,7 +221,13 @@ bool isQtCreatorGenerated(const FilePath &deploymentFile)
|
||||
|
||||
FilePath androidBuildDirectory(const Target *target)
|
||||
{
|
||||
return buildDirectory(target) / Constants::ANDROID_BUILD_DIRECTORY;
|
||||
QString suffix;
|
||||
const Project *project = target->project();
|
||||
if (project->extraData(Android::Constants::AndroidBuildTargetDirSupport).toBool()
|
||||
&& project->extraData(Android::Constants::UseAndroidBuildTargetDir).toBool())
|
||||
suffix = QString("-%1").arg(target->activeBuildKey());
|
||||
|
||||
return buildDirectory(target) / (Constants::ANDROID_BUILD_DIRECTORY + suffix);
|
||||
}
|
||||
|
||||
FilePath androidAppProcessDir(const Target *target)
|
||||
|
||||
@@ -1183,6 +1183,21 @@ void CMakeBuildSystem::updateCMakeConfiguration(QString &errorMessage)
|
||||
cmakeConfig.append(ci);
|
||||
}
|
||||
}
|
||||
|
||||
const bool hasAndroidTargetBuildDirSupport
|
||||
= CMakeConfigItem::toBool(
|
||||
cmakeConfig.stringValueOf("QT_INTERNAL_ANDROID_TARGET_BUILD_DIR_SUPPORT"))
|
||||
.value_or(false);
|
||||
|
||||
const bool useAndroidTargetBuildDir
|
||||
= CMakeConfigItem::toBool(cmakeConfig.stringValueOf("QT_USE_TARGET_ANDROID_BUILD_DIR"))
|
||||
.value_or(false);
|
||||
|
||||
project()->setExtraData(Android::Constants::AndroidBuildTargetDirSupport,
|
||||
QVariant::fromValue(hasAndroidTargetBuildDirSupport));
|
||||
project()->setExtraData(Android::Constants::UseAndroidBuildTargetDir,
|
||||
QVariant::fromValue(useAndroidTargetBuildDir));
|
||||
|
||||
setConfigurationFromCMake(cmakeConfig);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user