Commit f60dcda6 authored by dt's avatar dt
Browse files

Fixes: Adjust the toolchain classes to make them work on windows.

parent 73ff2581
......@@ -170,16 +170,24 @@ bool MinGWToolChain::equals(ToolChain *other) const
void MinGWToolChain::addToEnvironment(ProjectExplorer::Environment &env)
{
//qDebug()<<"MinGWToolChain::addToEnvironment";
QString binDir = m_mingwPath + "/bin";
if (QFileInfo(binDir).exists())
env.prependOrSetPath(binDir);
// if (QFileInfo(binDir).exists())
// qDebug()<<"Adding "<<binDir<<" to the PATH";
}
MSVCToolChain::MSVCToolChain(const QString &name)
: m_name(name), m_valuesSet(false)
{
if (m_name.isEmpty()) { // Could be because system qt doesn't set this
QSettings registry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7",
QSettings::NativeFormat);
if (registry.allKeys().count())
m_name = registry.allKeys().first();
}
}
ToolChain::ToolChainType MSVCToolChain::type() const
......@@ -211,10 +219,11 @@ QList<HeaderPath> MSVCToolChain::systemHeaderPaths()
//TODO fix this code
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
addToEnvironment(env);
#ifdef QTCREATOR_WITH_MSVC_INCLUDES
return env.value("INCLUDE").split(QLatin1Char(';'));
#endif
return QList<HeaderPath>();
QList<HeaderPath> headerPaths;
foreach(const QString &path, env.value("INCLUDE").split(QLatin1Char(';'))) {
headerPaths.append(HeaderPath(path, HeaderPath::GlobalHeaderPath));
}
return headerPaths;
}
void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
......@@ -222,6 +231,8 @@ void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
if (!m_valuesSet) {
QSettings registry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7",
QSettings::NativeFormat);
if (m_name.isEmpty())
return;
QString path = registry.value(m_name).toString();
ProjectExplorer::Environment oldEnv(env);
QString desc;
......@@ -264,11 +275,12 @@ void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
m_valuesSet = true;
}
//qDebug()<<"MSVC Environment:";
QList< QPair<QString, QString> >::const_iterator it, end;
end = m_values.constEnd();
for (it = m_values.constBegin(); it != end; ++it) {
env.set((*it).first, (*it).second);
qDebug()<<"variable:"<<(*it).first<<"value:"<<(*it).second;
//qDebug()<<"variable:"<<(*it).first<<"value:"<<(*it).second;
}
}
......@@ -325,4 +337,6 @@ void WinCEToolChain::addToEnvironment(ProjectExplorer::Environment &env)
CeSdkHandler cesdkhandler;
cesdkhandler.parse(path);
cesdkhandler.find(m_platform).addToEnvironment(env);
//qDebug()<<"WinCE Final Environment:";
//qDebug()<<env.toStringList();
}
......@@ -404,6 +404,7 @@ void Qt4Project::scheduleUpdateCodeModel()
ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfiguration) const
{
qDebug()<<"Qt4Project::toolChain() for buildconfiguration:"<<buildConfiguration;
Q_UNUSED(buildConfiguration);
ToolChain *m_test;
QtVersion *version = qtVersion(activeBuildConfiguration());
......@@ -415,10 +416,13 @@ 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";
} else if(t == ToolChain::MSVC) {
m_test = ToolChain::createMSVCToolChain(version->msvcVersion());
//qDebug()<<"MSVC ToolChain ("<<version->msvcVersion()<<")";
} else if(t == ToolChain::WINCE) {
m_test = ToolChain::createWinCEToolChain(version->msvcVersion(), version->wincePlatform());
//qDebug()<<"WinCE ToolChain ("<<version->msvcVersion()<<","<<version->wincePlatform()<<")";
} else if(t == ToolChain::GCC || t == ToolChain::LinuxICC) {
QStringList list = rootProjectNode()->variableValue(Internal::CxxCompilerVar);
QString qmake_cxx = list.isEmpty() ? QString::null : list.first();
......@@ -426,8 +430,14 @@ ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfigurat
qtVersion(activeBuildConfiguration())->addToEnvironment(env);
qmake_cxx = env.searchInPath(qmake_cxx);
m_test = ToolChain::createGccToolChain(qmake_cxx);
//qDebug()<<"GCC ToolChain ("<<qmake_cxx<<")";
} else {
qDebug()<<"Could not detect ToolChain for"<<version->mkspec();
qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines.";
}
if (m_test == m_toolChain) {
delete m_test;
} else {
......@@ -462,6 +472,12 @@ void Qt4Project::updateCodeModel()
if (tc) {
predefinedMacros = tc->predefinedMacros();
allHeaderPaths = tc->systemHeaderPaths();
//qDebug()<<"Predifined Macros";
//qDebug()<<tc->predefinedMacros();
//qDebug()<<"";
//qDebug()<<"System Header Paths";
//foreach(const HeaderPath &hp, tc->systemHeaderPaths())
// qDebug()<<hp.path();
}
foreach (HeaderPath headerPath, allHeaderPaths) {
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
......@@ -867,14 +883,14 @@ void Qt4Project::checkForDeletedApplicationProjects()
foreach (Qt4ProFileNode * node, applicationProFiles())
paths.append(node->path());
qDebug()<<"Still existing paths :"<<paths;
// qDebug()<<"Still existing paths :"<<paths;
QList<QSharedPointer<Qt4RunConfiguration> > removeList;
foreach (QSharedPointer<RunConfiguration> rc, runConfigurations()) {
if (QSharedPointer<Qt4RunConfiguration> qt4rc = rc.dynamicCast<Qt4RunConfiguration>()) {
if (!paths.contains(qt4rc->proFilePath())) {
removeList.append(qt4rc);
qDebug()<<"Removing runConfiguration for "<<qt4rc->proFilePath();
// qDebug()<<"Removing runConfiguration for "<<qt4rc->proFilePath();
}
}
}
......
......@@ -1183,15 +1183,16 @@ ProjectExplorer::ToolChain::ToolChainType QtVersion::toolchainType() const
if (!isValid())
return ProjectExplorer::ToolChain::INVALID;
const QString &spec = mkspec();
// qDebug()<<"spec="<<spec;
if (spec.contains("win32-msvc") || spec.contains(QLatin1String("win32-icc")))
return ProjectExplorer::ToolChain::MSVC;
else if (spec == "win32-g++")
else if (spec.contains("win32-g++"))
return ProjectExplorer::ToolChain::MinGW;
else if (spec == QString::null)
return ProjectExplorer::ToolChain::INVALID;
else if (spec.startsWith("wince"))
else if (spec.contains("wince"))
return ProjectExplorer::ToolChain::WINCE;
else if (spec.startsWith("linux-icc"))
else if (spec.contains("linux-icc"))
return ProjectExplorer::ToolChain::LinuxICC;
else
return ProjectExplorer::ToolChain::GCC;
......@@ -1224,7 +1225,7 @@ QString QtVersion::msvcVersion() const
QString QtVersion::wincePlatform() const
{
qDebug()<<"QtVersion::wincePlatform returning"<<ProjectExplorer::CeSdkHandler::platformName(mkspecPath() + "/qmake.conf");
// qDebug()<<"QtVersion::wincePlatform returning"<<ProjectExplorer::CeSdkHandler::platformName(mkspecPath() + "/qmake.conf");
return ProjectExplorer::CeSdkHandler::platformName(mkspecPath() + "/qmake.conf");
}
......
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