From d3bed44f5fe7a7edaa97734b621ef7d708249f17 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 23 Jan 2018 12:00:45 +0100 Subject: 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 Reviewed-by: Jake Petroules Reviewed-by: Eike Ziller --- src/plugins/projectexplorer/abi.cpp | 23 ++++++++++++++++++++++- src/plugins/projectexplorer/projectexplorer.pro | 7 ------- src/plugins/projectexplorer/projectexplorer.qbs | 2 -- 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(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: [ -- cgit v1.2.1