forked from qt-creator/qt-creator
Fixes: Adjust the toolchain classes to make them work on windows.
This commit is contained in:
@@ -170,16 +170,24 @@ bool MinGWToolChain::equals(ToolChain *other) const
|
|||||||
|
|
||||||
void MinGWToolChain::addToEnvironment(ProjectExplorer::Environment &env)
|
void MinGWToolChain::addToEnvironment(ProjectExplorer::Environment &env)
|
||||||
{
|
{
|
||||||
|
//qDebug()<<"MinGWToolChain::addToEnvironment";
|
||||||
QString binDir = m_mingwPath + "/bin";
|
QString binDir = m_mingwPath + "/bin";
|
||||||
if (QFileInfo(binDir).exists())
|
if (QFileInfo(binDir).exists())
|
||||||
env.prependOrSetPath(binDir);
|
env.prependOrSetPath(binDir);
|
||||||
|
// if (QFileInfo(binDir).exists())
|
||||||
|
// qDebug()<<"Adding "<<binDir<<" to the PATH";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MSVCToolChain::MSVCToolChain(const QString &name)
|
MSVCToolChain::MSVCToolChain(const QString &name)
|
||||||
: m_name(name), m_valuesSet(false)
|
: 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
|
ToolChain::ToolChainType MSVCToolChain::type() const
|
||||||
@@ -211,10 +219,11 @@ QList<HeaderPath> MSVCToolChain::systemHeaderPaths()
|
|||||||
//TODO fix this code
|
//TODO fix this code
|
||||||
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
|
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
|
||||||
addToEnvironment(env);
|
addToEnvironment(env);
|
||||||
#ifdef QTCREATOR_WITH_MSVC_INCLUDES
|
QList<HeaderPath> headerPaths;
|
||||||
return env.value("INCLUDE").split(QLatin1Char(';'));
|
foreach(const QString &path, env.value("INCLUDE").split(QLatin1Char(';'))) {
|
||||||
#endif
|
headerPaths.append(HeaderPath(path, HeaderPath::GlobalHeaderPath));
|
||||||
return QList<HeaderPath>();
|
}
|
||||||
|
return headerPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
|
void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
|
||||||
@@ -222,6 +231,8 @@ void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
|
|||||||
if (!m_valuesSet) {
|
if (!m_valuesSet) {
|
||||||
QSettings registry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7",
|
QSettings registry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7",
|
||||||
QSettings::NativeFormat);
|
QSettings::NativeFormat);
|
||||||
|
if (m_name.isEmpty())
|
||||||
|
return;
|
||||||
QString path = registry.value(m_name).toString();
|
QString path = registry.value(m_name).toString();
|
||||||
ProjectExplorer::Environment oldEnv(env);
|
ProjectExplorer::Environment oldEnv(env);
|
||||||
QString desc;
|
QString desc;
|
||||||
@@ -264,11 +275,12 @@ void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
|
|||||||
m_valuesSet = true;
|
m_valuesSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//qDebug()<<"MSVC Environment:";
|
||||||
QList< QPair<QString, QString> >::const_iterator it, end;
|
QList< QPair<QString, QString> >::const_iterator it, end;
|
||||||
end = m_values.constEnd();
|
end = m_values.constEnd();
|
||||||
for (it = m_values.constBegin(); it != end; ++it) {
|
for (it = m_values.constBegin(); it != end; ++it) {
|
||||||
env.set((*it).first, (*it).second);
|
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 cesdkhandler;
|
||||||
cesdkhandler.parse(path);
|
cesdkhandler.parse(path);
|
||||||
cesdkhandler.find(m_platform).addToEnvironment(env);
|
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
|
ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfiguration) const
|
||||||
{
|
{
|
||||||
|
qDebug()<<"Qt4Project::toolChain() for buildconfiguration:"<<buildConfiguration;
|
||||||
Q_UNUSED(buildConfiguration);
|
Q_UNUSED(buildConfiguration);
|
||||||
ToolChain *m_test;
|
ToolChain *m_test;
|
||||||
QtVersion *version = qtVersion(activeBuildConfiguration());
|
QtVersion *version = qtVersion(activeBuildConfiguration());
|
||||||
@@ -415,10 +416,13 @@ ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfigurat
|
|||||||
qtVersion(activeBuildConfiguration())->addToEnvironment(env);
|
qtVersion(activeBuildConfiguration())->addToEnvironment(env);
|
||||||
qmake_cxx = env.searchInPath(qmake_cxx);
|
qmake_cxx = env.searchInPath(qmake_cxx);
|
||||||
m_test = ToolChain::createMinGWToolChain(qmake_cxx, version->mingwDirectory());
|
m_test = ToolChain::createMinGWToolChain(qmake_cxx, version->mingwDirectory());
|
||||||
|
qDebug()<<"Mingw ToolChain";
|
||||||
} else if(t == ToolChain::MSVC) {
|
} else if(t == ToolChain::MSVC) {
|
||||||
m_test = ToolChain::createMSVCToolChain(version->msvcVersion());
|
m_test = ToolChain::createMSVCToolChain(version->msvcVersion());
|
||||||
|
//qDebug()<<"MSVC ToolChain ("<<version->msvcVersion()<<")";
|
||||||
} else if(t == ToolChain::WINCE) {
|
} else if(t == ToolChain::WINCE) {
|
||||||
m_test = ToolChain::createWinCEToolChain(version->msvcVersion(), version->wincePlatform());
|
m_test = ToolChain::createWinCEToolChain(version->msvcVersion(), version->wincePlatform());
|
||||||
|
//qDebug()<<"WinCE ToolChain ("<<version->msvcVersion()<<","<<version->wincePlatform()<<")";
|
||||||
} else if(t == ToolChain::GCC || t == ToolChain::LinuxICC) {
|
} else if(t == ToolChain::GCC || t == ToolChain::LinuxICC) {
|
||||||
QStringList list = rootProjectNode()->variableValue(Internal::CxxCompilerVar);
|
QStringList list = rootProjectNode()->variableValue(Internal::CxxCompilerVar);
|
||||||
QString qmake_cxx = list.isEmpty() ? QString::null : list.first();
|
QString qmake_cxx = list.isEmpty() ? QString::null : list.first();
|
||||||
@@ -426,8 +430,14 @@ ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfigurat
|
|||||||
qtVersion(activeBuildConfiguration())->addToEnvironment(env);
|
qtVersion(activeBuildConfiguration())->addToEnvironment(env);
|
||||||
qmake_cxx = env.searchInPath(qmake_cxx);
|
qmake_cxx = env.searchInPath(qmake_cxx);
|
||||||
m_test = ToolChain::createGccToolChain(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) {
|
if (m_test == m_toolChain) {
|
||||||
delete m_test;
|
delete m_test;
|
||||||
} else {
|
} else {
|
||||||
@@ -462,6 +472,12 @@ void Qt4Project::updateCodeModel()
|
|||||||
if (tc) {
|
if (tc) {
|
||||||
predefinedMacros = tc->predefinedMacros();
|
predefinedMacros = tc->predefinedMacros();
|
||||||
allHeaderPaths = tc->systemHeaderPaths();
|
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) {
|
foreach (HeaderPath headerPath, allHeaderPaths) {
|
||||||
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
|
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
|
||||||
@@ -867,14 +883,14 @@ void Qt4Project::checkForDeletedApplicationProjects()
|
|||||||
foreach (Qt4ProFileNode * node, applicationProFiles())
|
foreach (Qt4ProFileNode * node, applicationProFiles())
|
||||||
paths.append(node->path());
|
paths.append(node->path());
|
||||||
|
|
||||||
qDebug()<<"Still existing paths :"<<paths;
|
// qDebug()<<"Still existing paths :"<<paths;
|
||||||
|
|
||||||
QList<QSharedPointer<Qt4RunConfiguration> > removeList;
|
QList<QSharedPointer<Qt4RunConfiguration> > removeList;
|
||||||
foreach (QSharedPointer<RunConfiguration> rc, runConfigurations()) {
|
foreach (QSharedPointer<RunConfiguration> rc, runConfigurations()) {
|
||||||
if (QSharedPointer<Qt4RunConfiguration> qt4rc = rc.dynamicCast<Qt4RunConfiguration>()) {
|
if (QSharedPointer<Qt4RunConfiguration> qt4rc = rc.dynamicCast<Qt4RunConfiguration>()) {
|
||||||
if (!paths.contains(qt4rc->proFilePath())) {
|
if (!paths.contains(qt4rc->proFilePath())) {
|
||||||
removeList.append(qt4rc);
|
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())
|
if (!isValid())
|
||||||
return ProjectExplorer::ToolChain::INVALID;
|
return 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;
|
return ProjectExplorer::ToolChain::MSVC;
|
||||||
else if (spec == "win32-g++")
|
else if (spec.contains("win32-g++"))
|
||||||
return ProjectExplorer::ToolChain::MinGW;
|
return ProjectExplorer::ToolChain::MinGW;
|
||||||
else if (spec == QString::null)
|
else if (spec == QString::null)
|
||||||
return ProjectExplorer::ToolChain::INVALID;
|
return ProjectExplorer::ToolChain::INVALID;
|
||||||
else if (spec.startsWith("wince"))
|
else if (spec.contains("wince"))
|
||||||
return ProjectExplorer::ToolChain::WINCE;
|
return ProjectExplorer::ToolChain::WINCE;
|
||||||
else if (spec.startsWith("linux-icc"))
|
else if (spec.contains("linux-icc"))
|
||||||
return ProjectExplorer::ToolChain::LinuxICC;
|
return ProjectExplorer::ToolChain::LinuxICC;
|
||||||
else
|
else
|
||||||
return ProjectExplorer::ToolChain::GCC;
|
return ProjectExplorer::ToolChain::GCC;
|
||||||
@@ -1224,7 +1225,7 @@ QString QtVersion::msvcVersion() const
|
|||||||
|
|
||||||
QString QtVersion::wincePlatform() 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");
|
return ProjectExplorer::CeSdkHandler::platformName(mkspecPath() + "/qmake.conf");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user