| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | /**************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** This file is part of Qt Creator | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-01-26 18:33:46 +01:00
										 |  |  | ** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-11-02 15:59:12 +01:00
										 |  |  | ** Contact: Nokia Corporation (qt-info@nokia.com) | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | ** | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** GNU Lesser General Public License Usage | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** This file may be used under the terms of the GNU Lesser General Public | 
					
						
							|  |  |  | ** License version 2.1 as published by the Free Software Foundation and | 
					
						
							|  |  |  | ** appearing in the file LICENSE.LGPL included in the packaging of this file. | 
					
						
							|  |  |  | ** Please review the following information to ensure the GNU Lesser General | 
					
						
							|  |  |  | ** Public License version 2.1 requirements will be met: | 
					
						
							|  |  |  | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** In addition, as a special exception, Nokia gives you certain additional | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** rights. These rights are described in the Nokia Qt LGPL Exception | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** Other Usage | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Alternatively, this file may be used in accordance with the terms and | 
					
						
							|  |  |  | ** conditions contained in a signed written agreement between you and Nokia. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** If you have questions regarding the use of this file, please contact | 
					
						
							| 
									
										
										
										
											2011-11-02 15:59:12 +01:00
										 |  |  | ** Nokia at qt-info@nokia.com. | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | ** | 
					
						
							|  |  |  | **************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "qt4buildconfiguration.h"
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-23 13:29:45 +01:00
										 |  |  | #include "qt4project.h"
 | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  | #include "qt4target.h"
 | 
					
						
							| 
									
										
										
										
											2010-02-25 16:51:27 +01:00
										 |  |  | #include "qt4projectmanagerconstants.h"
 | 
					
						
							| 
									
										
										
										
											2010-03-17 17:45:33 +01:00
										 |  |  | #include "qt4nodes.h"
 | 
					
						
							|  |  |  | #include "qmakestep.h"
 | 
					
						
							|  |  |  | #include "makestep.h"
 | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  | #include "qt4basetargetfactory.h"
 | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | #include <utils/qtcassert.h>
 | 
					
						
							| 
									
										
										
										
											2010-10-19 11:14:03 +02:00
										 |  |  | #include <utils/qtcprocess.h>
 | 
					
						
							| 
									
										
										
										
											2010-09-09 17:00:26 +02:00
										 |  |  | #include <limits>
 | 
					
						
							| 
									
										
										
										
											2010-07-16 14:00:41 +02:00
										 |  |  | #include <projectexplorer/buildsteplist.h>
 | 
					
						
							|  |  |  | #include <projectexplorer/projectexplorerconstants.h>
 | 
					
						
							| 
									
										
										
										
											2011-05-30 16:45:32 +02:00
										 |  |  | #include <projectexplorer/toolchain.h>
 | 
					
						
							| 
									
										
										
										
											2011-06-01 15:03:44 +00:00
										 |  |  | #include <projectexplorer/toolchainmanager.h>
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  | #include <qtsupport/qtversionfactory.h>
 | 
					
						
							|  |  |  | #include <qtsupport/baseqtversion.h>
 | 
					
						
							| 
									
										
										
										
											2011-08-18 16:46:44 +02:00
										 |  |  | #include <qtsupport/qtversionmanager.h>
 | 
					
						
							| 
									
										
										
										
											2012-02-15 10:42:41 +01:00
										 |  |  | #include <QDebug>
 | 
					
						
							| 
									
										
										
										
											2010-02-19 10:51:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-15 10:42:41 +01:00
										 |  |  | #include <QInputDialog>
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | using namespace Qt4ProjectManager; | 
					
						
							|  |  |  | using namespace Qt4ProjectManager::Internal; | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | using namespace ProjectExplorer; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace { | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | const char * const QT4_BC_ID_PREFIX("Qt4ProjectManager.Qt4BuildConfiguration."); | 
					
						
							|  |  |  | const char * const QT4_BC_ID("Qt4ProjectManager.Qt4BuildConfiguration"); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | const char * const USE_SHADOW_BUILD_KEY("Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild"); | 
					
						
							|  |  |  | const char * const BUILD_DIRECTORY_KEY("Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory"); | 
					
						
							|  |  |  | const char * const BUILD_CONFIGURATION_KEY("Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration"); | 
					
						
							|  |  |  | const char * const QT_VERSION_ID_KEY("Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId"); | 
					
						
							| 
									
										
										
										
											2010-01-19 13:41:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-19 16:33:44 +01:00
										 |  |  | enum { debug = 0 }; | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-10 19:02:19 +01:00
										 |  |  | Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4BaseTarget *target) : | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  |     BuildConfiguration(target, Core::Id(QT4_BC_ID)), | 
					
						
							| 
									
										
										
										
											2010-03-25 11:55:29 +01:00
										 |  |  |     m_shadowBuild(true), | 
					
						
							| 
									
										
										
										
											2011-01-19 15:46:01 +01:00
										 |  |  |     m_isEnabled(false), | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     m_qtVersionId(-1), | 
					
						
							| 
									
										
										
										
											2010-01-13 18:00:02 +01:00
										 |  |  |     m_qmakeBuildConfiguration(0), | 
					
						
							| 
									
										
										
										
											2012-05-04 16:25:41 +03:00
										 |  |  |     m_subNodeBuild(0), | 
					
						
							|  |  |  |     m_fileNodeBuild(0) | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |     ctor(); | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  | Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4BaseTarget *target, const Core::Id id) : | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     BuildConfiguration(target, id), | 
					
						
							| 
									
										
										
										
											2010-03-25 11:55:29 +01:00
										 |  |  |     m_shadowBuild(true), | 
					
						
							| 
									
										
										
										
											2011-01-19 15:46:01 +01:00
										 |  |  |     m_isEnabled(false), | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     m_qtVersionId(-1), | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |     m_qmakeBuildConfiguration(0), | 
					
						
							| 
									
										
										
										
											2012-05-04 16:25:41 +03:00
										 |  |  |     m_subNodeBuild(0), | 
					
						
							|  |  |  |     m_fileNodeBuild(0) | 
					
						
							| 
									
										
										
										
											2009-12-08 12:21:11 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |     ctor(); | 
					
						
							| 
									
										
										
										
											2009-12-08 12:21:11 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-10 19:02:19 +01:00
										 |  |  | Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4BaseTarget *target, Qt4BuildConfiguration *source) : | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     BuildConfiguration(target, source), | 
					
						
							| 
									
										
										
										
											2009-12-08 12:21:11 +01:00
										 |  |  |     m_shadowBuild(source->m_shadowBuild), | 
					
						
							| 
									
										
										
										
											2011-01-19 15:46:01 +01:00
										 |  |  |     m_isEnabled(false), | 
					
						
							| 
									
										
										
										
											2009-12-08 12:21:11 +01:00
										 |  |  |     m_buildDirectory(source->m_buildDirectory), | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     m_qtVersionId(source->m_qtVersionId), | 
					
						
							| 
									
										
										
										
											2010-01-13 18:00:02 +01:00
										 |  |  |     m_qmakeBuildConfiguration(source->m_qmakeBuildConfiguration), | 
					
						
							| 
									
										
										
										
											2012-05-04 16:25:41 +03:00
										 |  |  |     m_subNodeBuild(0), // temporary value, so not copied
 | 
					
						
							|  |  |  |     m_fileNodeBuild(0) | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     cloneSteps(source); | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |     ctor(); | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Qt4BuildConfiguration::~Qt4BuildConfiguration() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | QVariantMap Qt4BuildConfiguration::toMap() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QVariantMap map(BuildConfiguration::toMap()); | 
					
						
							|  |  |  |     map.insert(QLatin1String(USE_SHADOW_BUILD_KEY), m_shadowBuild); | 
					
						
							|  |  |  |     map.insert(QLatin1String(BUILD_DIRECTORY_KEY), m_buildDirectory); | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     map.insert(QLatin1String(QT_VERSION_ID_KEY), m_qtVersionId); | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |     map.insert(QLatin1String(BUILD_CONFIGURATION_KEY), int(m_qmakeBuildConfiguration)); | 
					
						
							|  |  |  |     return map; | 
					
						
							| 
									
										
										
										
											2009-11-23 12:11:48 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | bool Qt4BuildConfiguration::fromMap(const QVariantMap &map) | 
					
						
							| 
									
										
										
										
											2009-12-08 12:21:11 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     if (!BuildConfiguration::fromMap(map)) | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-25 11:55:29 +01:00
										 |  |  |     m_shadowBuild = map.value(QLatin1String(USE_SHADOW_BUILD_KEY), true).toBool(); | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     m_qtVersionId = map.value(QLatin1String(QT_VERSION_ID_KEY)).toInt(); | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     m_qmakeBuildConfiguration = QtSupport::BaseQtVersion::QmakeBuildConfigs(map.value(QLatin1String(BUILD_CONFIGURATION_KEY)).toInt()); | 
					
						
							| 
									
										
										
										
											2011-03-23 13:32:42 +01:00
										 |  |  |     m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY), defaultShadowBuildDirectory()).toString(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-19 10:51:40 +01:00
										 |  |  |     // Pick a Qt version if the default version is used:
 | 
					
						
							| 
									
										
										
										
											2010-09-09 17:00:26 +02:00
										 |  |  |     // We assume that the default Qt version was used in earlier versions of Qt creator.
 | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  |     // Pick a Qt version that supports this target (usually desktop)
 | 
					
						
							| 
									
										
										
										
											2010-02-10 17:00:14 +01:00
										 |  |  |     if (m_qtVersionId == 0) { | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |         QList<QtSupport::BaseQtVersion *> versions = QtSupport::QtVersionManager::instance()->versionsForTargetId(target()->id()); | 
					
						
							|  |  |  |         foreach (QtSupport::BaseQtVersion *v, versions) { | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  |             if (v->isValid()) { | 
					
						
							| 
									
										
										
										
											2010-02-10 17:00:14 +01:00
										 |  |  |                 m_qtVersionId = v->uniqueId(); | 
					
						
							|  |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2010-02-19 10:51:40 +01:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2010-02-10 17:00:14 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |         if (m_qtVersionId == 0) | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  |             m_qtVersionId = -1; | 
					
						
							| 
									
										
										
										
											2010-02-10 17:00:14 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->version(m_qtVersionId); | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  |     if (!version || !version->supportsTargetId(target()->id())) { | 
					
						
							|  |  |  |         m_qtVersionId = -1; | 
					
						
							|  |  |  |         version = 0; | 
					
						
							| 
									
										
										
										
											2010-02-19 10:51:40 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  |     m_lastEmmitedBuildDirectory = buildDirectory(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-19 12:06:44 +01:00
										 |  |  |     ProjectExplorer::ToolChain *tc = toolChain(); | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  |     if (version && version->isValid()) { | 
					
						
							|  |  |  |         if (tc && !qt4Target()->possibleToolChains(this).contains(tc)) | 
					
						
							|  |  |  |             setToolChain(0); | 
					
						
							|  |  |  |         if (!toolChain()) | 
					
						
							| 
									
										
										
										
											2011-09-01 14:10:49 +00:00
										 |  |  |             setToolChain(qt4Target()->preferredToolChain(this)); | 
					
						
							| 
									
										
										
										
											2010-09-09 17:00:26 +02:00
										 |  |  |         m_shadowBuild = (m_shadowBuild && version->supportsShadowBuilds()); | 
					
						
							| 
									
										
										
										
											2011-02-01 18:36:00 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-03-10 16:13:53 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-01 18:36:00 +01:00
										 |  |  |     if (!toolChain()) { | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  |         if (version && version->isValid()) { | 
					
						
							| 
									
										
										
										
											2011-03-16 17:59:43 +01:00
										 |  |  |             qWarning("Warning: No tool chain available for '%s' from %s used in '%s'.", | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |                     qPrintable(version->displayName()), qPrintable(version->qmakeCommand().toUserOutput()), | 
					
						
							| 
									
										
										
										
											2012-04-25 16:28:58 +02:00
										 |  |  |                     qPrintable(target()->id().toString())); | 
					
						
							| 
									
										
										
										
											2011-02-28 12:29:41 +01:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2011-03-16 17:59:43 +01:00
										 |  |  |             qWarning("Warning: No tool chain available for invalid Qt version used in '%s'.", | 
					
						
							| 
									
										
										
										
											2012-04-25 16:28:58 +02:00
										 |  |  |                      qPrintable(target()->id().toString())); | 
					
						
							| 
									
										
										
										
											2011-02-28 12:29:41 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-02-19 10:51:40 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-09-22 15:14:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     return true; | 
					
						
							| 
									
										
										
										
											2009-12-08 12:21:11 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | void Qt4BuildConfiguration::ctor() | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-10-06 13:47:01 +02:00
										 |  |  |     connect(this, SIGNAL(environmentChanged()), | 
					
						
							|  |  |  |             this, SLOT(emitBuildDirectoryChanged())); | 
					
						
							| 
									
										
										
										
											2011-04-20 21:16:17 +02:00
										 |  |  |     connect(this, SIGNAL(environmentChanged()), | 
					
						
							| 
									
										
										
										
											2011-05-25 11:49:43 +02:00
										 |  |  |             this, SLOT(emitProFileEvaluateNeeded())); | 
					
						
							| 
									
										
										
										
											2011-09-15 13:30:54 +02:00
										 |  |  |     connect(qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)), | 
					
						
							| 
									
										
										
										
											2011-12-07 17:52:59 +01:00
										 |  |  |             this, SLOT(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); | 
					
						
							| 
									
										
										
										
											2010-10-06 13:47:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance(); | 
					
						
							| 
									
										
										
										
											2012-02-24 18:57:33 +01:00
										 |  |  |     connect(vm, SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)), | 
					
						
							|  |  |  |             this, SLOT(qtVersionsChanged(QList<int>,QList<int>,QList<int>))); | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-06 13:47:01 +02:00
										 |  |  | void Qt4BuildConfiguration::emitBuildDirectoryChanged() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (buildDirectory() != m_lastEmmitedBuildDirectory) { | 
					
						
							|  |  |  |         m_lastEmmitedBuildDirectory = buildDirectory(); | 
					
						
							|  |  |  |         emit buildDirectoryChanged(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-07 17:52:59 +01:00
										 |  |  | void Qt4BuildConfiguration::proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *, bool success, bool parseInProgress) | 
					
						
							| 
									
										
										
										
											2011-09-15 13:30:54 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     // Changing the included Qt modules from 0 to at least one might have caused the
 | 
					
						
							|  |  |  |     // tool chain to become invalid.
 | 
					
						
							| 
									
										
										
										
											2011-12-07 17:52:59 +01:00
										 |  |  |     if (!success || parseInProgress) | 
					
						
							|  |  |  |         return; | 
					
						
							| 
									
										
										
										
											2011-09-15 13:30:54 +02:00
										 |  |  |     if (!qt4Target()->possibleToolChains(this).contains(toolChain())) | 
					
						
							|  |  |  |         setToolChain(qt4Target()->preferredToolChain(this)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-10 19:02:19 +01:00
										 |  |  | Qt4BaseTarget *Qt4BuildConfiguration::qt4Target() const | 
					
						
							| 
									
										
										
										
											2009-11-26 14:43:27 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-12-10 19:02:19 +01:00
										 |  |  |     return static_cast<Qt4BaseTarget *>(target()); | 
					
						
							| 
									
										
										
										
											2009-11-26 14:43:27 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-23 10:35:23 +02:00
										 |  |  | Utils::Environment Qt4BuildConfiguration::baseEnvironment() const | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-09-23 10:35:23 +02:00
										 |  |  |     Utils::Environment env = BuildConfiguration::baseEnvironment(); | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  |     if (qtVersion()) | 
					
						
							|  |  |  |         qtVersion()->addToEnvironment(env); | 
					
						
							| 
									
										
										
										
											2010-10-06 13:47:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |     ToolChain *tc = toolChain(); | 
					
						
							|  |  |  |     if (tc) | 
					
						
							|  |  |  |         tc->addToEnvironment(env); | 
					
						
							|  |  |  |     return env; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-23 13:32:42 +01:00
										 |  |  | QString Qt4BuildConfiguration::defaultShadowBuildDirectory() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Qt4BaseTargetFactory *factory = Qt4BaseTargetFactory::qt4BaseTargetFactoryForId(qt4Target()->id()); | 
					
						
							|  |  |  |     // todo displayName isn't ideal
 | 
					
						
							| 
									
										
										
										
											2012-02-14 16:43:51 +01:00
										 |  |  |     return factory->shadowBuildDirectory(qt4Target()->qt4Project()->document()->fileName(), qt4Target()->id(), displayName()); | 
					
						
							| 
									
										
										
										
											2011-03-23 13:32:42 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-06 13:47:01 +02:00
										 |  |  | /// returns the unexpanded build directory
 | 
					
						
							|  |  |  | QString Qt4BuildConfiguration::rawBuildDirectory() const | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QString workingDirectory; | 
					
						
							| 
									
										
										
										
											2010-05-19 13:41:52 +02:00
										 |  |  |     if (m_shadowBuild) { | 
					
						
							|  |  |  |         if (!m_buildDirectory.isEmpty()) | 
					
						
							|  |  |  |             workingDirectory = m_buildDirectory; | 
					
						
							|  |  |  |         else | 
					
						
							| 
									
										
										
										
											2011-03-23 13:32:42 +01:00
										 |  |  |             workingDirectory = defaultShadowBuildDirectory(); | 
					
						
							| 
									
										
										
										
											2010-05-19 13:41:52 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |     if (workingDirectory.isEmpty()) | 
					
						
							| 
									
										
										
										
											2010-03-25 13:19:27 +01:00
										 |  |  |         workingDirectory = target()->project()->projectDirectory(); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |     return workingDirectory; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-06 13:47:01 +02:00
										 |  |  | /// returns the build directory
 | 
					
						
							|  |  |  | QString Qt4BuildConfiguration::buildDirectory() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return QDir::cleanPath(environment().expandVariables(rawBuildDirectory())); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-13 18:00:02 +01:00
										 |  |  | /// If only a sub tree should be build this function returns which sub node
 | 
					
						
							|  |  |  | /// should be build
 | 
					
						
							|  |  |  | /// \see Qt4BuildConfiguration::setSubNodeBuild
 | 
					
						
							| 
									
										
										
										
											2011-05-25 11:23:25 +02:00
										 |  |  | Qt4ProjectManager::Qt4ProFileNode *Qt4BuildConfiguration::subNodeBuild() const | 
					
						
							| 
									
										
										
										
											2010-01-13 18:00:02 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     return m_subNodeBuild; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /// A sub node build on builds a sub node of the project
 | 
					
						
							|  |  |  | /// That is triggered by a right click in the project explorer tree
 | 
					
						
							|  |  |  | /// The sub node to be build is set via this function immediately before
 | 
					
						
							|  |  |  | /// calling BuildManager::buildProject( BuildConfiguration * )
 | 
					
						
							|  |  |  | /// and reset immediately afterwards
 | 
					
						
							|  |  |  | /// That is m_subNodesBuild is set only temporarly
 | 
					
						
							| 
									
										
										
										
											2011-05-25 11:23:25 +02:00
										 |  |  | void Qt4BuildConfiguration::setSubNodeBuild(Qt4ProjectManager::Qt4ProFileNode *node) | 
					
						
							| 
									
										
										
										
											2010-01-13 18:00:02 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     m_subNodeBuild = node; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-04 16:25:41 +03:00
										 |  |  | FileNode *Qt4BuildConfiguration::fileNodeBuild() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_fileNodeBuild; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void Qt4BuildConfiguration::setFileNodeBuild(FileNode *node) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_fileNodeBuild = node; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 15:55:00 +01:00
										 |  |  | /// returns whether this is a shadow build configuration or not
 | 
					
						
							|  |  |  | /// note, even if shadowBuild() returns true, it might be using the
 | 
					
						
							| 
									
										
										
										
											2010-01-11 10:22:55 +01:00
										 |  |  | /// source directory as the shadow build directory, thus it
 | 
					
						
							|  |  |  | /// still is a in-source build
 | 
					
						
							| 
									
										
										
										
											2009-12-07 15:55:00 +01:00
										 |  |  | bool Qt4BuildConfiguration::shadowBuild() const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-12-08 12:21:11 +01:00
										 |  |  |     return m_shadowBuild; | 
					
						
							| 
									
										
										
										
											2009-12-07 15:55:00 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /// returns the shadow build directory if set
 | 
					
						
							|  |  |  | /// \note buildDirectory() is probably the function you want to call
 | 
					
						
							|  |  |  | QString Qt4BuildConfiguration::shadowBuildDirectory() const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-05-19 13:41:52 +02:00
										 |  |  |     if (m_buildDirectory.isEmpty()) | 
					
						
							| 
									
										
										
										
											2011-03-23 13:32:42 +01:00
										 |  |  |         return defaultShadowBuildDirectory(); | 
					
						
							| 
									
										
										
										
											2009-12-08 12:21:11 +01:00
										 |  |  |     return m_buildDirectory; | 
					
						
							| 
									
										
										
										
											2009-12-07 15:55:00 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  | void Qt4BuildConfiguration::setShadowBuildAndDirectory(bool shadowBuild, const QString &buildDirectory) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     QtSupport::BaseQtVersion *version = qtVersion(); | 
					
						
							| 
									
										
										
										
											2010-10-06 13:47:01 +02:00
										 |  |  |     QString directoryToSet = buildDirectory; | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  |     bool toSet = (shadowBuild && version && version->isValid() && version->supportsShadowBuilds()); | 
					
						
							| 
									
										
										
										
											2010-03-10 16:13:53 +01:00
										 |  |  |     if (m_shadowBuild == toSet && m_buildDirectory == directoryToSet) | 
					
						
							| 
									
										
										
										
											2009-12-07 15:55:00 +01:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2010-03-10 16:55:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-10 16:13:53 +01:00
										 |  |  |     m_shadowBuild = toSet; | 
					
						
							|  |  |  |     m_buildDirectory = directoryToSet; | 
					
						
							| 
									
										
										
										
											2010-09-22 15:14:07 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     emit environmentChanged(); | 
					
						
							| 
									
										
										
										
											2010-10-06 13:47:01 +02:00
										 |  |  |     emitBuildDirectoryChanged(); | 
					
						
							| 
									
										
										
										
											2010-03-10 16:55:37 +01:00
										 |  |  |     emit proFileEvaluateNeeded(this); | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | QString Qt4BuildConfiguration::makeCommand() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ToolChain *tc = toolChain(); | 
					
						
							| 
									
										
										
										
											2012-01-13 14:20:45 +01:00
										 |  |  |     return tc ? tc->makeCommand() : QLatin1String("make"); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  | static inline QString symbianMakeTarget(QtSupport::BaseQtVersion::QmakeBuildConfigs buildConfig, | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |                                         const QString &type) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     QString rc = (buildConfig & QtSupport::BaseQtVersion::DebugBuild) ? | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |                  QLatin1String("debug-") : QLatin1String("release-"); | 
					
						
							|  |  |  |     rc += type; | 
					
						
							|  |  |  |     return rc; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString Qt4BuildConfiguration::defaultMakeTarget() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ToolChain *tc = toolChain(); | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  |     if (!tc || target()->id() != Core::Id(Constants::S60_DEVICE_TARGET_ID)) | 
					
						
							| 
									
										
										
										
											2010-02-02 17:09:41 +01:00
										 |  |  |         return QString(); | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     const QtSupport::BaseQtVersion::QmakeBuildConfigs buildConfig = qmakeBuildConfiguration(); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-01 18:36:00 +01:00
										 |  |  |     return symbianMakeTarget(buildConfig, tc->defaultMakeTarget()); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-05 17:38:45 +02:00
										 |  |  | QString Qt4BuildConfiguration::makefile() const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-08-18 16:46:44 +02:00
										 |  |  |     return qt4Target()->qt4Project()->rootQt4ProjectNode()->makefile(); | 
					
						
							| 
									
										
										
										
											2010-10-05 17:38:45 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  | QtSupport::BaseQtVersion *Qt4BuildConfiguration::qtVersion() const | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance(); | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     return vm->version(m_qtVersionId); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  | void Qt4BuildConfiguration::setQtVersion(QtSupport::BaseQtVersion *version) | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  |     if (version == 0) { | 
					
						
							|  |  |  |         m_qtVersionId = -1; | 
					
						
							|  |  |  |         m_shadowBuild = false; | 
					
						
							|  |  |  |         setToolChain(0); | 
					
						
							|  |  |  |         emit proFileEvaluateNeeded(this); | 
					
						
							|  |  |  |         emit qtVersionChanged(); | 
					
						
							|  |  |  |         emit environmentChanged(); | 
					
						
							|  |  |  |         emitBuildDirectoryChanged(); | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |     if (m_qtVersionId == version->uniqueId()) | 
					
						
							|  |  |  |             return; | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     m_qtVersionId = version->uniqueId(); | 
					
						
							| 
									
										
										
										
											2010-04-14 13:37:08 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-01 18:36:00 +01:00
										 |  |  |     if (!qt4Target()->possibleToolChains(this).contains(toolChain())) | 
					
						
							|  |  |  |         setToolChain(qt4Target()->preferredToolChain(this)); | 
					
						
							| 
									
										
										
										
											2010-09-09 17:00:26 +02:00
										 |  |  |     m_shadowBuild = m_shadowBuild && qtVersion()->supportsShadowBuilds(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-10 16:55:37 +01:00
										 |  |  |     emit proFileEvaluateNeeded(this); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |     emit qtVersionChanged(); | 
					
						
							| 
									
										
										
										
											2009-12-08 14:41:56 +01:00
										 |  |  |     emit environmentChanged(); | 
					
						
							| 
									
										
										
										
											2010-10-06 13:47:01 +02:00
										 |  |  |     emitBuildDirectoryChanged(); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-01 18:36:00 +01:00
										 |  |  | void Qt4BuildConfiguration::setToolChain(ProjectExplorer::ToolChain *tc) | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-12-19 12:06:44 +01:00
										 |  |  |     if (tc != 0 && m_qtVersionId > 0 && !qt4Target()->possibleToolChains(this).contains(tc)) | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2010-04-14 13:37:08 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-28 15:38:48 +02:00
										 |  |  |     if (toolChain() == tc) | 
					
						
							| 
									
										
										
										
											2011-09-28 12:00:29 +02:00
										 |  |  |         return; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-01 18:36:00 +01:00
										 |  |  |     BuildConfiguration::setToolChain(tc); | 
					
						
							| 
									
										
										
										
											2010-03-10 16:55:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     emit proFileEvaluateNeeded(this); | 
					
						
							| 
									
										
										
										
											2010-10-06 13:47:01 +02:00
										 |  |  |     emitBuildDirectoryChanged(); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  | QtSupport::BaseQtVersion::QmakeBuildConfigs Qt4BuildConfiguration::qmakeBuildConfiguration() const | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-12-08 12:21:11 +01:00
										 |  |  |     return m_qmakeBuildConfiguration; | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  | void Qt4BuildConfiguration::setQMakeBuildConfiguration(QtSupport::BaseQtVersion::QmakeBuildConfigs config) | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-12-08 12:21:11 +01:00
										 |  |  |     if (m_qmakeBuildConfiguration == config) | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2009-12-08 12:21:11 +01:00
										 |  |  |     m_qmakeBuildConfiguration = config; | 
					
						
							| 
									
										
										
										
											2010-03-10 16:55:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     emit proFileEvaluateNeeded(this); | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  |     emit qmakeBuildConfigurationChanged(); | 
					
						
							| 
									
										
										
										
											2011-03-23 13:32:42 +01:00
										 |  |  |     emitBuildDirectoryChanged(); | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-25 11:49:43 +02:00
										 |  |  | void Qt4BuildConfiguration::emitProFileEvaluateNeeded() | 
					
						
							| 
									
										
										
										
											2010-09-01 12:33:53 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     emit proFileEvaluateNeeded(this); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-12 17:20:15 +01:00
										 |  |  | void Qt4BuildConfiguration::emitQMakeBuildConfigurationChanged() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     emit qmakeBuildConfigurationChanged(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-15 17:33:56 +01:00
										 |  |  | void Qt4BuildConfiguration::emitBuildDirectoryInitialized() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     emit buildDirectoryInitialized(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-21 14:12:53 +02:00
										 |  |  | void Qt4BuildConfiguration::emitS60CreatesSmartInstallerChanged() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     emit s60CreatesSmartInstallerChanged(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-01 12:33:53 +02:00
										 |  |  | QStringList Qt4BuildConfiguration::configCommandLineArguments() const | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-09-01 12:33:53 +02:00
										 |  |  |     QStringList result; | 
					
						
							| 
									
										
										
										
											2011-05-24 19:08:31 +02:00
										 |  |  |     QtSupport::BaseQtVersion::QmakeBuildConfigs defaultBuildConfiguration =  qtVersion() ? qtVersion()->defaultBuildConfig() : (QtSupport::BaseQtVersion::DebugBuild | QtSupport::BaseQtVersion::BuildAll); | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     QtSupport::BaseQtVersion::QmakeBuildConfigs userBuildConfiguration = m_qmakeBuildConfiguration; | 
					
						
							|  |  |  |     if ((defaultBuildConfiguration & QtSupport::BaseQtVersion::BuildAll) && !(userBuildConfiguration & QtSupport::BaseQtVersion::BuildAll)) | 
					
						
							| 
									
										
										
										
											2012-01-13 14:20:45 +01:00
										 |  |  |         result << QLatin1String("CONFIG-=debug_and_release"); | 
					
						
							| 
									
										
										
										
											2010-09-01 12:33:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     if (!(defaultBuildConfiguration & QtSupport::BaseQtVersion::BuildAll) && (userBuildConfiguration & QtSupport::BaseQtVersion::BuildAll)) | 
					
						
							| 
									
										
										
										
											2012-01-13 14:20:45 +01:00
										 |  |  |         result << QLatin1String("CONFIG+=debug_and_release"); | 
					
						
							| 
									
										
										
										
											2011-05-24 19:08:31 +02:00
										 |  |  |     if ((defaultBuildConfiguration & QtSupport::BaseQtVersion::DebugBuild) && !(userBuildConfiguration & QtSupport::BaseQtVersion::DebugBuild)) | 
					
						
							| 
									
										
										
										
											2012-01-13 14:20:45 +01:00
										 |  |  |         result << QLatin1String("CONFIG+=release"); | 
					
						
							| 
									
										
										
										
											2011-05-24 19:08:31 +02:00
										 |  |  |     if (!(defaultBuildConfiguration & QtSupport::BaseQtVersion::DebugBuild) && (userBuildConfiguration & QtSupport::BaseQtVersion::DebugBuild)) | 
					
						
							| 
									
										
										
										
											2012-01-13 14:20:45 +01:00
										 |  |  |         result << QLatin1String("CONFIG+=debug"); | 
					
						
							| 
									
										
										
										
											2010-09-01 12:33:53 +02:00
										 |  |  |     return result; | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | QMakeStep *Qt4BuildConfiguration::qmakeStep() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QMakeStep *qs = 0; | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  |     BuildStepList *bsl = stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD)); | 
					
						
							| 
									
										
										
										
											2010-07-16 14:00:41 +02:00
										 |  |  |     Q_ASSERT(bsl); | 
					
						
							|  |  |  |     for (int i = 0; i < bsl->count(); ++i) | 
					
						
							|  |  |  |         if ((qs = qobject_cast<QMakeStep *>(bsl->at(i))) != 0) | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |             return qs; | 
					
						
							|  |  |  |     return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MakeStep *Qt4BuildConfiguration::makeStep() const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-07-16 14:00:41 +02:00
										 |  |  |     MakeStep *ms = 0; | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  |     BuildStepList *bsl = stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD)); | 
					
						
							| 
									
										
										
										
											2010-07-16 14:00:41 +02:00
										 |  |  |     Q_ASSERT(bsl); | 
					
						
							|  |  |  |     for (int i = 0; i < bsl->count(); ++i) | 
					
						
							|  |  |  |         if ((ms = qobject_cast<MakeStep *>(bsl->at(i))) != 0) | 
					
						
							|  |  |  |             return ms; | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |     return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-24 18:57:33 +01:00
										 |  |  | void Qt4BuildConfiguration::qtVersionsChanged(const QList<int> &addedVersions, const QList<int> &removedVersions, const QList<int> &changedVersions) | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-02-24 18:57:33 +01:00
										 |  |  |     Q_UNUSED(addedVersions); | 
					
						
							| 
									
										
										
										
											2012-05-09 10:44:58 +00:00
										 |  |  |     if (removedVersions.contains(m_qtVersionId)) { | 
					
						
							|  |  |  |         m_qtVersionId = -1; | 
					
						
							|  |  |  |         QList<QtSupport::BaseQtVersion *> versionList | 
					
						
							|  |  |  |                 = QtSupport::QtVersionManager::instance()->versionsForTargetId(target()->id()); | 
					
						
							|  |  |  |         if (!versionList.isEmpty()) | 
					
						
							|  |  |  |             m_qtVersionId = versionList.at(0)->uniqueId(); | 
					
						
							|  |  |  |         emit qtVersionChanged(); | 
					
						
							|  |  |  |     } else if (changedVersions.contains(m_qtVersionId)) { | 
					
						
							|  |  |  |         emit environmentChanged(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-12-03 18:37:27 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | // returns true if both are equal
 | 
					
						
							| 
									
										
										
										
											2010-10-05 17:38:45 +02:00
										 |  |  | bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile) | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QMakeStep *qs = qmakeStep(); | 
					
						
							| 
									
										
										
										
											2010-10-05 17:38:45 +02:00
										 |  |  |     if (QFileInfo(makefile).exists() && qs) { | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |         Utils::FileName qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile); | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |         QtSupport::BaseQtVersion *version = qtVersion(); | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  |         if (!version) | 
					
						
							|  |  |  |             return false; | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |         if (version->qmakeCommand() == qmakePath) { | 
					
						
							|  |  |  |             // same qtversion
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |             QPair<QtSupport::BaseQtVersion::QmakeBuildConfigs, QString> result = | 
					
						
							|  |  |  |                     QtSupport::QtVersionManager::scanMakeFile(makefile, version->defaultBuildConfig()); | 
					
						
							| 
									
										
										
										
											2009-12-02 17:43:43 +01:00
										 |  |  |             if (qmakeBuildConfiguration() == result.first) { | 
					
						
							| 
									
										
										
										
											2010-02-16 13:53:29 +01:00
										 |  |  |                 // The qmake Build Configuration are the same,
 | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |                 // now compare arguments lists
 | 
					
						
							|  |  |  |                 // we have to compare without the spec/platform cmd argument
 | 
					
						
							|  |  |  |                 // and compare that on its own
 | 
					
						
							| 
									
										
										
										
											2010-10-05 17:38:45 +02:00
										 |  |  |                 QString workingDirectory = QFileInfo(makefile).absolutePath(); | 
					
						
							| 
									
										
										
										
											2011-06-07 17:09:32 +02:00
										 |  |  |                 QStringList actualArgs; | 
					
						
							|  |  |  |                 QString userArgs = qs->userArguments(); | 
					
						
							|  |  |  |                 // This copies the settings from userArgs to actualArgs (minus some we
 | 
					
						
							|  |  |  |                 // are not interested in), splitting them up into individual strings:
 | 
					
						
							|  |  |  |                 extractSpecFromArguments(&userArgs, workingDirectory, version, &actualArgs), | 
					
						
							| 
									
										
										
										
											2012-05-03 16:15:38 +02:00
										 |  |  |                 actualArgs = qs->deducedArguments() + actualArgs + qs->deducedArgumentsAfter(); | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |                 Utils::FileName actualSpec = qs->mkspec(); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-19 11:14:03 +02:00
										 |  |  |                 QString qmakeArgs = result.second; | 
					
						
							|  |  |  |                 QStringList parsedArgs; | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |                 Utils::FileName parsedSpec = extractSpecFromArguments(&qmakeArgs, workingDirectory, version, &parsedArgs); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 if (debug) { | 
					
						
							|  |  |  |                     qDebug()<<"Actual args:"<<actualArgs; | 
					
						
							|  |  |  |                     qDebug()<<"Parsed args:"<<parsedArgs; | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |                     qDebug()<<"Actual spec:"<<actualSpec.toString(); | 
					
						
							|  |  |  |                     qDebug()<<"Parsed spec:"<<parsedSpec.toString(); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-30 16:41:59 +02:00
										 |  |  |                 // Comparing the sorted list is obviously wrong
 | 
					
						
							|  |  |  |                 // Though haven written a more complete version
 | 
					
						
							|  |  |  |                 // that managed had around 200 lines and yet faild
 | 
					
						
							|  |  |  |                 // to be actually foolproof at all, I think it's
 | 
					
						
							|  |  |  |                 // not feasible without actually taking the qmake
 | 
					
						
							|  |  |  |                 // command line parsing code
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Things, sorting gets wrong:
 | 
					
						
							|  |  |  |                 // parameters to positional parameters matter
 | 
					
						
							|  |  |  |                 //  e.g. -o -spec is different from -spec -o
 | 
					
						
							|  |  |  |                 //       -o 1 -spec 2 is diffrent from -spec 1 -o 2
 | 
					
						
							|  |  |  |                 // variable assignment order matters
 | 
					
						
							|  |  |  |                 // variable assignment vs -after
 | 
					
						
							|  |  |  |                 // -norecursive vs. recursive
 | 
					
						
							|  |  |  |                 actualArgs.sort(); | 
					
						
							|  |  |  |                 parsedArgs.sort(); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |                 if (actualArgs == parsedArgs) { | 
					
						
							|  |  |  |                     // Specs match exactly
 | 
					
						
							|  |  |  |                     if (actualSpec == parsedSpec) | 
					
						
							|  |  |  |                         return true; | 
					
						
							|  |  |  |                     // Actual spec is the default one
 | 
					
						
							|  |  |  | //                    qDebug()<<"AS vs VS"<<actualSpec<<version->mkspec();
 | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |                     if ((actualSpec == version->mkspec() || actualSpec == Utils::FileName::fromString(QLatin1String("default"))) | 
					
						
							|  |  |  |                         && (parsedSpec == version->mkspec() || parsedSpec == Utils::FileName::fromString(QLatin1String("default")) || parsedSpec.isEmpty())) | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |                         return true; | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2010-08-30 14:49:58 +02:00
										 |  |  |             } else if (debug) { | 
					
						
							|  |  |  |                 qDebug()<<"different qmake buildconfigurations buildconfiguration:"<<qmakeBuildConfiguration()<<" Makefile:"<<result.first; | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2010-08-30 14:49:58 +02:00
										 |  |  |         } else if (debug) { | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |             qDebug()<<"diffrent qt versions, buildconfiguration:"<<version->qmakeCommand().toString()<<" Makefile:"<<qmakePath.toString(); | 
					
						
							| 
									
										
										
										
											2009-11-25 18:50:20 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return false; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-01 16:16:59 +02:00
										 |  |  | bool Qt4BuildConfiguration::removeQMLInspectorFromArguments(QString *args) | 
					
						
							| 
									
										
										
										
											2010-08-30 13:24:34 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-01 16:16:59 +02:00
										 |  |  |     bool removedArgument = false; | 
					
						
							|  |  |  |     for (Utils::QtcProcess::ArgIterator ait(args); ait.next(); ) { | 
					
						
							| 
									
										
										
										
											2011-09-01 09:43:08 +02:00
										 |  |  |         const QString arg = ait.value(); | 
					
						
							|  |  |  |         if (arg.contains(QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH)) | 
					
						
							| 
									
										
										
										
											2012-04-10 17:22:10 +02:00
										 |  |  |             || arg.contains(QLatin1String(Constants::QMAKEVAR_DECLARATIVE_DEBUG4)) | 
					
						
							|  |  |  |             || arg.contains(QLatin1String(Constants::QMAKEVAR_DECLARATIVE_DEBUG5))) { | 
					
						
							| 
									
										
										
										
											2011-10-13 14:01:28 +02:00
										 |  |  |             ait.deleteArg(); | 
					
						
							| 
									
										
										
										
											2011-09-01 16:16:59 +02:00
										 |  |  |             removedArgument = true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return removedArgument; | 
					
						
							| 
									
										
										
										
											2010-08-30 13:24:34 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  | Utils::FileName Qt4BuildConfiguration::extractSpecFromArguments(QString *args, | 
					
						
							|  |  |  |                                                                 const QString &directory, const QtSupport::BaseQtVersion *version, | 
					
						
							|  |  |  |                                                                 QStringList *outArgs) | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |     Utils::FileName parsedSpec; | 
					
						
							| 
									
										
										
										
											2010-10-19 11:14:03 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  |     bool ignoreNext = false; | 
					
						
							| 
									
										
										
										
											2010-10-19 11:14:03 +02:00
										 |  |  |     bool nextIsSpec = false; | 
					
						
							|  |  |  |     for (Utils::QtcProcess::ArgIterator ait(args); ait.next(); ) { | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  |         if (ignoreNext) { | 
					
						
							|  |  |  |             ignoreNext = false; | 
					
						
							| 
									
										
										
										
											2010-10-19 11:14:03 +02:00
										 |  |  |             ait.deleteArg(); | 
					
						
							|  |  |  |         } else if (nextIsSpec) { | 
					
						
							|  |  |  |             nextIsSpec = false; | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |             parsedSpec = Utils::FileName::fromUserInput(ait.value()); | 
					
						
							| 
									
										
										
										
											2010-10-19 11:14:03 +02:00
										 |  |  |             ait.deleteArg(); | 
					
						
							|  |  |  |         } else if (ait.value() == QLatin1String("-spec") || ait.value() == QLatin1String("-platform")) { | 
					
						
							|  |  |  |             nextIsSpec = true; | 
					
						
							|  |  |  |             ait.deleteArg(); | 
					
						
							|  |  |  |         } else if (ait.value() == QLatin1String("-cache")) { | 
					
						
							|  |  |  |             // We ignore -cache, because qmake contained a bug that it didn't
 | 
					
						
							|  |  |  |             // mention the -cache in the Makefile.
 | 
					
						
							|  |  |  |             // That means changing the -cache option in the additional arguments
 | 
					
						
							|  |  |  |             // does not automatically rerun qmake. Alas, we could try more
 | 
					
						
							|  |  |  |             // intelligent matching for -cache, but i guess people rarely
 | 
					
						
							|  |  |  |             // do use that.
 | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  |             ignoreNext = true; | 
					
						
							| 
									
										
										
										
											2010-10-19 11:14:03 +02:00
										 |  |  |             ait.deleteArg(); | 
					
						
							|  |  |  |         } else if (outArgs && ait.isSimple()) { | 
					
						
							|  |  |  |             outArgs->append(ait.value()); | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-19 11:14:03 +02:00
										 |  |  |     if (parsedSpec.isEmpty()) | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |         return Utils::FileName(); | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-13 14:20:45 +01:00
										 |  |  |     Utils::FileName baseMkspecDir = Utils::FileName::fromUserInput(version->versionInfo().value(QLatin1String("QMAKE_MKSPECS"))); | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  |     if (baseMkspecDir.isEmpty()) | 
					
						
							| 
									
										
										
										
											2012-01-13 14:20:45 +01:00
										 |  |  |         baseMkspecDir = Utils::FileName::fromUserInput(version->versionInfo().value(QLatin1String("QT_INSTALL_DATA")) | 
					
						
							|  |  |  |                                                        + QLatin1String("/mkspecs")); | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // if the path is relative it can be
 | 
					
						
							|  |  |  |     // relative to the working directory (as found in the Makefiles)
 | 
					
						
							|  |  |  |     // or relatively to the mkspec directory
 | 
					
						
							|  |  |  |     // if it is the former we need to get the canonical form
 | 
					
						
							|  |  |  |     // for the other one we don't need to do anything
 | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |     if (parsedSpec.toFileInfo().isRelative()) { | 
					
						
							|  |  |  |         if (QFileInfo(directory + QLatin1Char('/') + parsedSpec.toString()).exists()) { | 
					
						
							|  |  |  |             parsedSpec = Utils::FileName::fromUserInput(directory + QLatin1Char('/') + parsedSpec.toString()); | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |             parsedSpec = Utils::FileName::fromUserInput(baseMkspecDir.toString() + QLatin1Char('/') + parsedSpec.toString()); | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |     QFileInfo f2 = parsedSpec.toFileInfo(); | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  |     while (f2.isSymLink()) { | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |         parsedSpec = Utils::FileName::fromString(f2.symLinkTarget()); | 
					
						
							|  |  |  |         f2.setFile(parsedSpec.toString()); | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |     if (parsedSpec.isChildOf(baseMkspecDir)) { | 
					
						
							|  |  |  |         parsedSpec = parsedSpec.relativeChildPath(baseMkspecDir); | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  |     } else { | 
					
						
							| 
									
										
										
										
											2012-01-13 14:20:45 +01:00
										 |  |  |         Utils::FileName sourceMkSpecPath = Utils::FileName::fromString(version->sourcePath().toString() | 
					
						
							|  |  |  |                                                                        + QLatin1String("/mkspecs")); | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |         if (parsedSpec.isChildOf(sourceMkSpecPath)) { | 
					
						
							|  |  |  |             parsedSpec = parsedSpec.relativeChildPath(sourceMkSpecPath); | 
					
						
							| 
									
										
										
										
											2009-11-26 16:49:45 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return parsedSpec; | 
					
						
							| 
									
										
										
										
											2009-12-02 17:43:43 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-07 16:32:23 +02:00
										 |  |  | ProjectExplorer::IOutputParser *Qt4BuildConfiguration::createOutputParser() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ToolChain *tc = toolChain(); | 
					
						
							|  |  |  |     if (tc) | 
					
						
							|  |  |  |         return toolChain()->outputParser(); | 
					
						
							|  |  |  |     return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 15:46:01 +01:00
										 |  |  | bool Qt4BuildConfiguration::isEnabled() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_isEnabled; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-26 15:56:36 +02:00
										 |  |  | QString Qt4BuildConfiguration::disabledReason() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (!m_isEnabled) | 
					
						
							|  |  |  |         return tr("Parsing the .pro file"); | 
					
						
							|  |  |  |     return QString(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-19 15:46:01 +01:00
										 |  |  | void Qt4BuildConfiguration::setEnabled(bool enabled) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (m_isEnabled == enabled) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     m_isEnabled = enabled; | 
					
						
							|  |  |  |     emit enabledChanged(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | /*!
 | 
					
						
							|  |  |  |   \class Qt4BuildConfigurationFactory | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | Qt4BuildConfigurationFactory::Qt4BuildConfigurationFactory(QObject *parent) : | 
					
						
							|  |  |  |     ProjectExplorer::IBuildConfigurationFactory(parent) | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     update(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance(); | 
					
						
							| 
									
										
										
										
											2012-02-24 18:57:33 +01:00
										 |  |  |     connect(vm, SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)), | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |             this, SLOT(update())); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Qt4BuildConfigurationFactory::~Qt4BuildConfigurationFactory() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void Qt4BuildConfigurationFactory::update() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     emit availableCreationIdsChanged(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  | QList<Core::Id> Qt4BuildConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  |     QList<Core::Id> results; | 
					
						
							| 
									
										
										
										
											2010-12-10 19:02:19 +01:00
										 |  |  |     if (!qobject_cast<Qt4BaseTarget *>(parent)) | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  |         return results; | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance(); | 
					
						
							| 
									
										
										
										
											2012-04-04 16:06:35 +02:00
										 |  |  |     QList<QtSupport::BaseQtVersion *> versions = vm->versionsForTargetId(parent->id()); | 
					
						
							|  |  |  |     foreach (QtSupport::BaseQtVersion *v, versions) { | 
					
						
							|  |  |  |         if (v->toolChainAvailable(parent->id())) | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  |             results << Core::Id(QLatin1String(QT4_BC_ID_PREFIX) + QString::number(v->uniqueId())); | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-04-04 16:06:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     return results; | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  | int idToUniqueId(const Core::Id id) | 
					
						
							| 
									
										
										
										
											2012-04-04 16:06:35 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  |     QString rest = id.name().mid(QString(QT4_BC_ID_PREFIX).length()); | 
					
						
							| 
									
										
										
										
											2012-04-04 16:06:35 +02:00
										 |  |  |     bool ok; | 
					
						
							|  |  |  |     int unqieuid = rest.toInt(&ok); | 
					
						
							|  |  |  |     if (!ok) | 
					
						
							|  |  |  |         return -1; | 
					
						
							|  |  |  |     return unqieuid; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  | QString Qt4BuildConfigurationFactory::displayNameForId(const Core::Id id) const | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  |     if (!id.name().startsWith(QT4_BC_ID_PREFIX)) | 
					
						
							| 
									
										
										
										
											2012-04-04 16:06:35 +02:00
										 |  |  |         return QString(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance(); | 
					
						
							|  |  |  |     QtSupport::BaseQtVersion *v = vm->version(idToUniqueId(id)); | 
					
						
							|  |  |  |     if (!v) | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |         return QString(); | 
					
						
							| 
									
										
										
										
											2012-04-04 16:06:35 +02:00
										 |  |  |     return tr("Using Qt Version \"%1\"").arg(v->displayName()); | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  | bool Qt4BuildConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  |     const QString idStr = QString::fromLatin1(id.name()); | 
					
						
							| 
									
										
										
										
											2010-12-10 19:02:19 +01:00
										 |  |  |     if (!qobject_cast<Qt4BaseTarget *>(parent)) | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |         return false; | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  |     if (!id.name().startsWith(QT4_BC_ID_PREFIX)) | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |         return false; | 
					
						
							| 
									
										
										
										
											2012-04-04 16:06:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->version(idToUniqueId(id)); | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     if (!version || | 
					
						
							|  |  |  |         !version->supportsTargetId(parent->id())) | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |         return false; | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |     return true; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  | BuildConfiguration *Qt4BuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id) | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     if (!canCreate(parent, id)) | 
					
						
							|  |  |  |         return 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-04 16:06:35 +02:00
										 |  |  |     QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->version(idToUniqueId(id)); | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |     Q_ASSERT(version); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-10 19:02:19 +01:00
										 |  |  |     Qt4BaseTarget *qt4Target = static_cast<Qt4BaseTarget *>(parent); | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     bool ok; | 
					
						
							|  |  |  |     QString buildConfigurationName = QInputDialog::getText(0, | 
					
						
							| 
									
										
										
										
											2010-09-14 14:51:50 +02:00
										 |  |  |                           tr("New Configuration"), | 
					
						
							|  |  |  |                           tr("New configuration name:"), | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |                           QLineEdit::Normal, | 
					
						
							|  |  |  |                           version->displayName(), | 
					
						
							|  |  |  |                           &ok); | 
					
						
							| 
									
										
										
										
											2010-10-04 17:50:55 +02:00
										 |  |  |     buildConfigurationName = buildConfigurationName.trimmed(); | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     if (!ok || buildConfigurationName.isEmpty()) | 
					
						
							| 
									
										
										
										
											2010-07-16 14:00:41 +02:00
										 |  |  |         return 0; | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-18 09:59:49 +01:00
										 |  |  |     //: Debug build configuration. We recommend not translating it.
 | 
					
						
							| 
									
										
										
										
											2012-04-17 17:10:56 +02:00
										 |  |  |     QString defaultFirstName = tr("%1 Debug").arg(version->displayName()); | 
					
						
							|  |  |  |     QString customFirstName; | 
					
						
							| 
									
										
										
										
											2011-05-20 12:52:59 +02:00
										 |  |  |     if (buildConfigurationName != version->displayName()) | 
					
						
							| 
									
										
										
										
											2012-04-17 17:10:56 +02:00
										 |  |  |         customFirstName = tr("%1 Debug").arg(buildConfigurationName); | 
					
						
							| 
									
										
										
										
											2011-05-04 13:14:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-10 16:48:16 +02:00
										 |  |  |     //: Release build configuration. We recommend not translating it.
 | 
					
						
							| 
									
										
										
										
											2012-04-17 17:10:56 +02:00
										 |  |  |     QString defaultSecondName = tr("%1 Release").arg(version->displayName()); | 
					
						
							|  |  |  |     QString customSecondName; | 
					
						
							| 
									
										
										
										
											2012-04-10 16:48:16 +02:00
										 |  |  |     if (buildConfigurationName != version->displayName()) | 
					
						
							| 
									
										
										
										
											2012-04-17 17:10:56 +02:00
										 |  |  |         customSecondName = tr("%1 Release").arg(buildConfigurationName); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (!(version->defaultBuildConfig() & QtSupport::BaseQtVersion::DebugBuild)) { | 
					
						
							|  |  |  |         qSwap(defaultFirstName, defaultSecondName); | 
					
						
							|  |  |  |         qSwap(customFirstName, customSecondName); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-04-10 16:48:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-17 17:10:56 +02:00
										 |  |  |     BuildConfiguration *bc = qt4Target->addQt4BuildConfiguration(defaultFirstName, customFirstName, | 
					
						
							|  |  |  |                                         version, | 
					
						
							|  |  |  |                                         version->defaultBuildConfig(), | 
					
						
							|  |  |  |                                         QString(), QString(), false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     qt4Target->addQt4BuildConfiguration(defaultSecondName, customSecondName, | 
					
						
							|  |  |  |                                         version, | 
					
						
							|  |  |  |                                         (version->defaultBuildConfig() ^ QtSupport::BaseQtVersion::DebugBuild), | 
					
						
							|  |  |  |                                         QString(), QString(), false); | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  |     return bc; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  | bool Qt4BuildConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-12-10 19:02:19 +01:00
										 |  |  |     if (!qobject_cast<Qt4BaseTarget *>(parent)) | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |         return false; | 
					
						
							|  |  |  |     Qt4BuildConfiguration *qt4bc(qobject_cast<Qt4BuildConfiguration *>(source)); | 
					
						
							|  |  |  |     if (!qt4bc) | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     QtSupport::BaseQtVersion *version = qt4bc->qtVersion(); | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     if (!version || | 
					
						
							|  |  |  |         !version->supportsTargetId(parent->id())) | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     return true; | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  | BuildConfiguration *Qt4BuildConfigurationFactory::clone(Target *parent, BuildConfiguration *source) | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |     if (!canClone(parent, source)) | 
					
						
							|  |  |  |         return 0; | 
					
						
							| 
									
										
										
										
											2010-12-10 19:02:19 +01:00
										 |  |  |     Qt4BaseTarget *target = static_cast<Qt4BaseTarget *>(parent); | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |     Qt4BuildConfiguration *oldbc(static_cast<Qt4BuildConfiguration *>(source)); | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  |     return new Qt4BuildConfiguration(target, oldbc); | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  | bool Qt4BuildConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-15 17:17:40 +01:00
										 |  |  |     QString id = QString::fromLatin1(ProjectExplorer::idFromMap(map).name()); // unicode save
 | 
					
						
							| 
									
										
										
										
											2010-12-10 19:02:19 +01:00
										 |  |  |     if (!qobject_cast<Qt4BaseTarget *>(parent)) | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |         return false; | 
					
						
							|  |  |  |     return id.startsWith(QLatin1String(QT4_BC_ID_PREFIX)) || | 
					
						
							|  |  |  |            id == QLatin1String(QT4_BC_ID); | 
					
						
							| 
									
										
										
										
											2010-01-07 18:17:24 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 15:50:06 +01:00
										 |  |  | BuildConfiguration *Qt4BuildConfigurationFactory::restore(Target *parent, const QVariantMap &map) | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     if (!canRestore(parent, map)) | 
					
						
							|  |  |  |         return 0; | 
					
						
							| 
									
										
										
										
											2010-12-10 19:02:19 +01:00
										 |  |  |     Qt4BaseTarget *target = static_cast<Qt4BaseTarget *>(parent); | 
					
						
							|  |  |  |     Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(target); | 
					
						
							| 
									
										
										
										
											2010-01-18 12:11:04 +01:00
										 |  |  |     if (bc->fromMap(map)) | 
					
						
							|  |  |  |         return bc; | 
					
						
							|  |  |  |     delete bc; | 
					
						
							|  |  |  |     return 0; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2011-01-13 13:38:43 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | void Qt4BuildConfiguration::importFromBuildDirectory() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     QString directory = buildDirectory(); | 
					
						
							|  |  |  |     if (!directory.isEmpty()) { | 
					
						
							|  |  |  |         QString mkfile = directory; | 
					
						
							|  |  |  |         if (makefile().isEmpty()) | 
					
						
							| 
									
										
										
										
											2012-01-13 14:20:45 +01:00
										 |  |  |             mkfile.append(QLatin1String("/Makefile")); | 
					
						
							| 
									
										
										
										
											2011-01-13 13:38:43 +01:00
										 |  |  |         else | 
					
						
							|  |  |  |             mkfile.append(makefile()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |         Utils::FileName qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(mkfile); | 
					
						
							| 
									
										
										
										
											2011-01-13 13:38:43 +01:00
										 |  |  |         if (!qmakePath.isEmpty()) { | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |             QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance(); | 
					
						
							|  |  |  |             QtSupport::BaseQtVersion *version = vm->qtVersionForQMakeBinary(qmakePath); | 
					
						
							| 
									
										
										
										
											2011-01-13 13:38:43 +01:00
										 |  |  |             if (!version) { | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |                 version = QtSupport::QtVersionFactory::createQtVersionFromQMakePath(qmakePath); | 
					
						
							| 
									
										
										
										
											2011-01-13 13:38:43 +01:00
										 |  |  |                 vm->addVersion(version); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |             QPair<QtSupport::BaseQtVersion::QmakeBuildConfigs, QString> result = | 
					
						
							|  |  |  |                     QtSupport::QtVersionManager::scanMakeFile(mkfile, version->defaultBuildConfig()); | 
					
						
							|  |  |  |             QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfig = result.first; | 
					
						
							| 
									
										
										
										
											2011-01-13 13:38:43 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-01 15:03:44 +00:00
										 |  |  |             QString additionalArguments = result.second; | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |             Utils::FileName parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, directory, version); | 
					
						
							| 
									
										
										
										
											2011-09-01 16:16:59 +02:00
										 |  |  |             const bool enableQmlDebugger = | 
					
						
							|  |  |  |                     Qt4BuildConfiguration::removeQMLInspectorFromArguments(&additionalArguments); | 
					
						
							| 
									
										
										
										
											2011-01-13 13:38:43 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |             // So we got all the information now apply it...
 | 
					
						
							|  |  |  |             setQtVersion(version); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-01 15:03:44 +00:00
										 |  |  |             QMakeStep *qs = qmakeStep(); | 
					
						
							|  |  |  |             qs->setUserArguments(additionalArguments); | 
					
						
							| 
									
										
										
										
											2011-09-01 16:16:59 +02:00
										 |  |  |             qs->setLinkQmlDebuggingLibrary(enableQmlDebugger); | 
					
						
							| 
									
										
										
										
											2011-11-25 13:19:58 +01:00
										 |  |  |             if (!parsedSpec.isEmpty() && parsedSpec != Utils::FileName::fromString(QLatin1String("default")) && qs->mkspec() != parsedSpec) { | 
					
						
							|  |  |  |                 Utils::QtcProcess::addArgs(&additionalArguments, (QStringList() << QLatin1String("-spec") << parsedSpec.toUserOutput())); | 
					
						
							| 
									
										
										
										
											2011-06-01 15:03:44 +00:00
										 |  |  |                 qs->setUserArguments(additionalArguments); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2011-01-13 13:38:43 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |             setQMakeBuildConfiguration(qmakeBuildConfig); | 
					
						
							|  |  |  |             // Adjust command line arguments, this is ugly as hell
 | 
					
						
							|  |  |  |             // If we are switching to BuildAll we want "release" in there and no "debug"
 | 
					
						
							|  |  |  |             // or "debug" in there and no "release"
 | 
					
						
							| 
									
										
										
										
											2011-05-20 13:43:36 +02:00
										 |  |  |             // If we are switching to not BuildAll we want neither "release" nor "debug" in there
 | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |             bool debug = qmakeBuildConfig & QtSupport::BaseQtVersion::DebugBuild; | 
					
						
							|  |  |  |             bool haveTag = !(qmakeBuildConfig & QtSupport::BaseQtVersion::BuildAll); | 
					
						
							| 
									
										
										
										
											2011-01-13 13:38:43 +01:00
										 |  |  |             QString makeCmdArguments = makeStep()->userArguments(); | 
					
						
							|  |  |  |             Utils::QtcProcess::ArgIterator ait(&makeCmdArguments); | 
					
						
							|  |  |  |             while (ait.next()) { | 
					
						
							|  |  |  |                 if (ait.value() == QLatin1String("debug")) { | 
					
						
							|  |  |  |                     if (!haveTag && debug) | 
					
						
							|  |  |  |                         haveTag = true; | 
					
						
							|  |  |  |                     else | 
					
						
							|  |  |  |                         ait.deleteArg(); | 
					
						
							|  |  |  |                 } else if (ait.value() == QLatin1String("release")) { | 
					
						
							|  |  |  |                     if (!haveTag && !debug) | 
					
						
							|  |  |  |                         haveTag = true; | 
					
						
							|  |  |  |                     else | 
					
						
							|  |  |  |                         ait.deleteArg(); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             if (!haveTag) | 
					
						
							|  |  |  |                 ait.appendArg(QLatin1String(debug ? "debug" : "release")); | 
					
						
							|  |  |  |             makeStep()->setUserArguments(makeCmdArguments); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2011-03-03 16:12:00 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | BuildConfiguration::BuildType Qt4BuildConfiguration::buildType() const | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-05-20 21:40:53 +02:00
										 |  |  |     if (qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild) | 
					
						
							| 
									
										
										
										
											2011-03-03 16:12:00 +01:00
										 |  |  |         return Debug; | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |         return Release; | 
					
						
							|  |  |  | } |