Commit 84ce2e5b authored by dt's avatar dt

Fixes: Add a makeCommand() virtual function to ToolChain

Details:  Move that code from qt4project to a common class.
parent bcdad219
......@@ -154,6 +154,11 @@ void GccToolChain::addToEnvironment(ProjectExplorer::Environment &env)
Q_UNUSED(env)
}
QString GccToolChain::makeCommand() const
{
return "make";
}
bool GccToolChain::equals(ToolChain *other) const
{
return (m_gcc == static_cast<GccToolChain *>(other)->m_gcc);
......@@ -186,6 +191,11 @@ void MinGWToolChain::addToEnvironment(ProjectExplorer::Environment &env)
// qDebug()<<"Adding "<<binDir<<" to the PATH";
}
QString MinGWToolChain::makeCommand() const
{
return "mingw32-make.exe";
}
MSVCToolChain::MSVCToolChain(const QString &name)
: m_name(name), m_valuesSet(false)
......@@ -293,6 +303,11 @@ void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
}
QString MSVCToolChain::makeCommand() const
{
return "nmake.exe";
}
WinCEToolChain::WinCEToolChain(const QString &name, const QString &platform)
: MSVCToolChain(name), m_platform(platform)
{
......
......@@ -52,11 +52,13 @@ public:
virtual QList<HeaderPath> systemHeaderPaths() = 0;
virtual void addToEnvironment(ProjectExplorer::Environment &env) = 0;
virtual ToolChainType type() const = 0;
virtual QString makeCommand() const = 0;
ToolChain();
virtual ~ToolChain();
static bool equals(ToolChain *, ToolChain *);
// Factory methods
static ToolChain *createGccToolChain(const QString &gcc);
static ToolChain *createMinGWToolChain(const QString &gcc, const QString &mingwPath);
static ToolChain *createMSVCToolChain(const QString &name);
......@@ -77,6 +79,7 @@ public:
virtual QList<HeaderPath> systemHeaderPaths();
virtual void addToEnvironment(ProjectExplorer::Environment &env);
virtual ToolChainType type() const;
virtual QString makeCommand() const;
protected:
virtual bool equals(ToolChain *other) const;
......@@ -93,6 +96,7 @@ public:
MinGWToolChain(const QString &gcc, const QString &mingwPath);
virtual void addToEnvironment(ProjectExplorer::Environment &env);
virtual ToolChainType type() const;
virtual QString makeCommand() const;
protected:
virtual bool equals(ToolChain *other) const;
private:
......@@ -108,6 +112,7 @@ public:
virtual QList<HeaderPath> systemHeaderPaths();
virtual void addToEnvironment(ProjectExplorer::Environment &env);
virtual ToolChainType type() const;
virtual QString makeCommand() const;
protected:
virtual bool equals(ToolChain *other) const;
QString m_name;
......
......@@ -127,7 +127,7 @@ void GdbMacrosBuildStep::run(QFutureInterface<bool> & fi)
qmake.start(m_qmake, QStringList()<<"-spec"<<mkspec<<configarguments<<"gdbmacros.pro");
qmake.waitForFinished();
QString makeCmd = qt4Project->qtVersion(m_buildConfiguration)->makeCommand();
QString makeCmd = qt4Project->makeCommand(m_buildConfiguration);
if (!value(m_buildConfiguration, "makeCmd").toString().isEmpty())
makeCmd = value(m_buildConfiguration, "makeCmd").toString();
if (!QFileInfo(makeCmd).isAbsolute()) {
......@@ -147,7 +147,7 @@ void GdbMacrosBuildStep::run(QFutureInterface<bool> & fi)
QProcess make;
make.setEnvironment(qt4Project->environment(m_buildConfiguration).toStringList());
make.setWorkingDirectory(destDir);
make.start(qt4Project->qtVersion(m_buildConfiguration)->makeCommand(), QStringList()<<"distclean");
make.start(qt4Project->makeCommand(m_buildConfiguration), QStringList()<<"distclean");
make.waitForFinished();
QStringList directories;
......
......@@ -95,8 +95,7 @@ bool MakeStep::init(const QString &name)
workingDirectory = QFileInfo(project()->file()->fileName()).absolutePath();
setWorkingDirectory(name, workingDirectory);
//NBS only dependency on Qt4Project, we probably simply need a MakeProject from which Qt4Project derives
QString makeCmd = qobject_cast<Qt4Project *>(project())->qtVersion(name)->makeCommand();
QString makeCmd = qobject_cast<Qt4Project *>(project())->makeCommand(name);
if (!value(name, "makeCmd").toString().isEmpty())
makeCmd = value(name, "makeCmd").toString();
if (!QFileInfo(makeCmd).isAbsolute()) {
......@@ -293,7 +292,7 @@ void MakeStepConfigWidget::init(const QString &buildConfiguration)
if (!showPage0) {
Qt4Project *pro = qobject_cast<Qt4Project *>(m_makeStep->project());
Q_ASSERT(pro);
m_ui.makeLabel->setText(tr("Override %1:").arg(pro->qtVersion(buildConfiguration)->makeCommand()));
m_ui.makeLabel->setText(tr("Override %1:").arg(pro->makeCommand(buildConfiguration)));
const QString &makeCmd = m_makeStep->value(buildConfiguration, "makeCmd").toString();
m_ui.makeLineEdit->setText(makeCmd);
......
......@@ -401,6 +401,11 @@ void Qt4Project::scheduleUpdateCodeModel()
m_updateCodeModelTimer.start();
}
QString Qt4Project::makeCommand(const QString &buildConfiguration) const
{
return toolChain(buildConfiguration)->makeCommand();
}
ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfiguration) const
{
if (debug)
......@@ -416,7 +421,7 @@ ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfigurat
qtVersion(activeBuildConfiguration())->addToEnvironment(env);
qmake_cxx = env.searchInPath(qmake_cxx);
m_test = ToolChain::createMinGWToolChain(qmake_cxx, version->mingwDirectory());
qDebug()<<"Mingw ToolChain";
//qDebug()<<"Mingw ToolChain";
} else if(t == ToolChain::MSVC) {
m_test = ToolChain::createMSVCToolChain(version->msvcVersion());
//qDebug()<<"MSVC ToolChain ("<<version->msvcVersion()<<")";
......
......@@ -181,6 +181,8 @@ public:
// called by qt4ProjectNode to add ui_*.h files to the codemodel
void addUiFilesToCodeModel(const QStringList &files);
QString makeCommand(const QString &buildConfiguration) const;
public slots:
void update();
void proFileParseError(const QString &errorMessage);
......
......@@ -1143,21 +1143,6 @@ void QtVersion::updateMkSpec() const
// qDebug()<<"mkspec for "<<m_path<<" is "<<mkspec;
}
QString QtVersion::makeCommand() const
{
#ifdef Q_OS_WIN
const QString &spec = mkspec();
if (spec.contains("win32-msvc") || spec.contains(QLatin1String("win32-icc")))
return "nmake.exe";
else if (spec.startsWith("wince"))
return "nmake.exe";
else
return "mingw32-make.exe";
#else
return "make";
#endif
}
QString QtVersion::qmakeCommand() const
{
// We can't use versionInfo QT_INSTALL_BINS here
......
......@@ -64,7 +64,6 @@ public:
QString sourcePath() const;
QString mkspec() const;
QString mkspecPath() const;
QString makeCommand() const;
QString qmakeCommand() const;
QString qtVersionString() const;
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
......
Markdown is supported
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