forked from qt-creator/qt-creator
make command line parser grok more options
-spec/-platform, -xspec/-xplatform, -t/-template, -tp/-template_prefix, -cache & -nocache. Change-Id: I1a0aa6ce830bf4d4beed319ebe248b15b2dc72c0 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -942,12 +942,10 @@ QtSupport::ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4Pro
|
||||
if (bc) {
|
||||
p = bc->target()->profile();
|
||||
env = bc->environment();
|
||||
if (bc->qmakeStep()) {
|
||||
if (bc->qmakeStep())
|
||||
qmakeArgs = bc->qmakeStep()->parserArguments();
|
||||
m_qmakeGlobals->qmakespec = bc->qmakeStep()->mkspec().toString();
|
||||
} else {
|
||||
else
|
||||
qmakeArgs = bc->configCommandLineArguments();
|
||||
}
|
||||
} else {
|
||||
p = ProfileManager::instance()->defaultProfile();
|
||||
}
|
||||
|
@@ -109,10 +109,21 @@ QMakeGlobals::~QMakeGlobals()
|
||||
qDeleteAll(baseEnvs);
|
||||
}
|
||||
|
||||
QString QMakeGlobals::cleanSpec(QMakeCmdLineParserState &state, const QString &spec)
|
||||
{
|
||||
QString ret = QDir::cleanPath(spec);
|
||||
if (ret.contains(QLatin1Char('/'))) {
|
||||
QString absRet = QDir(state.pwd).absoluteFilePath(ret);
|
||||
if (QFile::exists(absRet))
|
||||
ret = QDir::cleanPath(absRet);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
|
||||
QMakeCmdLineParserState &state, QStringList &args, int *pos)
|
||||
{
|
||||
enum { ArgNone, ArgConfig } argState = ArgNone;
|
||||
enum { ArgNone, ArgConfig, ArgSpec, ArgXSpec, ArgTmpl, ArgTmplPfx, ArgCache } argState = ArgNone;
|
||||
for (; *pos < args.count(); (*pos)++) {
|
||||
QString arg = args.at(*pos);
|
||||
switch (argState) {
|
||||
@@ -122,12 +133,39 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
|
||||
else
|
||||
state.preconfigs << arg;
|
||||
break;
|
||||
case ArgSpec:
|
||||
qmakespec = args[*pos] = cleanSpec(state, arg);
|
||||
break;
|
||||
case ArgXSpec:
|
||||
xqmakespec = args[*pos] = cleanSpec(state, arg);
|
||||
break;
|
||||
case ArgTmpl:
|
||||
user_template = arg;
|
||||
break;
|
||||
case ArgTmplPfx:
|
||||
user_template_prefix = arg;
|
||||
break;
|
||||
case ArgCache:
|
||||
cachefile = args[*pos] = QDir::cleanPath(QDir(state.pwd).absoluteFilePath(arg));
|
||||
break;
|
||||
default:
|
||||
if (arg.startsWith(QLatin1Char('-'))) {
|
||||
if (arg == QLatin1String("-after")) {
|
||||
state.after = true;
|
||||
} else if (arg == QLatin1String("-config")) {
|
||||
argState = ArgConfig;
|
||||
} else if (arg == QLatin1String("-nocache")) {
|
||||
do_cache = false;
|
||||
} else if (arg == QLatin1String("-cache")) {
|
||||
argState = ArgCache;
|
||||
} else if (arg == QLatin1String("-platform") || arg == QLatin1String("-spec")) {
|
||||
argState = ArgSpec;
|
||||
} else if (arg == QLatin1String("-xplatform") || arg == QLatin1String("-xspec")) {
|
||||
argState = ArgXSpec;
|
||||
} else if (arg == QLatin1String("-template") || arg == QLatin1String("-t")) {
|
||||
argState = ArgTmpl;
|
||||
} else if (arg == QLatin1String("-template_prefix") || arg == QLatin1String("-tp")) {
|
||||
argState = ArgTmplPfx;
|
||||
} else if (arg == QLatin1String("-win32")) {
|
||||
dir_sep = QLatin1Char('\\');
|
||||
} else if (arg == QLatin1String("-unix")) {
|
||||
@@ -160,6 +198,9 @@ void QMakeGlobals::commitCommandLineArguments(QMakeCmdLineParserState &state)
|
||||
if (!state.postconfigs.isEmpty())
|
||||
state.postcmds << (fL1S("CONFIG += ") + state.postconfigs.join(fL1S(" ")));
|
||||
postcmds = state.postcmds.join(fL1S("\n"));
|
||||
|
||||
if (xqmakespec.isEmpty())
|
||||
xqmakespec = qmakespec;
|
||||
}
|
||||
|
||||
void QMakeGlobals::setCommandLineArguments(const QString &pwd, const QStringList &_args)
|
||||
|
@@ -95,15 +95,16 @@ public:
|
||||
bool do_cache;
|
||||
QString dir_sep;
|
||||
QString dirlist_sep;
|
||||
QString qmakespec;
|
||||
QString xqmakespec;
|
||||
QString cachefile;
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
QProcessEnvironment environment;
|
||||
#endif
|
||||
QString sysroot;
|
||||
QString qmake_abslocation;
|
||||
|
||||
QString qmakespec, xqmakespec;
|
||||
QString user_template, user_template_prefix;
|
||||
QString precmds, postcmds;
|
||||
|
||||
enum ArgumentReturn { ArgumentUnknown, ArgumentMalformed, ArgumentsOk };
|
||||
ArgumentReturn addCommandLineArguments(QMakeCmdLineParserState &state,
|
||||
@@ -124,9 +125,10 @@ private:
|
||||
QString getEnv(const QString &) const;
|
||||
QStringList getPathListEnv(const QString &var) const;
|
||||
|
||||
QString cleanSpec(QMakeCmdLineParserState &state, const QString &spec);
|
||||
|
||||
QString source_root, build_root;
|
||||
|
||||
QString precmds, postcmds;
|
||||
QHash<ProKey, ProString> properties;
|
||||
|
||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||
|
Reference in New Issue
Block a user