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) {
|
if (bc) {
|
||||||
p = bc->target()->profile();
|
p = bc->target()->profile();
|
||||||
env = bc->environment();
|
env = bc->environment();
|
||||||
if (bc->qmakeStep()) {
|
if (bc->qmakeStep())
|
||||||
qmakeArgs = bc->qmakeStep()->parserArguments();
|
qmakeArgs = bc->qmakeStep()->parserArguments();
|
||||||
m_qmakeGlobals->qmakespec = bc->qmakeStep()->mkspec().toString();
|
else
|
||||||
} else {
|
|
||||||
qmakeArgs = bc->configCommandLineArguments();
|
qmakeArgs = bc->configCommandLineArguments();
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
p = ProfileManager::instance()->defaultProfile();
|
p = ProfileManager::instance()->defaultProfile();
|
||||||
}
|
}
|
||||||
|
@@ -109,10 +109,21 @@ QMakeGlobals::~QMakeGlobals()
|
|||||||
qDeleteAll(baseEnvs);
|
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(
|
QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
|
||||||
QMakeCmdLineParserState &state, QStringList &args, int *pos)
|
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)++) {
|
for (; *pos < args.count(); (*pos)++) {
|
||||||
QString arg = args.at(*pos);
|
QString arg = args.at(*pos);
|
||||||
switch (argState) {
|
switch (argState) {
|
||||||
@@ -122,12 +133,39 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
|
|||||||
else
|
else
|
||||||
state.preconfigs << arg;
|
state.preconfigs << arg;
|
||||||
break;
|
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:
|
default:
|
||||||
if (arg.startsWith(QLatin1Char('-'))) {
|
if (arg.startsWith(QLatin1Char('-'))) {
|
||||||
if (arg == QLatin1String("-after")) {
|
if (arg == QLatin1String("-after")) {
|
||||||
state.after = true;
|
state.after = true;
|
||||||
} else if (arg == QLatin1String("-config")) {
|
} else if (arg == QLatin1String("-config")) {
|
||||||
argState = ArgConfig;
|
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")) {
|
} else if (arg == QLatin1String("-win32")) {
|
||||||
dir_sep = QLatin1Char('\\');
|
dir_sep = QLatin1Char('\\');
|
||||||
} else if (arg == QLatin1String("-unix")) {
|
} else if (arg == QLatin1String("-unix")) {
|
||||||
@@ -160,6 +198,9 @@ void QMakeGlobals::commitCommandLineArguments(QMakeCmdLineParserState &state)
|
|||||||
if (!state.postconfigs.isEmpty())
|
if (!state.postconfigs.isEmpty())
|
||||||
state.postcmds << (fL1S("CONFIG += ") + state.postconfigs.join(fL1S(" ")));
|
state.postcmds << (fL1S("CONFIG += ") + state.postconfigs.join(fL1S(" ")));
|
||||||
postcmds = state.postcmds.join(fL1S("\n"));
|
postcmds = state.postcmds.join(fL1S("\n"));
|
||||||
|
|
||||||
|
if (xqmakespec.isEmpty())
|
||||||
|
xqmakespec = qmakespec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMakeGlobals::setCommandLineArguments(const QString &pwd, const QStringList &_args)
|
void QMakeGlobals::setCommandLineArguments(const QString &pwd, const QStringList &_args)
|
||||||
|
@@ -95,15 +95,16 @@ public:
|
|||||||
bool do_cache;
|
bool do_cache;
|
||||||
QString dir_sep;
|
QString dir_sep;
|
||||||
QString dirlist_sep;
|
QString dirlist_sep;
|
||||||
QString qmakespec;
|
|
||||||
QString xqmakespec;
|
|
||||||
QString cachefile;
|
QString cachefile;
|
||||||
#ifndef QT_BOOTSTRAPPED
|
#ifndef QT_BOOTSTRAPPED
|
||||||
QProcessEnvironment environment;
|
QProcessEnvironment environment;
|
||||||
#endif
|
#endif
|
||||||
QString sysroot;
|
QString sysroot;
|
||||||
QString qmake_abslocation;
|
QString qmake_abslocation;
|
||||||
|
|
||||||
|
QString qmakespec, xqmakespec;
|
||||||
QString user_template, user_template_prefix;
|
QString user_template, user_template_prefix;
|
||||||
|
QString precmds, postcmds;
|
||||||
|
|
||||||
enum ArgumentReturn { ArgumentUnknown, ArgumentMalformed, ArgumentsOk };
|
enum ArgumentReturn { ArgumentUnknown, ArgumentMalformed, ArgumentsOk };
|
||||||
ArgumentReturn addCommandLineArguments(QMakeCmdLineParserState &state,
|
ArgumentReturn addCommandLineArguments(QMakeCmdLineParserState &state,
|
||||||
@@ -124,9 +125,10 @@ private:
|
|||||||
QString getEnv(const QString &) const;
|
QString getEnv(const QString &) const;
|
||||||
QStringList getPathListEnv(const QString &var) const;
|
QStringList getPathListEnv(const QString &var) const;
|
||||||
|
|
||||||
|
QString cleanSpec(QMakeCmdLineParserState &state, const QString &spec);
|
||||||
|
|
||||||
QString source_root, build_root;
|
QString source_root, build_root;
|
||||||
|
|
||||||
QString precmds, postcmds;
|
|
||||||
QHash<ProKey, ProString> properties;
|
QHash<ProKey, ProString> properties;
|
||||||
|
|
||||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||||
|
Reference in New Issue
Block a user