From 007cb7eccbd84283684ed0acc44c41ce1dae791f Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@nokia.com>
Date: Thu, 5 Jan 2012 13:49:22 +0100
Subject: [PATCH] DebuggingHelper: Build with right architecture even for Mac
 universal

Task-number: QTCREATORBUG-6737

Change-Id: Ic4f814aa031902570310aad156e4b2ca9b2d3c26
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
---
 src/plugins/qtsupport/debugginghelperbuildtask.cpp | 12 +++++++++++-
 src/plugins/qtsupport/debugginghelperbuildtask.h   |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/plugins/qtsupport/debugginghelperbuildtask.cpp b/src/plugins/qtsupport/debugginghelperbuildtask.cpp
index ba016468aaf..72be8532b25 100644
--- a/src/plugins/qtsupport/debugginghelperbuildtask.cpp
+++ b/src/plugins/qtsupport/debugginghelperbuildtask.cpp
@@ -107,6 +107,16 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
                         << QLatin1String("-k");
     }
     m_qmakeCommand = version->qmakeCommand();
+    m_qmakeArguments = QStringList() << QLatin1String("-nocache");
+    if (toolChain->targetAbi().os() == ProjectExplorer::Abi::MacOS
+            && toolChain->targetAbi().architecture() == ProjectExplorer::Abi::X86Architecture) {
+        // explicitly set 32 or 64 bit in case Qt is compiled with both
+        if (toolChain->targetAbi().wordWidth() == 32)
+            m_qmakeArguments << QLatin1String("CONFIG+=x86");
+        else if (toolChain->targetAbi().wordWidth() == 64) {
+            m_qmakeArguments << QLatin1String("CONFIG+=x86_64");
+        }
+    }
     m_makeCommand = toolChain->makeCommand();
     m_mkspec = version->mkspec();
 
@@ -177,7 +187,7 @@ bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &futu
     arguments.makeCommand = m_makeCommand;
     arguments.makeArguments = m_makeArguments;
     arguments.qmakeCommand = m_qmakeCommand;
-    arguments.qmakeArguments = QStringList() << QLatin1String("-nocache");
+    arguments.qmakeArguments = m_qmakeArguments;
     arguments.targetMode = m_target;
     arguments.mkspec = m_mkspec;
     arguments.environment = m_environment;
diff --git a/src/plugins/qtsupport/debugginghelperbuildtask.h b/src/plugins/qtsupport/debugginghelperbuildtask.h
index ee24a659c99..b7cb684c02f 100644
--- a/src/plugins/qtsupport/debugginghelperbuildtask.h
+++ b/src/plugins/qtsupport/debugginghelperbuildtask.h
@@ -89,6 +89,7 @@ private:
     QString m_qtInstallData;
     QString m_target;
     QString m_qmakeCommand;
+    QStringList m_qmakeArguments;
     QString m_makeCommand;
     QStringList m_makeArguments;
     QString m_mkspec;
-- 
GitLab