From 5811eeedfa588794cc408de482ffcc6cf0ded0e2 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Mon, 21 Jul 2014 02:28:34 -0400 Subject: [PATCH] Qbs: Un-break support for Itanium and PowerPC. Appending _64 to the arch name for 64-bit ABIs is insufficient, and this is now properly handled for all architectures currently recognized by Qbs, and hopefully future-proofed as well. Change-Id: I56fcfdcfd065ed5231fed3a817a55b9af9c82fc9 Reviewed-by: Christian Kandeler --- .../defaultpropertyprovider.cpp | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp b/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp index 884e3b50952..159e3649590 100644 --- a/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp +++ b/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp @@ -37,6 +37,8 @@ #include #include +#include + #include namespace QbsProjectManager { @@ -65,10 +67,29 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c if (tc) { // FIXME/CLARIFY: How to pass the sysroot? ProjectExplorer::Abi targetAbi = tc->targetAbi(); - QString architecture = ProjectExplorer::Abi::toString(targetAbi.architecture()); - if (targetAbi.wordWidth() == 64) - architecture.append(QLatin1String("_64")); - data.insert(QLatin1String(QBS_ARCHITECTURE), architecture); + if (targetAbi.architecture() != ProjectExplorer::Abi::UnknownArchitecture) { + QString architecture = ProjectExplorer::Abi::toString(targetAbi.architecture()); + + // We have to be conservative tacking on suffixes to arch names because an arch that is + // already 64-bit may get an incorrect name as a result (i.e. Itanium) + if (targetAbi.wordWidth() == 64) { + switch (targetAbi.architecture()) { + case ProjectExplorer::Abi::X86Architecture: + architecture.append(QLatin1String("_")); + // fall through + case ProjectExplorer::Abi::ArmArchitecture: + case ProjectExplorer::Abi::MipsArchitecture: + case ProjectExplorer::Abi::PowerPCArchitecture: + architecture.append(QString::number(targetAbi.wordWidth())); + break; + default: + break; + } + } + + data.insert(QLatin1String(QBS_ARCHITECTURE), + qbs::Internal::HostOsInfo::canonicalArchitecture(architecture)); + } if (targetAbi.endianness() == ProjectExplorer::Abi::BigEndian) data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("big"));