forked from qt-creator/qt-creator
CMake: Use local path names in android build parameters
This is directly passed to cmake and used in the context of the build device. Change-Id: If22764b0d962f96b51897b754b413c2310818c33 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -815,7 +815,7 @@ static QStringList defaultInitialCMakeArguments(const Kit *k, const QString buil
|
|||||||
|
|
||||||
// Cross-compilation settings:
|
// Cross-compilation settings:
|
||||||
if (!isIos(k)) { // iOS handles this differently
|
if (!isIos(k)) { // iOS handles this differently
|
||||||
const QString sysRoot = SysRootKitAspect::sysRoot(k).toString();
|
const QString sysRoot = SysRootKitAspect::sysRoot(k).path();
|
||||||
if (!sysRoot.isEmpty()) {
|
if (!sysRoot.isEmpty()) {
|
||||||
initialArgs.append(QString::fromLatin1("-DCMAKE_SYSROOT:PATH=%1").arg(sysRoot));
|
initialArgs.append(QString::fromLatin1("-DCMAKE_SYSROOT:PATH=%1").arg(sysRoot));
|
||||||
if (ToolChain *tc = ToolChainKitAspect::cxxToolChain(k)) {
|
if (ToolChain *tc = ToolChainKitAspect::cxxToolChain(k)) {
|
||||||
@@ -901,17 +901,13 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
|||||||
if (DeviceTypeKitAspect::deviceTypeId(k) == Android::Constants::ANDROID_DEVICE_TYPE) {
|
if (DeviceTypeKitAspect::deviceTypeId(k) == Android::Constants::ANDROID_DEVICE_TYPE) {
|
||||||
buildSteps()->appendStep(Android::Constants::ANDROID_BUILD_APK_ID);
|
buildSteps()->appendStep(Android::Constants::ANDROID_BUILD_APK_ID);
|
||||||
const auto &bs = buildSteps()->steps().constLast();
|
const auto &bs = buildSteps()->steps().constLast();
|
||||||
initialArgs.append(
|
initialArgs.append("-DANDROID_NATIVE_API_LEVEL:STRING="
|
||||||
QString::fromLatin1("-DANDROID_NATIVE_API_LEVEL:STRING=%1")
|
+ bs->data(Android::Constants::AndroidNdkPlatform).toString());
|
||||||
.arg(bs->data(Android::Constants::AndroidNdkPlatform).toString()));
|
|
||||||
auto ndkLocation = bs->data(Android::Constants::NdkLocation).value<FilePath>();
|
auto ndkLocation = bs->data(Android::Constants::NdkLocation).value<FilePath>();
|
||||||
initialArgs.append(
|
initialArgs.append("-DANDROID_NDK:PATH=" + ndkLocation.path());
|
||||||
QString::fromLatin1("-DANDROID_NDK:PATH=%1").arg(ndkLocation.toString()));
|
|
||||||
|
|
||||||
initialArgs.append(
|
initialArgs.append("-DCMAKE_TOOLCHAIN_FILE:PATH="
|
||||||
QString::fromLatin1("-DCMAKE_TOOLCHAIN_FILE:PATH=%1")
|
+ ndkLocation.pathAppended("build/cmake/android.toolchain.cmake").path());
|
||||||
.arg(
|
|
||||||
ndkLocation.pathAppended("build/cmake/android.toolchain.cmake").toString()));
|
|
||||||
|
|
||||||
auto androidAbis = bs->data(Android::Constants::AndroidABIs).toStringList();
|
auto androidAbis = bs->data(Android::Constants::AndroidABIs).toStringList();
|
||||||
QString preferredAbi;
|
QString preferredAbi;
|
||||||
@@ -923,23 +919,18 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
|||||||
} else {
|
} else {
|
||||||
preferredAbi = androidAbis.first();
|
preferredAbi = androidAbis.first();
|
||||||
}
|
}
|
||||||
initialArgs.append(QString::fromLatin1("-DANDROID_ABI:STRING=%1").arg(preferredAbi));
|
initialArgs.append("-DANDROID_ABI:STRING=" + preferredAbi);
|
||||||
|
initialArgs.append("-DANDROID_STL:STRING=c++_shared");
|
||||||
initialArgs.append(QString::fromLatin1("-DANDROID_STL:STRING=c++_shared"));
|
initialArgs.append("-DCMAKE_FIND_ROOT_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}");
|
||||||
|
|
||||||
initialArgs.append(
|
|
||||||
QString::fromLatin1("-DCMAKE_FIND_ROOT_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}"));
|
|
||||||
|
|
||||||
QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k);
|
QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k);
|
||||||
auto sdkLocation = bs->data(Android::Constants::SdkLocation).value<FilePath>();
|
auto sdkLocation = bs->data(Android::Constants::SdkLocation).value<FilePath>();
|
||||||
|
|
||||||
if (qt->qtVersion() >= QtSupport::QtVersionNumber{6, 0, 0}) {
|
if (qt->qtVersion() >= QtSupport::QtVersionNumber{6, 0, 0}) {
|
||||||
initialArgs.append(
|
initialArgs.append("-DQT_HOST_PATH:PATH=%{Qt:QT_HOST_PREFIX}");
|
||||||
QString::fromLatin1("-DQT_HOST_PATH:PATH=%{Qt:QT_HOST_PREFIX}"));
|
initialArgs.append("-DANDROID_SDK_ROOT:PATH=" + sdkLocation.path());
|
||||||
|
|
||||||
initialArgs.append(QString("-DANDROID_SDK_ROOT:PATH=%1").arg(sdkLocation.toString()));
|
|
||||||
} else {
|
} else {
|
||||||
initialArgs.append(QString("-DANDROID_SDK:PATH=%1").arg(sdkLocation.toString()));
|
initialArgs.append("-DANDROID_SDK:PATH=" + sdkLocation.path());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user