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)
// 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
// 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 (value(name, "makeCmd").toString().isEmpty())
args << "-w";
......@@ -110,7 +110,7 @@ bool MakeStep::init(const QString &name)
setEnabled(name, !skipMakeClean);
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)
setBuildParser(ProjectExplorer::Constants::BUILD_PARSER_MSVC);
else
......
......@@ -6,7 +6,12 @@
* support the different tool chains
* gui for overriding the default make target if necessary,
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:
* predefined macros
......@@ -17,3 +22,4 @@
* system includes
* Run WINSCW executables
* Deploy gcce executables
......@@ -375,14 +375,19 @@ void Qt4Project::scheduleUpdateCodeModel(Qt4ProjectManager::Internal::Qt4ProFile
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
{
return qtVersion(buildConfiguration)->toolChain()->makeCommand();
return toolChain(buildConfiguration)->makeCommand();
}
QString Qt4Project::defaultMakeTarget(const QString &buildConfiguration) const
{
return qtVersion(buildConfiguration)->toolChain()->defaultMakeTarget(this);
return toolChain(buildConfiguration)->defaultMakeTarget(this);
}
void Qt4Project::updateCodeModel()
......@@ -401,7 +406,7 @@ void Qt4Project::updateCodeModel()
QStringList predefinedFrameworkPaths;
QByteArray predefinedMacros;
ToolChain *tc = qtVersion(activeBuildConfiguration())->toolChain();
ToolChain *tc = toolChain(activeBuildConfiguration());
QList<HeaderPath> allHeaderPaths;
if (tc) {
predefinedMacros = tc->predefinedMacros();
......
......@@ -162,6 +162,7 @@ public:
//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
QString qtVersionName(const QString &buildConfiguration) const;
ProjectExplorer::ToolChain *toolChain(const QString &buildConfiguration) const;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
QList<ProjectExplorer::BuildStepConfigWidget*> subConfigWidgets();
......
......@@ -638,7 +638,7 @@ Qt4RunConfiguration::BaseEnvironmentBase Qt4RunConfiguration::baseEnvironmentBas
ProjectExplorer::ToolChain::ToolChainType Qt4RunConfiguration::toolChainType() const
{
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)
return;
}
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) {
makeMSVCVisible(false);
makeMingwVisible(true);
......
......@@ -885,33 +885,33 @@ void QtVersion::updateQMakeCXX() const
m_qmakeCXXUpToDate = true;
}
ProjectExplorer::ToolChain *QtVersion::toolChain() const
ProjectExplorer::ToolChain *QtVersion::toolChain(ProjectExplorer::ToolChain::ToolChainType type) const
{
updateToolChain();
updateToolChain(type);
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;
ProjectExplorer::ToolChain *m_test= 0;
ProjectExplorer::ToolChain::ToolChainType t = toolchainType();
if (t == ProjectExplorer::ToolChain::MinGW) {
ProjectExplorer::ToolChain *tempToolchain= 0;
if (type == ProjectExplorer::ToolChain::MinGW) {
QString qmake_cxx = qmakeCXX();
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
//addToEnvironment(env);
env.prependOrSetPath(mingwDirectory()+"/bin");
qmake_cxx = env.searchInPath(qmake_cxx);
m_test = ProjectExplorer::ToolChain::createMinGWToolChain(qmake_cxx, mingwDirectory());
tempToolchain = ProjectExplorer::ToolChain::createMinGWToolChain(qmake_cxx, mingwDirectory());
//qDebug()<<"Mingw ToolChain";
} else if(t == ProjectExplorer::ToolChain::MSVC) {
m_test = ProjectExplorer::ToolChain::createMSVCToolChain(msvcVersion(), isMSVC64Bit());
} else if(type == ProjectExplorer::ToolChain::MSVC) {
tempToolchain = ProjectExplorer::ToolChain::createMSVCToolChain(msvcVersion(), isMSVC64Bit());
//qDebug()<<"MSVC ToolChain ("<<version->msvcVersion()<<")";
} else if(t == ProjectExplorer::ToolChain::WINCE) {
m_test = ProjectExplorer::ToolChain::createWinCEToolChain(msvcVersion(), wincePlatform());
} else if(type == ProjectExplorer::ToolChain::WINCE) {
tempToolchain = ProjectExplorer::ToolChain::createWinCEToolChain(msvcVersion(), 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();
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
//addToEnvironment(env);
......@@ -921,21 +921,23 @@ void QtVersion::updateToolChain() const
// Unfortunately, we need a valid QMAKE_CXX to configure the parser.
qmake_cxx = QLatin1String("cc");
}
m_test = ProjectExplorer::ToolChain::createGccToolChain(qmake_cxx);
tempToolchain = ProjectExplorer::ToolChain::createGccToolChain(qmake_cxx);
//qDebug()<<"GCC ToolChain ("<<qmake_cxx<<")";
#ifdef QTCREATOR_WITH_S60
} else if (t == ProjectExplorer::ToolChain::WINSCW) {
m_test = S60Manager::instance()->createGCCEToolChain(this);
} else if (type == ProjectExplorer::ToolChain::WINSCW) {
tempToolchain = S60Manager::instance()->createWINSCWToolChain(this);
} else if (type == ProjectExplorer::ToolChain::GCCE) {
tempToolchain = S60Manager::instance()->createGCCEToolChain(this);
#endif
} 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.";
}
if (ProjectExplorer::ToolChain::equals(m_test, m_toolChain.data())) {
delete m_test;
if (ProjectExplorer::ToolChain::equals(tempToolchain, m_toolChain.data())) {
delete tempToolchain;
} else {
m_toolChain = QSharedPointer<ProjectExplorer::ToolChain>(m_test);
m_toolChain = QSharedPointer<ProjectExplorer::ToolChain>(tempToolchain);
}
m_toolChainUpToDate = true;
......@@ -1005,26 +1007,34 @@ QString QtVersion::linguistCommand() const
return m_linguistCommand;
}
ProjectExplorer::ToolChain::ToolChainType QtVersion::toolchainType() const
QList<ProjectExplorer::ToolChain::ToolChainType> QtVersion::possibleToolChainTypes() const
{
QList<ProjectExplorer::ToolChain::ToolChainType> toolChains;
if (!isValid())
return ProjectExplorer::ToolChain::INVALID;
return toolChains << ProjectExplorer::ToolChain::INVALID;
const QString &spec = mkspec();
// qDebug()<<"spec="<<spec;
if (spec.contains("win32-msvc") || spec.contains(QLatin1String("win32-icc")))
return ProjectExplorer::ToolChain::MSVC;
toolChains << ProjectExplorer::ToolChain::MSVC;
else if (spec.contains("win32-g++"))
return ProjectExplorer::ToolChain::MinGW;
toolChains << ProjectExplorer::ToolChain::MinGW;
else if (spec == QString::null)
return ProjectExplorer::ToolChain::INVALID;
toolChains << ProjectExplorer::ToolChain::INVALID;
else if (spec.contains("wince"))
return ProjectExplorer::ToolChain::WINCE;
toolChains << ProjectExplorer::ToolChain::WINCE;
else if (spec.contains("linux-icc"))
return ProjectExplorer::ToolChain::LinuxICC;
else if (spec.contains("abld"))
return ProjectExplorer::ToolChain::WINSCW;
toolChains << ProjectExplorer::ToolChain::LinuxICC;
#ifdef QTCREATOR_WITH_S60
else if (spec.contains("symbian-abld"))
toolChains << ProjectExplorer::ToolChain::GCCE << ProjectExplorer::ToolChain::WINSCW;
#endif
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
......@@ -1076,7 +1086,7 @@ void QtVersion::addToEnvironment(ProjectExplorer::Environment &env) const
// add libdir, includedir and bindir
// or add Mingw dirs
// or do nothing on other
ProjectExplorer::ToolChain *tc = toolChain();
ProjectExplorer::ToolChain *tc = toolChain(defaultToolchainType());
if (tc)
tc->addToEnvironment(env);
}
......@@ -1185,7 +1195,7 @@ QString QtVersion::buildDebuggingHelperLibrary()
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
addToEnvironment(env);
ProjectExplorer::ToolChain *tc = toolChain();
ProjectExplorer::ToolChain *tc = toolChain(defaultToolchainType());
QString directory = DebuggingHelperLibrary::copyDebuggingHelperLibrary(qtInstallData, path());
QString output = DebuggingHelperLibrary::buildDebuggingHelperLibrary(directory, tc->makeCommand(), qmakeCommand(), mkspec(), env);
m_hasDebuggingHelper = !debuggingHelperLibrary().isEmpty();
......
......@@ -65,14 +65,16 @@ public:
QString name() const;
QString path() const;
QString sourcePath() const;
QString mkspec() const;
QString mkspecPath() const;
QString qmakeCommand() const;
QString uicCommand() const;
QString designerCommand() 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 setPath(const QString &path);
......@@ -81,8 +83,6 @@ public:
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
QHash<QString,QString> versionInfo() const;
ProjectExplorer::ToolChain::ToolChainType toolchainType() const;
#ifdef QTCREATOR_WITH_S60
QString mwcDirectory() const;
void setMwcDirectory(const QString &directory);
......@@ -128,7 +128,8 @@ private:
void updateMkSpec() const;
void updateVersionInfo() const;
void updateQMakeCXX() const;
void updateToolChain() const;
void updateToolChain(ProjectExplorer::ToolChain::ToolChainType type) const;
QString qmakeCXX() const;
QString findQtBinary(const QStringList &possibleName) const;
QString m_name;
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