Commit a3a7c27d authored by con's avatar con
Browse files

Make QtVersion's toolchain variable.

QtVersion provides possible toolchains that can be used by the
Qt version, e.g. winscw, gcce and armv5 for symbian-abld.
parent 7bec2253
...@@ -101,7 +101,7 @@ bool MakeStep::init(const QString &name) ...@@ -101,7 +101,7 @@ bool MakeStep::init(const QString &name)
// FIXME doing this without the user having a way to override this is rather bad // FIXME doing this without the user having a way to override this is rather bad
// so we only do it for unix and if the user didn't override the make command // so we only do it for unix and if the user didn't override the make command
// but for now this is the least invasive change // but for now this is the least invasive change
ProjectExplorer::ToolChain::ToolChainType t = qobject_cast<Qt4Project *>(project())->qtVersion(name)->toolchainType(); ProjectExplorer::ToolChain::ToolChainType t = qobject_cast<Qt4Project *>(project())->toolChain(name)->type();
if (t != ProjectExplorer::ToolChain::MSVC && t != ProjectExplorer::ToolChain::WINCE) { if (t != ProjectExplorer::ToolChain::MSVC && t != ProjectExplorer::ToolChain::WINCE) {
if (value(name, "makeCmd").toString().isEmpty()) if (value(name, "makeCmd").toString().isEmpty())
args << "-w"; args << "-w";
...@@ -110,7 +110,7 @@ bool MakeStep::init(const QString &name) ...@@ -110,7 +110,7 @@ bool MakeStep::init(const QString &name)
setEnabled(name, !skipMakeClean); setEnabled(name, !skipMakeClean);
setArguments(name, args); setArguments(name, args);
ProjectExplorer::ToolChain::ToolChainType type = qobject_cast<Qt4Project *>(project())->qtVersion(name)->toolchainType(); ProjectExplorer::ToolChain::ToolChainType type = qobject_cast<Qt4Project *>(project())->toolChain(name)->type();
if ( type == ProjectExplorer::ToolChain::MSVC || type == ProjectExplorer::ToolChain::WINCE) if ( type == ProjectExplorer::ToolChain::MSVC || type == ProjectExplorer::ToolChain::WINCE)
setBuildParser(ProjectExplorer::Constants::BUILD_PARSER_MSVC); setBuildParser(ProjectExplorer::Constants::BUILD_PARSER_MSVC);
else else
......
...@@ -6,7 +6,12 @@ ...@@ -6,7 +6,12 @@
* support the different tool chains * support the different tool chains
* gui for overriding the default make target if necessary, * gui for overriding the default make target if necessary,
make arguments --> make options make arguments --> make options
* more general "debug / release" configuration to be used in toolchain * more general "debug / release" configuration to be used in toolchain???
* tool chain instance should move to qt4project again, qt version defines
the possible tool chains, and possibly the tool chain creation, but not
the currently used one; we can probably get rid of the project parameter
of ToolChain::defaultMakeTarget then as well
* build parser should be defined/created by toolchain, not make step
* WINSCW tool chain: * WINSCW tool chain:
* predefined macros * predefined macros
...@@ -17,3 +22,4 @@ ...@@ -17,3 +22,4 @@
* system includes * system includes
* Run WINSCW executables * Run WINSCW executables
* Deploy gcce executables
...@@ -375,14 +375,19 @@ void Qt4Project::scheduleUpdateCodeModel(Qt4ProjectManager::Internal::Qt4ProFile ...@@ -375,14 +375,19 @@ void Qt4Project::scheduleUpdateCodeModel(Qt4ProjectManager::Internal::Qt4ProFile
m_proFilesForCodeModelUpdate.append(pro); m_proFilesForCodeModelUpdate.append(pro);
} }
ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfiguration) const
{
return qtVersion(buildConfiguration)->toolChain(qtVersion(buildConfiguration)->defaultToolchainType());
}
QString Qt4Project::makeCommand(const QString &buildConfiguration) const QString Qt4Project::makeCommand(const QString &buildConfiguration) const
{ {
return qtVersion(buildConfiguration)->toolChain()->makeCommand(); return toolChain(buildConfiguration)->makeCommand();
} }
QString Qt4Project::defaultMakeTarget(const QString &buildConfiguration) const QString Qt4Project::defaultMakeTarget(const QString &buildConfiguration) const
{ {
return qtVersion(buildConfiguration)->toolChain()->defaultMakeTarget(this); return toolChain(buildConfiguration)->defaultMakeTarget(this);
} }
void Qt4Project::updateCodeModel() void Qt4Project::updateCodeModel()
...@@ -401,7 +406,7 @@ void Qt4Project::updateCodeModel() ...@@ -401,7 +406,7 @@ void Qt4Project::updateCodeModel()
QStringList predefinedFrameworkPaths; QStringList predefinedFrameworkPaths;
QByteArray predefinedMacros; QByteArray predefinedMacros;
ToolChain *tc = qtVersion(activeBuildConfiguration())->toolChain(); ToolChain *tc = toolChain(activeBuildConfiguration());
QList<HeaderPath> allHeaderPaths; QList<HeaderPath> allHeaderPaths;
if (tc) { if (tc) {
predefinedMacros = tc->predefinedMacros(); predefinedMacros = tc->predefinedMacros();
......
...@@ -162,6 +162,7 @@ public: ...@@ -162,6 +162,7 @@ public:
//returns the name of the qt version, might be QString::Null, which means default qt version //returns the name of the qt version, might be QString::Null, which means default qt version
// qtVersion is in general the better method to use // qtVersion is in general the better method to use
QString qtVersionName(const QString &buildConfiguration) const; QString qtVersionName(const QString &buildConfiguration) const;
ProjectExplorer::ToolChain *toolChain(const QString &buildConfiguration) const;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
QList<ProjectExplorer::BuildStepConfigWidget*> subConfigWidgets(); QList<ProjectExplorer::BuildStepConfigWidget*> subConfigWidgets();
......
...@@ -638,7 +638,7 @@ Qt4RunConfiguration::BaseEnvironmentBase Qt4RunConfiguration::baseEnvironmentBas ...@@ -638,7 +638,7 @@ Qt4RunConfiguration::BaseEnvironmentBase Qt4RunConfiguration::baseEnvironmentBas
ProjectExplorer::ToolChain::ToolChainType Qt4RunConfiguration::toolChainType() const ProjectExplorer::ToolChain::ToolChainType Qt4RunConfiguration::toolChainType() const
{ {
Qt4Project *pro = qobject_cast<Qt4Project *>(project()); Qt4Project *pro = qobject_cast<Qt4Project *>(project());
return pro->qtVersion(pro->activeBuildConfiguration())->toolchainType(); return pro->toolChainType(pro->activeBuildConfiguration());
} }
/// ///
......
...@@ -301,7 +301,7 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item) ...@@ -301,7 +301,7 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
return; return;
} }
m_ui->errorLabel->setText(""); m_ui->errorLabel->setText("");
ProjectExplorer::ToolChain::ToolChainType t = m_versions.at(index)->toolchainType(); ProjectExplorer::ToolChain::ToolChainType t = m_versions.at(index)->defaultToolchainType();
if (t == ProjectExplorer::ToolChain::MinGW) { if (t == ProjectExplorer::ToolChain::MinGW) {
makeMSVCVisible(false); makeMSVCVisible(false);
makeMingwVisible(true); makeMingwVisible(true);
......
...@@ -885,33 +885,33 @@ void QtVersion::updateQMakeCXX() const ...@@ -885,33 +885,33 @@ void QtVersion::updateQMakeCXX() const
m_qmakeCXXUpToDate = true; m_qmakeCXXUpToDate = true;
} }
ProjectExplorer::ToolChain *QtVersion::toolChain() const ProjectExplorer::ToolChain *QtVersion::toolChain(ProjectExplorer::ToolChain::ToolChainType type) const
{ {
updateToolChain(); updateToolChain(type);
return m_toolChain.data(); return m_toolChain.data();
} }
void QtVersion::updateToolChain() const void QtVersion::updateToolChain(ProjectExplorer::ToolChain::ToolChainType type) const
{ {
if (m_toolChainUpToDate) if (m_toolChainUpToDate && m_toolChain
&& m_toolChain.data() && m_toolChain->type() == type)
return; return;
ProjectExplorer::ToolChain *m_test= 0; ProjectExplorer::ToolChain *tempToolchain= 0;
ProjectExplorer::ToolChain::ToolChainType t = toolchainType(); if (type == ProjectExplorer::ToolChain::MinGW) {
if (t == ProjectExplorer::ToolChain::MinGW) {
QString qmake_cxx = qmakeCXX(); QString qmake_cxx = qmakeCXX();
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
//addToEnvironment(env); //addToEnvironment(env);
env.prependOrSetPath(mingwDirectory()+"/bin"); env.prependOrSetPath(mingwDirectory()+"/bin");
qmake_cxx = env.searchInPath(qmake_cxx); qmake_cxx = env.searchInPath(qmake_cxx);
m_test = ProjectExplorer::ToolChain::createMinGWToolChain(qmake_cxx, mingwDirectory()); tempToolchain = ProjectExplorer::ToolChain::createMinGWToolChain(qmake_cxx, mingwDirectory());
//qDebug()<<"Mingw ToolChain"; //qDebug()<<"Mingw ToolChain";
} else if(t == ProjectExplorer::ToolChain::MSVC) { } else if(type == ProjectExplorer::ToolChain::MSVC) {
m_test = ProjectExplorer::ToolChain::createMSVCToolChain(msvcVersion(), isMSVC64Bit()); tempToolchain = ProjectExplorer::ToolChain::createMSVCToolChain(msvcVersion(), isMSVC64Bit());
//qDebug()<<"MSVC ToolChain ("<<version->msvcVersion()<<")"; //qDebug()<<"MSVC ToolChain ("<<version->msvcVersion()<<")";
} else if(t == ProjectExplorer::ToolChain::WINCE) { } else if(type == ProjectExplorer::ToolChain::WINCE) {
m_test = ProjectExplorer::ToolChain::createWinCEToolChain(msvcVersion(), wincePlatform()); tempToolchain = ProjectExplorer::ToolChain::createWinCEToolChain(msvcVersion(), wincePlatform());
//qDebug()<<"WinCE ToolChain ("<<version->msvcVersion()<<","<<version->wincePlatform()<<")"; //qDebug()<<"WinCE ToolChain ("<<version->msvcVersion()<<","<<version->wincePlatform()<<")";
} else if(t == ProjectExplorer::ToolChain::GCC || t == ProjectExplorer::ToolChain::LinuxICC) { } else if(type == ProjectExplorer::ToolChain::GCC || type == ProjectExplorer::ToolChain::LinuxICC) {
QString qmake_cxx = qmakeCXX(); QString qmake_cxx = qmakeCXX();
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
//addToEnvironment(env); //addToEnvironment(env);
...@@ -921,21 +921,23 @@ void QtVersion::updateToolChain() const ...@@ -921,21 +921,23 @@ void QtVersion::updateToolChain() const
// Unfortunately, we need a valid QMAKE_CXX to configure the parser. // Unfortunately, we need a valid QMAKE_CXX to configure the parser.
qmake_cxx = QLatin1String("cc"); qmake_cxx = QLatin1String("cc");
} }
m_test = ProjectExplorer::ToolChain::createGccToolChain(qmake_cxx); tempToolchain = ProjectExplorer::ToolChain::createGccToolChain(qmake_cxx);
//qDebug()<<"GCC ToolChain ("<<qmake_cxx<<")"; //qDebug()<<"GCC ToolChain ("<<qmake_cxx<<")";
#ifdef QTCREATOR_WITH_S60 #ifdef QTCREATOR_WITH_S60
} else if (t == ProjectExplorer::ToolChain::WINSCW) { } else if (type == ProjectExplorer::ToolChain::WINSCW) {
m_test = S60Manager::instance()->createGCCEToolChain(this); tempToolchain = S60Manager::instance()->createWINSCWToolChain(this);
} else if (type == ProjectExplorer::ToolChain::GCCE) {
tempToolchain = S60Manager::instance()->createGCCEToolChain(this);
#endif #endif
} else { } else {
qDebug()<<"Could not detect ToolChain for"<<mkspec(); qDebug()<<"Could not create ToolChain for"<<mkspec();
qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines."; qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines.";
} }
if (ProjectExplorer::ToolChain::equals(m_test, m_toolChain.data())) { if (ProjectExplorer::ToolChain::equals(tempToolchain, m_toolChain.data())) {
delete m_test; delete tempToolchain;
} else { } else {
m_toolChain = QSharedPointer<ProjectExplorer::ToolChain>(m_test); m_toolChain = QSharedPointer<ProjectExplorer::ToolChain>(tempToolchain);
} }
m_toolChainUpToDate = true; m_toolChainUpToDate = true;
...@@ -1005,26 +1007,34 @@ QString QtVersion::linguistCommand() const ...@@ -1005,26 +1007,34 @@ QString QtVersion::linguistCommand() const
return m_linguistCommand; return m_linguistCommand;
} }
ProjectExplorer::ToolChain::ToolChainType QtVersion::toolchainType() const QList<ProjectExplorer::ToolChain::ToolChainType> QtVersion::possibleToolChainTypes() const
{ {
QList<ProjectExplorer::ToolChain::ToolChainType> toolChains;
if (!isValid()) if (!isValid())
return ProjectExplorer::ToolChain::INVALID; return toolChains << ProjectExplorer::ToolChain::INVALID;
const QString &spec = mkspec(); const QString &spec = mkspec();
// qDebug()<<"spec="<<spec;
if (spec.contains("win32-msvc") || spec.contains(QLatin1String("win32-icc"))) if (spec.contains("win32-msvc") || spec.contains(QLatin1String("win32-icc")))
return ProjectExplorer::ToolChain::MSVC; toolChains << ProjectExplorer::ToolChain::MSVC;
else if (spec.contains("win32-g++")) else if (spec.contains("win32-g++"))
return ProjectExplorer::ToolChain::MinGW; toolChains << ProjectExplorer::ToolChain::MinGW;
else if (spec == QString::null) else if (spec == QString::null)
return ProjectExplorer::ToolChain::INVALID; toolChains << ProjectExplorer::ToolChain::INVALID;
else if (spec.contains("wince")) else if (spec.contains("wince"))
return ProjectExplorer::ToolChain::WINCE; toolChains << ProjectExplorer::ToolChain::WINCE;
else if (spec.contains("linux-icc")) else if (spec.contains("linux-icc"))
return ProjectExplorer::ToolChain::LinuxICC; toolChains << ProjectExplorer::ToolChain::LinuxICC;
else if (spec.contains("abld")) #ifdef QTCREATOR_WITH_S60
return ProjectExplorer::ToolChain::WINSCW; else if (spec.contains("symbian-abld"))
toolChains << ProjectExplorer::ToolChain::GCCE << ProjectExplorer::ToolChain::WINSCW;
#endif
else else
return ProjectExplorer::ToolChain::GCC; toolChains << ProjectExplorer::ToolChain::GCC;
return toolChains;
}
ProjectExplorer::ToolChain::ToolChainType QtVersion::defaultToolchainType() const
{
return possibleToolChainTypes().at(0);
} }
#ifdef QTCREATOR_WITH_S60 #ifdef QTCREATOR_WITH_S60
...@@ -1076,7 +1086,7 @@ void QtVersion::addToEnvironment(ProjectExplorer::Environment &env) const ...@@ -1076,7 +1086,7 @@ void QtVersion::addToEnvironment(ProjectExplorer::Environment &env) const
// add libdir, includedir and bindir // add libdir, includedir and bindir
// or add Mingw dirs // or add Mingw dirs
// or do nothing on other // or do nothing on other
ProjectExplorer::ToolChain *tc = toolChain(); ProjectExplorer::ToolChain *tc = toolChain(defaultToolchainType());
if (tc) if (tc)
tc->addToEnvironment(env); tc->addToEnvironment(env);
} }
...@@ -1185,7 +1195,7 @@ QString QtVersion::buildDebuggingHelperLibrary() ...@@ -1185,7 +1195,7 @@ QString QtVersion::buildDebuggingHelperLibrary()
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
addToEnvironment(env); addToEnvironment(env);
ProjectExplorer::ToolChain *tc = toolChain(); ProjectExplorer::ToolChain *tc = toolChain(defaultToolchainType());
QString directory = DebuggingHelperLibrary::copyDebuggingHelperLibrary(qtInstallData, path()); QString directory = DebuggingHelperLibrary::copyDebuggingHelperLibrary(qtInstallData, path());
QString output = DebuggingHelperLibrary::buildDebuggingHelperLibrary(directory, tc->makeCommand(), qmakeCommand(), mkspec(), env); QString output = DebuggingHelperLibrary::buildDebuggingHelperLibrary(directory, tc->makeCommand(), qmakeCommand(), mkspec(), env);
m_hasDebuggingHelper = !debuggingHelperLibrary().isEmpty(); m_hasDebuggingHelper = !debuggingHelperLibrary().isEmpty();
......
...@@ -65,14 +65,16 @@ public: ...@@ -65,14 +65,16 @@ public:
QString name() const; QString name() const;
QString path() const; QString path() const;
QString sourcePath() const; QString sourcePath() const;
QString mkspec() const;
QString mkspecPath() const; QString mkspecPath() const;
QString qmakeCommand() const; QString qmakeCommand() const;
QString uicCommand() const; QString uicCommand() const;
QString designerCommand() const; QString designerCommand() const;
QString linguistCommand() const; QString linguistCommand() const;
QString qmakeCXX() const;
ProjectExplorer::ToolChain *toolChain() const; QList<ProjectExplorer::ToolChain::ToolChainType> possibleToolChainTypes() const;
QString mkspec() const;
ProjectExplorer::ToolChain::ToolChainType defaultToolchainType() const;
ProjectExplorer::ToolChain *toolChain(ProjectExplorer::ToolChain::ToolChainType type) const;
void setName(const QString &name); void setName(const QString &name);
void setPath(const QString &path); void setPath(const QString &path);
...@@ -81,8 +83,6 @@ public: ...@@ -81,8 +83,6 @@ public:
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information // Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
QHash<QString,QString> versionInfo() const; QHash<QString,QString> versionInfo() const;
ProjectExplorer::ToolChain::ToolChainType toolchainType() const;
#ifdef QTCREATOR_WITH_S60 #ifdef QTCREATOR_WITH_S60
QString mwcDirectory() const; QString mwcDirectory() const;
void setMwcDirectory(const QString &directory); void setMwcDirectory(const QString &directory);
...@@ -128,7 +128,8 @@ private: ...@@ -128,7 +128,8 @@ private:
void updateMkSpec() const; void updateMkSpec() const;
void updateVersionInfo() const; void updateVersionInfo() const;
void updateQMakeCXX() const; void updateQMakeCXX() const;
void updateToolChain() const; void updateToolChain(ProjectExplorer::ToolChain::ToolChainType type) const;
QString qmakeCXX() const;
QString findQtBinary(const QStringList &possibleName) const; QString findQtBinary(const QStringList &possibleName) const;
QString m_name; QString m_name;
QString m_path; QString m_path;
......
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