forked from qt-creator/qt-creator
revamp target mode handling
follow suit with qmake ... Change-Id: Id734e20556925cec5bf8c70d55974eb4a783f49d Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "profileevaluator.h"
|
#include "profileevaluator.h"
|
||||||
|
|
||||||
|
#include "qmakeglobals.h"
|
||||||
#include "ioutils.h"
|
#include "ioutils.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|||||||
@@ -83,11 +83,6 @@ void QMakeEvaluator::initStatics()
|
|||||||
statics.field_sep = QLatin1String(" ");
|
statics.field_sep = QLatin1String(" ");
|
||||||
statics.strtrue = QLatin1String("true");
|
statics.strtrue = QLatin1String("true");
|
||||||
statics.strfalse = QLatin1String("false");
|
statics.strfalse = QLatin1String("false");
|
||||||
statics.strunix = QLatin1String("unix");
|
|
||||||
statics.strmacx = QLatin1String("macx");
|
|
||||||
statics.strmac = QLatin1String("mac");
|
|
||||||
statics.strwin32 = QLatin1String("win32");
|
|
||||||
statics.strsymbian = QLatin1String("symbian");
|
|
||||||
statics.strCONFIG = ProString("CONFIG");
|
statics.strCONFIG = ProString("CONFIG");
|
||||||
statics.strARGS = ProString("ARGS");
|
statics.strARGS = ProString("ARGS");
|
||||||
statics.strDot = QLatin1String(".");
|
statics.strDot = QLatin1String(".");
|
||||||
@@ -905,6 +900,8 @@ bool QMakeEvaluator::loadSpec()
|
|||||||
m_option->qmakespec_name = IoUtils::fileName(real_spec).toString();
|
m_option->qmakespec_name = IoUtils::fileName(real_spec).toString();
|
||||||
if (!evaluateFeatureFile(QLatin1String("spec_post.prf")))
|
if (!evaluateFeatureFile(QLatin1String("spec_post.prf")))
|
||||||
return false;
|
return false;
|
||||||
|
// The spec extends the feature search path, so invalidate the cache.
|
||||||
|
m_option->feature_roots.clear();
|
||||||
if (!m_option->cachefile.isEmpty()
|
if (!m_option->cachefile.isEmpty()
|
||||||
&& !evaluateFileDirect(m_option->cachefile, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
&& !evaluateFileDirect(m_option->cachefile, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1037,25 +1034,8 @@ QStringList QMakeEvaluator::qmakeFeaturePaths() const
|
|||||||
QString mkspecs_concat = QLatin1String("/mkspecs");
|
QString mkspecs_concat = QLatin1String("/mkspecs");
|
||||||
QString features_concat = QLatin1String("/features");
|
QString features_concat = QLatin1String("/features");
|
||||||
QStringList concat;
|
QStringList concat;
|
||||||
|
foreach (const ProString &sfx, values(ProString("QMAKE_PLATFORM")))
|
||||||
validateModes();
|
concat << features_concat + QLatin1Char('/') + sfx;
|
||||||
switch (m_option->target_mode) {
|
|
||||||
case QMakeGlobals::TARG_MACX_MODE:
|
|
||||||
concat << QLatin1String("/features/mac");
|
|
||||||
concat << QLatin1String("/features/macx");
|
|
||||||
concat << QLatin1String("/features/unix");
|
|
||||||
break;
|
|
||||||
default: // Can't happen, just make the compiler shut up
|
|
||||||
case QMakeGlobals::TARG_UNIX_MODE:
|
|
||||||
concat << QLatin1String("/features/unix");
|
|
||||||
break;
|
|
||||||
case QMakeGlobals::TARG_WIN_MODE:
|
|
||||||
concat << QLatin1String("/features/win32");
|
|
||||||
break;
|
|
||||||
case QMakeGlobals::TARG_SYMBIAN_MODE:
|
|
||||||
concat << QLatin1String("/features/symbian");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
concat << features_concat;
|
concat << features_concat;
|
||||||
|
|
||||||
QStringList feature_roots;
|
QStringList feature_roots;
|
||||||
@@ -1411,60 +1391,6 @@ ProStringList QMakeEvaluator::expandVariableReferences(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QMakeEvaluator::modesForGenerator(const QString &gen,
|
|
||||||
QMakeGlobals::TARG_MODE *target_mode) const
|
|
||||||
{
|
|
||||||
if (gen == fL1S("UNIX")) {
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
*target_mode = QMakeGlobals::TARG_MACX_MODE;
|
|
||||||
#else
|
|
||||||
*target_mode = QMakeGlobals::TARG_UNIX_MODE;
|
|
||||||
#endif
|
|
||||||
} else if (gen == fL1S("MSVC.NET") || gen == fL1S("BMAKE") || gen == fL1S("MSBUILD")) {
|
|
||||||
*target_mode = QMakeGlobals::TARG_WIN_MODE;
|
|
||||||
} else if (gen == fL1S("MINGW")) {
|
|
||||||
*target_mode = QMakeGlobals::TARG_WIN_MODE;
|
|
||||||
} else if (gen == fL1S("PROJECTBUILDER") || gen == fL1S("XCODE")) {
|
|
||||||
*target_mode = QMakeGlobals::TARG_MACX_MODE;
|
|
||||||
} else if (gen == fL1S("SYMBIAN_ABLD") || gen == fL1S("SYMBIAN_SBSV2")
|
|
||||||
|| gen == fL1S("SYMBIAN_UNIX") || gen == fL1S("SYMBIAN_MINGW")) {
|
|
||||||
*target_mode = QMakeGlobals::TARG_SYMBIAN_MODE;
|
|
||||||
} else {
|
|
||||||
evalError(fL1S("Unknown generator specified: %1").arg(gen));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QMakeEvaluator::validateModes() const
|
|
||||||
{
|
|
||||||
if (m_option->target_mode == QMakeGlobals::TARG_UNKNOWN_MODE) {
|
|
||||||
const ProValueMap &vals = m_valuemapStack[0];
|
|
||||||
QMakeGlobals::TARG_MODE target_mode;
|
|
||||||
const ProStringList &gen = vals.value(ProString("MAKEFILE_GENERATOR"));
|
|
||||||
if (gen.isEmpty()) {
|
|
||||||
evalError(fL1S("Using OS scope before setting MAKEFILE_GENERATOR"));
|
|
||||||
} else if (modesForGenerator(gen.at(0).toQString(), &target_mode)) {
|
|
||||||
const ProStringList &tgt = vals.value(ProString("TARGET_PLATFORM"));
|
|
||||||
if (!tgt.isEmpty()) {
|
|
||||||
const QString &os = tgt.at(0).toQString();
|
|
||||||
if (os == statics.strunix)
|
|
||||||
m_option->target_mode = QMakeGlobals::TARG_UNIX_MODE;
|
|
||||||
else if (os == statics.strmacx)
|
|
||||||
m_option->target_mode = QMakeGlobals::TARG_MACX_MODE;
|
|
||||||
else if (os == statics.strsymbian)
|
|
||||||
m_option->target_mode = QMakeGlobals::TARG_SYMBIAN_MODE;
|
|
||||||
else if (os == statics.strwin32)
|
|
||||||
m_option->target_mode = QMakeGlobals::TARG_WIN_MODE;
|
|
||||||
else
|
|
||||||
evalError(fL1S("Unknown target platform specified: %1").arg(os));
|
|
||||||
} else {
|
|
||||||
m_option->target_mode = target_mode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QMakeEvaluator::isActiveConfig(const QString &config, bool regex)
|
bool QMakeEvaluator::isActiveConfig(const QString &config, bool regex)
|
||||||
{
|
{
|
||||||
// magic types for easy flipping
|
// magic types for easy flipping
|
||||||
@@ -1473,22 +1399,6 @@ bool QMakeEvaluator::isActiveConfig(const QString &config, bool regex)
|
|||||||
if (config == statics.strfalse)
|
if (config == statics.strfalse)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (config == statics.strunix) {
|
|
||||||
validateModes();
|
|
||||||
return m_option->target_mode == QMakeGlobals::TARG_UNIX_MODE
|
|
||||||
|| m_option->target_mode == QMakeGlobals::TARG_MACX_MODE
|
|
||||||
|| m_option->target_mode == QMakeGlobals::TARG_SYMBIAN_MODE;
|
|
||||||
} else if (config == statics.strmacx || config == statics.strmac) {
|
|
||||||
validateModes();
|
|
||||||
return m_option->target_mode == QMakeGlobals::TARG_MACX_MODE;
|
|
||||||
} else if (config == statics.strsymbian) {
|
|
||||||
validateModes();
|
|
||||||
return m_option->target_mode == QMakeGlobals::TARG_SYMBIAN_MODE;
|
|
||||||
} else if (config == statics.strwin32) {
|
|
||||||
validateModes();
|
|
||||||
return m_option->target_mode == QMakeGlobals::TARG_WIN_MODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (regex && (config.contains(QLatin1Char('*')) || config.contains(QLatin1Char('?')))) {
|
if (regex && (config.contains(QLatin1Char('*')) || config.contains(QLatin1Char('?')))) {
|
||||||
QString cfg = config;
|
QString cfg = config;
|
||||||
cfg.detach(); // Keep m_tmp out of QRegExp's cache
|
cfg.detach(); // Keep m_tmp out of QRegExp's cache
|
||||||
@@ -1741,7 +1651,6 @@ ProStringList QMakeEvaluator::values(const ProString &variableName) const
|
|||||||
ret = currentDirectory();
|
ret = currentDirectory();
|
||||||
break;
|
break;
|
||||||
case V_DIR_SEPARATOR:
|
case V_DIR_SEPARATOR:
|
||||||
validateModes();
|
|
||||||
ret = m_option->dir_sep;
|
ret = m_option->dir_sep;
|
||||||
break;
|
break;
|
||||||
case V_DIRLIST_SEPARATOR:
|
case V_DIRLIST_SEPARATOR:
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
#define QMAKEEVALUATOR_H
|
#define QMAKEEVALUATOR_H
|
||||||
|
|
||||||
#include "qmakeparser.h"
|
#include "qmakeparser.h"
|
||||||
#include "qmakeglobals.h"
|
|
||||||
#include "ioutils.h"
|
#include "ioutils.h"
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@@ -42,9 +41,14 @@
|
|||||||
#include <QStack>
|
#include <QStack>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#ifndef QT_BOOTSTRAPPED
|
||||||
|
# include <QProcess>
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class QMakeGlobals;
|
||||||
|
|
||||||
class QMAKE_EXPORT QMakeHandler : public QMakeParserHandler
|
class QMAKE_EXPORT QMakeHandler : public QMakeParserHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -154,8 +158,6 @@ public:
|
|||||||
VisitReturn evaluateConditionalFunction(const ProString &function, const ushort *&tokPtr);
|
VisitReturn evaluateConditionalFunction(const ProString &function, const ushort *&tokPtr);
|
||||||
VisitReturn evaluateConditionalFunction(const ProString &function, const ProStringList &args);
|
VisitReturn evaluateConditionalFunction(const ProString &function, const ProStringList &args);
|
||||||
|
|
||||||
bool modesForGenerator(const QString &gen, QMakeGlobals::TARG_MODE *target_mode) const;
|
|
||||||
void validateModes() const;
|
|
||||||
QStringList qmakeMkspecPaths() const;
|
QStringList qmakeMkspecPaths() const;
|
||||||
QStringList qmakeFeaturePaths() const;
|
QStringList qmakeFeaturePaths() const;
|
||||||
|
|
||||||
|
|||||||
@@ -45,11 +45,6 @@ struct QMakeStatics {
|
|||||||
QString field_sep;
|
QString field_sep;
|
||||||
QString strtrue;
|
QString strtrue;
|
||||||
QString strfalse;
|
QString strfalse;
|
||||||
QString strunix;
|
|
||||||
QString strmacx;
|
|
||||||
QString strmac;
|
|
||||||
QString strwin32;
|
|
||||||
QString strsymbian;
|
|
||||||
ProString strCONFIG;
|
ProString strCONFIG;
|
||||||
ProString strARGS;
|
ProString strARGS;
|
||||||
QString strDot;
|
QString strDot;
|
||||||
|
|||||||
@@ -105,8 +105,6 @@ QMakeGlobals::QMakeGlobals()
|
|||||||
#endif
|
#endif
|
||||||
qmakespec = getEnv(QLatin1String("QMAKESPEC"));
|
qmakespec = getEnv(QLatin1String("QMAKESPEC"));
|
||||||
|
|
||||||
target_mode = TARG_UNKNOWN_MODE;
|
|
||||||
|
|
||||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||||
base_inProgress = false;
|
base_inProgress = false;
|
||||||
#endif
|
#endif
|
||||||
@@ -138,13 +136,8 @@ void QMakeGlobals::setCommandLineArguments(const QStringList &args)
|
|||||||
isConf = true;
|
isConf = true;
|
||||||
} else if (arg == QLatin1String("-win32")) {
|
} else if (arg == QLatin1String("-win32")) {
|
||||||
dir_sep = QLatin1Char('\\');
|
dir_sep = QLatin1Char('\\');
|
||||||
target_mode = TARG_WIN_MODE;
|
|
||||||
} else if (arg == QLatin1String("-unix")) {
|
} else if (arg == QLatin1String("-unix")) {
|
||||||
dir_sep = QLatin1Char('/');
|
dir_sep = QLatin1Char('/');
|
||||||
target_mode = TARG_UNIX_MODE;
|
|
||||||
} else if (arg == QLatin1String("-macx")) {
|
|
||||||
dir_sep = QLatin1Char('/');
|
|
||||||
target_mode = TARG_MACX_MODE;
|
|
||||||
}
|
}
|
||||||
} else if (arg.contains(QLatin1Char('='))) {
|
} else if (arg.contains(QLatin1Char('='))) {
|
||||||
if (after)
|
if (after)
|
||||||
|
|||||||
@@ -83,9 +83,6 @@ private:
|
|||||||
QStringList feature_roots;
|
QStringList feature_roots;
|
||||||
QString qmakespec_name;
|
QString qmakespec_name;
|
||||||
QString precmds, postcmds;
|
QString precmds, postcmds;
|
||||||
enum TARG_MODE { TARG_UNKNOWN_MODE, TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE,
|
|
||||||
TARG_SYMBIAN_MODE };
|
|
||||||
TARG_MODE target_mode;
|
|
||||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||||
QMutex mutex;
|
QMutex mutex;
|
||||||
QWaitCondition cond;
|
QWaitCondition cond;
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
isEmpty(MAKEFILE_GENERATOR):error("Qmake spec does not set MAKEFILE_GENERATOR.")
|
||||||
|
isEmpty(QMAKE_PLATFORM) {
|
||||||
|
isEmpty(TARGET_PLATFORM) {
|
||||||
|
equals(MAKEFILE_GENERATOR, UNIX) {
|
||||||
|
equals(QMAKE_HOST.os, Darwin): \
|
||||||
|
TARGET_PLATFORM = macx
|
||||||
|
else: \
|
||||||
|
TARGET_PLATFORM = unix
|
||||||
|
} else:if(equals(MAKEFILE_GENERATOR, MSVC.NET) \
|
||||||
|
|equals(MAKEFILE_GENERATOR, BMAKE) \
|
||||||
|
|equals(MAKEFILE_GENERATOR, MSBUILD) \
|
||||||
|
|equals(MAKEFILE_GENERATOR, MINGW)) {
|
||||||
|
TARGET_PLATFORM = win32
|
||||||
|
} else:if(equals(MAKEFILE_GENERATOR, PROJECTBUILDER) \
|
||||||
|
|equals(MAKEFILE_GENERATOR, XCODE)) {
|
||||||
|
} else:equals(MAKEFILE_GENERATOR, GBUILD) {
|
||||||
|
TARGET_PLATFORM = unix
|
||||||
|
} else:if(equals(MAKEFILE_GENERATOR, SYMBIAN_ABLD) \
|
||||||
|
|equals(MAKEFILE_GENERATOR, SYMBIAN_SBSV2) \
|
||||||
|
|equals(MAKEFILE_GENERATOR, SYMBIAN_UNIX) \
|
||||||
|
|equals(MAKEFILE_GENERATOR, SYMBIAN_MINGW)) {
|
||||||
|
TARGET_PLATFORM = symbian
|
||||||
|
} else {
|
||||||
|
error("Qmake spec sets an invalid MAKEFILE_GENERATOR.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
equals(TARGET_PLATFORM, unix): \
|
||||||
|
QMAKE_PLATFORM = unix
|
||||||
|
else:equals(TARGET_PLATFORM, macx): \
|
||||||
|
QMAKE_PLATFORM = mac macx unix
|
||||||
|
else:equals(TARGET_PLATFORM, win32): \
|
||||||
|
QMAKE_PLATFORM = win32
|
||||||
|
else:equals(TARGET_PLATFORM, symbian): \
|
||||||
|
QMAKE_PLATFORM = symbian unix
|
||||||
|
else: \
|
||||||
|
error("Qmake spec sets an invalid TARGET_PLATFORM.")
|
||||||
|
}
|
||||||
|
CONFIG += $$QMAKE_PLATFORM
|
||||||
|
|||||||
Reference in New Issue
Block a user