Commit 16436a25 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

move command line args from ProFileEvaluator to ProFileOption

parent 2e22ba59
......@@ -1466,15 +1466,6 @@ void Qt4ProFileNode::setupReader()
m_readerExact->setCumulative(false);
m_readerCumulative = m_project->createProFileReader(this);
// Find out what flags we pass on to qmake
QStringList args;
if (QMakeStep *qs = m_project->activeTarget()->activeBuildConfiguration()->qmakeStep())
args = qs->parserArguments();
else
args = m_project->activeTarget()->activeBuildConfiguration()->configCommandLineArguments();
m_readerExact->setCommandLineArguments(args);
m_readerCumulative->setCommandLineArguments(args);
}
Qt4ProFileNode::EvalResult Qt4ProFileNode::evaluate()
......
......@@ -898,6 +898,13 @@ ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4ProFileNode, Q
if (bc->toolChain())
m_proFileOption->sysroot = bc->qtVersion()->systemRoot();
}
QStringList args;
if (QMakeStep *qs = bc->qmakeStep())
args = qs->parserArguments();
else
args = bc->configCommandLineArguments();
m_proFileOption->setCommandLineArguments(args);
}
ProFileCacheManager::instance()->incRefCount();
......
......@@ -104,6 +104,24 @@ ProFileOption::~ProFileOption()
{
}
void ProFileOption::setCommandLineArguments(const QStringList &args)
{
cmdargs = args;
setHostTargetMode();
bool targetModeSet = false;
for (int i = args.count() - 1; !targetModeSet && i >= 0; --i) {
for (int j = 0; j < modeMapSize; ++j) {
const TargetModeMapElement &mapElem = modeMap[j];
if (args.at(i) == QLatin1String(mapElem.qmakeOption)) {
target_mode = mapElem.targetMode;
targetModeSet = true;
break;
}
}
}
}
void ProFileOption::setHostTargetMode()
{
#if defined(Q_OS_WIN32)
......@@ -242,8 +260,6 @@ public:
QHash<const ProFile*, QHash<ProString, ProStringList> > m_filevaluemap; // Variables per include file
QString m_tmp1, m_tmp2, m_tmp3, m_tmp[2]; // Temporaries for efficient toQString
QStringList m_cmdArgs;
ProFileOption *m_option;
ProFileParser *m_parser;
ProFileEvaluatorHandler *m_handler;
......@@ -1294,9 +1310,9 @@ ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProFile(
if (tgt.isEmpty())
tgt.append(ProString(QFileInfo(pro->fileName()).baseName(), NoHash));
if (!m_cmdArgs.isEmpty()) {
if (!m_option->cmdargs.isEmpty()) {
if (ProFile *pro = m_parser->parsedProBlock(
fL1S("(command line)"), m_cmdArgs.join(fL1S("\n")))) {
fL1S("(command line)"), m_option->cmdargs.join(fL1S("\n")))) {
m_locationStack.push(m_current);
visitProBlock(pro, pro->tokPtr());
m_current = m_locationStack.pop();
......@@ -3252,22 +3268,4 @@ void ProFileEvaluator::setOutputDir(const QString &dir)
d->m_outputDir = dir;
}
void ProFileEvaluator::setCommandLineArguments(const QStringList &args)
{
d->m_cmdArgs = args;
d->m_option->setHostTargetMode();
bool targetModeSet = false;
for (int i = args.count() - 1; !targetModeSet && i >= 0; --i) {
for (int j = 0; j < ProFileOption::modeMapSize; ++j) {
const ProFileOption::TargetModeMapElement &mapElem = ProFileOption::modeMap[j];
if (args.at(i) == QLatin1String(mapElem.qmakeOption)) {
d->m_option->target_mode = mapElem.targetMode;
targetModeSet = true;
break;
}
}
}
}
QT_END_NAMESPACE
......@@ -114,10 +114,6 @@ public:
void setCumulative(bool on); // Default is true!
void setOutputDir(const QString &dir); // Default is empty
// -nocache, -cache, -spec, QMAKESPEC
// -set persistent value
void setCommandLineArguments(const QStringList &args);
enum LoadFlag {
LoadProOnly = 0,
LoadPreFiles = 1,
......@@ -186,6 +182,10 @@ struct ProFileOption
} modeMap[];
static const int modeMapSize;
// -nocache, -cache, -spec, QMAKESPEC
// -set persistent value
void setCommandLineArguments(const QStringList &args);
private:
void setHostTargetMode();
......@@ -195,6 +195,7 @@ struct ProFileOption
ProFileEvaluator::FunctionDefs base_functions;
QStringList feature_roots;
QString qmakespec_name;
QStringList cmdargs;
#ifdef PROEVALUATOR_THREAD_SAFE
QMutex mutex;
QWaitCondition cond;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment