summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2018-01-23 12:00:45 +0100
committerTobias Hunger <tobias.hunger@qt.io>2018-01-24 14:51:32 +0000
commitd3bed44f5fe7a7edaa97734b621ef7d708249f17 (patch)
tree82dc7577c9773f2058cd440c5dbb4f97660886c7
parent5a18231e7e315cdefd92897c9e622155e4e4cf52 (diff)
downloadqt-creator-d3bed44f5fe7a7edaa97734b621ef7d708249f17.tar.gz
ProjectExplorer: Remove QTC_CPU override
QTC_CPU was broken in qmake and never worked there. Qbs never implemented the override properly, so neither did it work there. Use QSysInfo to retrieve information on CPU that Qt was built for and use that in the hostAbi. Change-Id: I298c15b2263c9eaf343a93037229de64e90c36ef Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r--src/plugins/projectexplorer/abi.cpp23
-rw-r--r--src/plugins/projectexplorer/projectexplorer.pro7
-rw-r--r--src/plugins/projectexplorer/projectexplorer.qbs2
3 files changed, 22 insertions, 10 deletions
diff --git a/src/plugins/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp
index 90a27134a5..a12e531859 100644
--- a/src/plugins/projectexplorer/abi.cpp
+++ b/src/plugins/projectexplorer/abi.cpp
@@ -50,6 +50,27 @@ namespace ProjectExplorer {
// Helpers
// --------------------------------------------------------------------------
+static Abi::Architecture architectureFromQt()
+{
+ const QString arch = QSysInfo::buildCpuArchitecture();
+ if (arch.startsWith("arm"))
+ return Abi::ArmArchitecture;
+ if (arch.startsWith("x86") || arch == "i386")
+ return Abi::X86Architecture;
+ if (arch == "ia64")
+ return Abi::ItaniumArchitecture;
+ if (arch.startsWith("mips"))
+ return Abi::MipsArchitecture;
+ if (arch.startsWith("power"))
+ return Abi::PowerPCArchitecture;
+ if (arch.startsWith("sh")) // Not in Qt documentation!
+ return Abi::ShArchitecture;
+ if (arch.startsWith("avr")) // Not in Qt documentation!
+ return Abi::AvrArchitecture;
+
+ return Abi::UnknownArchitecture;
+}
+
static quint8 getUint8(const QByteArray &data, int pos)
{
return static_cast<quint8>(data.at(pos));
@@ -838,7 +859,7 @@ Abi::OSFlavor Abi::flavorForMsvcVersion(int version)
Abi Abi::hostAbi()
{
- Architecture arch = QTC_CPU; // define set by qmake
+ Architecture arch = architectureFromQt();
OS os = UnknownOS;
OSFlavor subos = UnknownFlavor;
BinaryFormat format = UnknownFormat;
diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro
index 979a3e865d..faf97955e6 100644
--- a/src/plugins/projectexplorer/projectexplorer.pro
+++ b/src/plugins/projectexplorer/projectexplorer.pro
@@ -332,11 +332,4 @@ journald {
RESOURCES += projectexplorer.qrc
-# Some way to override the architecture used in Abi:
-!isEmpty($$(QTC_CPU)) {
- DEFINES += QTC_CPU=$$(QTC_CPU)
-} else {
- DEFINES += QTC_CPU=X86Architecture
-}
-
DEFINES += PROJECTEXPLORER_LIBRARY
diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs
index 2b643f69a7..5bb7197204 100644
--- a/src/plugins/projectexplorer/projectexplorer.qbs
+++ b/src/plugins/projectexplorer/projectexplorer.qbs
@@ -15,8 +15,6 @@ Project {
Depends { name: "TextEditor" }
Depends { name: "app_version_header" }
- cpp.defines: base.concat("QTC_CPU=X86Architecture")
-
Group {
name: "General"
files: [