forked from qt-creator/qt-creator
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
@@ -67,7 +67,10 @@ using namespace CMakeProjectManager::Internal;
|
|||||||
|
|
||||||
|
|
||||||
CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
||||||
: m_manager(manager), m_fileName(fileName), m_rootNode(new CMakeProjectNode(m_fileName))
|
: m_manager(manager),
|
||||||
|
m_fileName(fileName),
|
||||||
|
m_rootNode(new CMakeProjectNode(m_fileName)),
|
||||||
|
m_toolChain(0)
|
||||||
{
|
{
|
||||||
m_file = new CMakeFile(this, fileName);
|
m_file = new CMakeFile(this, fileName);
|
||||||
}
|
}
|
||||||
@@ -75,12 +78,14 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
|||||||
CMakeProject::~CMakeProject()
|
CMakeProject::~CMakeProject()
|
||||||
{
|
{
|
||||||
delete m_rootNode;
|
delete m_rootNode;
|
||||||
|
delete m_toolChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO also call this method if the CMakeLists.txt file changed, which is also called if the CMakeList.txt is updated
|
// TODO also call this method if the CMakeLists.txt file changed, which is also called if the CMakeList.txt is updated
|
||||||
// TODO make this function work even if it is reparsing
|
// TODO make this function work even if it is reparsing
|
||||||
void CMakeProject::parseCMakeLists()
|
void CMakeProject::parseCMakeLists()
|
||||||
{
|
{
|
||||||
|
ProjectExplorer::ToolChain *newToolChain = 0;
|
||||||
QString sourceDirectory = QFileInfo(m_fileName).absolutePath();
|
QString sourceDirectory = QFileInfo(m_fileName).absolutePath();
|
||||||
m_manager->createXmlFile(cmakeStep()->userArguments(activeBuildConfiguration()), sourceDirectory, buildDirectory(activeBuildConfiguration()));
|
m_manager->createXmlFile(cmakeStep()->userArguments(activeBuildConfiguration()), sourceDirectory, buildDirectory(activeBuildConfiguration()));
|
||||||
|
|
||||||
@@ -88,6 +93,24 @@ void CMakeProject::parseCMakeLists()
|
|||||||
CMakeCbpParser cbpparser;
|
CMakeCbpParser cbpparser;
|
||||||
qDebug()<<"Parsing file "<<cbpFile;
|
qDebug()<<"Parsing file "<<cbpFile;
|
||||||
if (cbpparser.parseCbpFile(cbpFile)) {
|
if (cbpparser.parseCbpFile(cbpFile)) {
|
||||||
|
qDebug()<<"CodeBlocks Compilername"<<cbpparser.compilerName();
|
||||||
|
if (cbpparser.compilerName() == "gcc") {
|
||||||
|
newToolChain = ProjectExplorer::ToolChain::createGccToolChain("gcc");
|
||||||
|
} else if (cbpparser.compilerName() == "msvc8") {
|
||||||
|
// TODO hmm
|
||||||
|
//newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain("//TODO");
|
||||||
|
Q_ASSERT(false);
|
||||||
|
} else {
|
||||||
|
// TODO hmm?
|
||||||
|
}
|
||||||
|
if (newToolChain == m_toolChain) {
|
||||||
|
delete newToolChain;
|
||||||
|
newToolChain = 0;
|
||||||
|
} else {
|
||||||
|
delete m_toolChain;
|
||||||
|
m_toolChain = newToolChain;
|
||||||
|
}
|
||||||
|
|
||||||
m_projectName = cbpparser.projectName();
|
m_projectName = cbpparser.projectName();
|
||||||
qDebug()<<"Building Tree";
|
qDebug()<<"Building Tree";
|
||||||
// TODO do a intelligent updating of the tree
|
// TODO do a intelligent updating of the tree
|
||||||
@@ -107,18 +130,31 @@ void CMakeProject::parseCMakeLists()
|
|||||||
}
|
}
|
||||||
|
|
||||||
qDebug()<<"Updating CodeModel";
|
qDebug()<<"Updating CodeModel";
|
||||||
|
|
||||||
|
QStringList allIncludePaths;
|
||||||
|
QStringList allFrameworkPaths;
|
||||||
|
QList<ProjectExplorer::HeaderPath> allHeaderPaths = m_toolChain->systemHeaderPaths();
|
||||||
|
foreach (ProjectExplorer::HeaderPath headerPath, allHeaderPaths) {
|
||||||
|
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
|
||||||
|
allFrameworkPaths.append(headerPath.path());
|
||||||
|
else
|
||||||
|
allIncludePaths.append(headerPath.path());
|
||||||
|
}
|
||||||
|
allIncludePaths.append(cbpparser.includeFiles());
|
||||||
CppTools::CppModelManagerInterface *modelmanager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
CppTools::CppModelManagerInterface *modelmanager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
||||||
if (modelmanager) {
|
if (modelmanager) {
|
||||||
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||||
pinfo.includePaths = cbpparser.includeFiles();
|
pinfo.includePaths = allIncludePaths;
|
||||||
// TODO we only want C++ files, not all other stuff that might be in the project
|
// TODO we only want C++ files, not all other stuff that might be in the project
|
||||||
pinfo.sourceFiles = m_files;
|
pinfo.sourceFiles = m_files;
|
||||||
// TODO defines
|
pinfo.defines = m_toolChain->predefinedMacros();
|
||||||
// TODO gcc preprocessor files
|
pinfo.frameworkPaths = allFrameworkPaths;
|
||||||
modelmanager->updateProjectInfo(pinfo);
|
modelmanager->updateProjectInfo(pinfo);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO report error
|
// TODO report error
|
||||||
|
delete m_toolChain;
|
||||||
|
m_toolChain = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,6 +224,8 @@ QString CMakeProject::name() const
|
|||||||
return m_projectName;
|
return m_projectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Core::IFile *CMakeProject::file() const
|
Core::IFile *CMakeProject::file() const
|
||||||
{
|
{
|
||||||
return m_file;
|
return m_file;
|
||||||
@@ -546,6 +584,9 @@ void CMakeCbpParser::parseOption()
|
|||||||
if (attributes().hasAttribute("title"))
|
if (attributes().hasAttribute("title"))
|
||||||
m_projectName = attributes().value("title").toString();
|
m_projectName = attributes().value("title").toString();
|
||||||
|
|
||||||
|
if (attributes().hasAttribute("compiler"))
|
||||||
|
m_compiler = attributes().value("compiler").toString();
|
||||||
|
|
||||||
while (!atEnd()) {
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
if (isEndElement()) {
|
if (isEndElement()) {
|
||||||
@@ -673,6 +714,11 @@ QList<CMakeTarget> CMakeCbpParser::targets()
|
|||||||
return m_targets;
|
return m_targets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CMakeCbpParser::compilerName() const
|
||||||
|
{
|
||||||
|
return m_compiler;
|
||||||
|
}
|
||||||
|
|
||||||
void CMakeTarget::clear()
|
void CMakeTarget::clear()
|
||||||
{
|
{
|
||||||
executable = QString::null;
|
executable = QString::null;
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectnodes.h>
|
#include <projectexplorer/projectnodes.h>
|
||||||
#include <projectexplorer/buildstep.h>
|
#include <projectexplorer/buildstep.h>
|
||||||
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <coreplugin/ifile.h>
|
#include <coreplugin/ifile.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
|
|
||||||
@@ -122,6 +123,7 @@ private:
|
|||||||
CMakeProjectNode* m_rootNode;
|
CMakeProjectNode* m_rootNode;
|
||||||
QStringList m_files;
|
QStringList m_files;
|
||||||
QList<CMakeTarget> m_targets;
|
QList<CMakeTarget> m_targets;
|
||||||
|
ProjectExplorer::ToolChain *m_toolChain;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
||||||
@@ -137,6 +139,7 @@ public:
|
|||||||
QStringList includeFiles();
|
QStringList includeFiles();
|
||||||
QList<CMakeTarget> targets();
|
QList<CMakeTarget> targets();
|
||||||
QString projectName() const;
|
QString projectName() const;
|
||||||
|
QString compilerName() const;
|
||||||
private:
|
private:
|
||||||
void parseCodeBlocks_project_file();
|
void parseCodeBlocks_project_file();
|
||||||
void parseProject();
|
void parseProject();
|
||||||
@@ -159,6 +162,7 @@ private:
|
|||||||
bool m_targetType;
|
bool m_targetType;
|
||||||
QList<CMakeTarget> m_targets;
|
QList<CMakeTarget> m_targets;
|
||||||
QString m_projectName;
|
QString m_projectName;
|
||||||
|
QString m_compiler;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMakeFile : public Core::IFile
|
class CMakeFile : public Core::IFile
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QXmlStreamReader>
|
#include <QtCore/QXmlStreamReader>
|
||||||
|
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
using ProjectExplorer::Environment;
|
using ProjectExplorer::Environment;
|
||||||
|
|
||||||
CeSdkInfo::CeSdkInfo()
|
CeSdkInfo::CeSdkInfo()
|
||||||
@@ -45,15 +45,13 @@ CeSdkInfo::CeSdkInfo()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment CeSdkInfo::addToEnvironment(const Environment &env)
|
void CeSdkInfo::addToEnvironment(Environment &env)
|
||||||
{
|
{
|
||||||
qDebug() << "adding " << name() << "to Environment";
|
qDebug() << "adding " << name() << "to Environment";
|
||||||
Environment e(env);
|
env.set("INCLUDE", m_include);
|
||||||
e.set("INCLUDE", m_include);
|
env.set("LIB", m_lib);
|
||||||
e.set("LIB", m_lib);
|
env.prependOrSetPath(m_bin);
|
||||||
e.prependOrSetPath(m_bin);
|
|
||||||
qDebug()<<e.toStringList();
|
qDebug()<<e.toStringList();
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CeSdkHandler::CeSdkHandler()
|
CeSdkHandler::CeSdkHandler()
|
||||||
@@ -42,8 +42,7 @@
|
|||||||
#define VCINSTALL_MACRO "$(VCInstallDir)"
|
#define VCINSTALL_MACRO "$(VCInstallDir)"
|
||||||
#define VSINSTALL_MACRO "$(VSInstallDir)"
|
#define VSINSTALL_MACRO "$(VSInstallDir)"
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class CeSdkInfo
|
class CeSdkInfo
|
||||||
{
|
{
|
||||||
@@ -53,7 +52,7 @@ public:
|
|||||||
inline QString binPath();
|
inline QString binPath();
|
||||||
inline QString includePath();
|
inline QString includePath();
|
||||||
inline QString libPath();
|
inline QString libPath();
|
||||||
ProjectExplorer::Environment addToEnvironment(const ProjectExplorer::Environment &env);
|
void addToEnvironment(ProjectExplorer::Environment &env);
|
||||||
inline bool isValid();
|
inline bool isValid();
|
||||||
inline int majorVersion();
|
inline int majorVersion();
|
||||||
inline int minorVersion();
|
inline int minorVersion();
|
||||||
@@ -102,7 +101,6 @@ inline QString CeSdkHandler::fixPaths(QString path) const
|
|||||||
return QDir::toNativeSeparators(QDir::cleanPath(path.replace(VCINSTALL_MACRO, VCInstallDir).replace(VSINSTALL_MACRO, VSInstallDir).replace(QLatin1String(";$(PATH)"), QLatin1String(""))));
|
return QDir::toNativeSeparators(QDir::cleanPath(path.replace(VCINSTALL_MACRO, VCInstallDir).replace(VSINSTALL_MACRO, VSInstallDir).replace(QLatin1String(";$(PATH)"), QLatin1String(""))));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
#endif // CE_SDK_HANDLER_H
|
#endif // CE_SDK_HANDLER_H
|
||||||
@@ -52,7 +52,8 @@ HEADERS += projectexplorer.h \
|
|||||||
removefiledialog.h \
|
removefiledialog.h \
|
||||||
nodesvisitor.h \
|
nodesvisitor.h \
|
||||||
projectmodels.h \
|
projectmodels.h \
|
||||||
currentprojectfind.h
|
currentprojectfind.h \
|
||||||
|
toolchain.h
|
||||||
SOURCES += projectexplorer.cpp \
|
SOURCES += projectexplorer.cpp \
|
||||||
projectwindow.cpp \
|
projectwindow.cpp \
|
||||||
buildmanager.cpp \
|
buildmanager.cpp \
|
||||||
@@ -93,7 +94,8 @@ SOURCES += projectexplorer.cpp \
|
|||||||
removefiledialog.cpp \
|
removefiledialog.cpp \
|
||||||
nodesvisitor.cpp \
|
nodesvisitor.cpp \
|
||||||
projectmodels.cpp \
|
projectmodels.cpp \
|
||||||
currentprojectfind.cpp
|
currentprojectfind.cpp \
|
||||||
|
toolchain.cpp
|
||||||
FORMS += dependenciespanel.ui \
|
FORMS += dependenciespanel.ui \
|
||||||
buildsettingspropertiespage.ui \
|
buildsettingspropertiespage.ui \
|
||||||
processstep.ui \
|
processstep.ui \
|
||||||
|
|||||||
326
src/plugins/projectexplorer/toolchain.cpp
Normal file
326
src/plugins/projectexplorer/toolchain.cpp
Normal file
@@ -0,0 +1,326 @@
|
|||||||
|
#include "toolchain.h"
|
||||||
|
#include "cesdkhandler.h"
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
|
#include <QtCore/QProcess>
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QTemporaryFile>
|
||||||
|
#include <QtCore/QString>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
using namespace ProjectExplorer::Internal;
|
||||||
|
|
||||||
|
bool ToolChain::equals(ToolChain *a, ToolChain *b)
|
||||||
|
{
|
||||||
|
if (a == b)
|
||||||
|
return true;
|
||||||
|
if (a == 0 || b == 0)
|
||||||
|
return false;
|
||||||
|
if (a->type() == b->type())
|
||||||
|
a->equals(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolChain::ToolChain()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolChain::~ToolChain()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolChain *ToolChain::createGccToolChain(const QString &gcc)
|
||||||
|
{
|
||||||
|
return new GccToolChain(gcc);
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolChain *ToolChain::createMinGWToolChain(const QString &gcc, const QString &mingwPath)
|
||||||
|
{
|
||||||
|
return new MinGWToolChain(gcc, mingwPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolChain *ToolChain::createMSVCToolChain(const QString &name)
|
||||||
|
{
|
||||||
|
return new MSVCToolChain(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolChain *ToolChain::createWinCEToolChain(const QString &name, const QString &platform)
|
||||||
|
{
|
||||||
|
return new WinCEToolChain(name, platform);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList ToolChain::availableMSVCVersions()
|
||||||
|
{
|
||||||
|
QSettings registry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7",
|
||||||
|
QSettings::NativeFormat);
|
||||||
|
QStringList versions = registry.allKeys();
|
||||||
|
return versions;
|
||||||
|
}
|
||||||
|
|
||||||
|
GccToolChain::GccToolChain(const QString &gcc)
|
||||||
|
: m_gcc(gcc)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolChain::ToolChainType GccToolChain::type() const
|
||||||
|
{
|
||||||
|
return ToolChain::GCC;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray GccToolChain::predefinedMacros()
|
||||||
|
{
|
||||||
|
if (m_predefinedMacros.isEmpty()) {
|
||||||
|
QStringList arguments;
|
||||||
|
arguments << QLatin1String("-xc++")
|
||||||
|
<< QLatin1String("-E")
|
||||||
|
<< QLatin1String("-dM")
|
||||||
|
<< QLatin1String("-");
|
||||||
|
|
||||||
|
QProcess cpp;
|
||||||
|
cpp.start(m_gcc, arguments);
|
||||||
|
cpp.closeWriteChannel();
|
||||||
|
cpp.waitForFinished();
|
||||||
|
m_predefinedMacros = cpp.readAllStandardOutput();
|
||||||
|
}
|
||||||
|
return m_predefinedMacros;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<HeaderPath> GccToolChain::systemHeaderPaths()
|
||||||
|
{
|
||||||
|
if (m_systemHeaderPaths.isEmpty()) {
|
||||||
|
QStringList arguments;
|
||||||
|
arguments << QLatin1String("-xc++")
|
||||||
|
<< QLatin1String("-E")
|
||||||
|
<< QLatin1String("-v")
|
||||||
|
<< QLatin1String("-");
|
||||||
|
|
||||||
|
QProcess cpp;
|
||||||
|
cpp.setReadChannelMode(QProcess::MergedChannels);
|
||||||
|
cpp.start(m_gcc, arguments);
|
||||||
|
cpp.closeWriteChannel();
|
||||||
|
cpp.waitForFinished();
|
||||||
|
|
||||||
|
QByteArray line;
|
||||||
|
while (cpp.canReadLine()) {
|
||||||
|
line = cpp.readLine();
|
||||||
|
if (line.startsWith("#include"))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! line.isEmpty() && line.startsWith("#include")) {
|
||||||
|
HeaderPath::Kind kind = HeaderPath::UserHeaderPath;
|
||||||
|
while (cpp.canReadLine()) {
|
||||||
|
line = cpp.readLine();
|
||||||
|
if (line.startsWith("#include")) {
|
||||||
|
kind = HeaderPath::GlobalHeaderPath;
|
||||||
|
} else if (! line.isEmpty() && QChar(line.at(0)).isSpace()) {
|
||||||
|
HeaderPath::Kind thisHeaderKind = kind;
|
||||||
|
|
||||||
|
line = line.trimmed();
|
||||||
|
if (line.endsWith('\n'))
|
||||||
|
line.chop(1);
|
||||||
|
|
||||||
|
int index = line.indexOf(" (framework directory)");
|
||||||
|
if (index != -1) {
|
||||||
|
line = line.left(index);
|
||||||
|
thisHeaderKind = HeaderPath::FrameworkHeaderPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_systemHeaderPaths.append(HeaderPath(QFile::decodeName(line), thisHeaderKind));
|
||||||
|
} else if (line.startsWith("End of search list.")) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
qWarning() << "ignore line:" << line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m_systemHeaderPaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GccToolChain::addToEnvironment(ProjectExplorer::Environment &env)
|
||||||
|
{
|
||||||
|
Q_UNUSED(env)
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GccToolChain::equals(ToolChain *other) const
|
||||||
|
{
|
||||||
|
return (m_gcc == static_cast<GccToolChain *>(other)->m_gcc);
|
||||||
|
}
|
||||||
|
|
||||||
|
MinGWToolChain::MinGWToolChain(const QString &gcc, const QString &mingwPath)
|
||||||
|
: GccToolChain(gcc), m_mingwPath(mingwPath)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolChain::ToolChainType MinGWToolChain::type() const
|
||||||
|
{
|
||||||
|
return ToolChain::MinGW;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MinGWToolChain::equals(ToolChain *other) const
|
||||||
|
{
|
||||||
|
MinGWToolChain *o = static_cast<MinGWToolChain *>(other);
|
||||||
|
return (m_mingwPath == o->m_mingwPath && this->GccToolChain::equals(other));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MinGWToolChain::addToEnvironment(ProjectExplorer::Environment &env)
|
||||||
|
{
|
||||||
|
QString binDir = m_mingwPath + "/bin";
|
||||||
|
if (QFileInfo(binDir).exists())
|
||||||
|
env.prependOrSetPath(binDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MSVCToolChain::MSVCToolChain(const QString &name)
|
||||||
|
: m_name(name), m_valuesSet(false)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolChain::ToolChainType MSVCToolChain::type() const
|
||||||
|
{
|
||||||
|
return ToolChain::MSVC;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MSVCToolChain::equals(ToolChain *other) const
|
||||||
|
{
|
||||||
|
MSVCToolChain *o = static_cast<MSVCToolChain *>(other);
|
||||||
|
return (m_name == o->m_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray MSVCToolChain::predefinedMacros()
|
||||||
|
{
|
||||||
|
return "#define __WIN32__\n"
|
||||||
|
"#define __WIN32\n"
|
||||||
|
"#define _WIN32\n"
|
||||||
|
"#define WIN32\n"
|
||||||
|
"#define __WINNT__\n"
|
||||||
|
"#define __WINNT\n"
|
||||||
|
"#define WINNT\n"
|
||||||
|
"#define _X86_\n"
|
||||||
|
"#define __MSVCRT__\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
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>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env)
|
||||||
|
{
|
||||||
|
if (!m_valuesSet) {
|
||||||
|
QSettings registry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7",
|
||||||
|
QSettings::NativeFormat);
|
||||||
|
QString path = registry.value(m_name).toString();
|
||||||
|
ProjectExplorer::Environment oldEnv(env);
|
||||||
|
QString desc;
|
||||||
|
QString varsbat = path + "Common7\\Tools\\vsvars32.bat";
|
||||||
|
if (QFileInfo(varsbat).exists()) {
|
||||||
|
QTemporaryFile tf(QDir::tempPath() + "\\XXXXXX.bat");
|
||||||
|
if (!tf.open())
|
||||||
|
return;
|
||||||
|
QString filename = tf.fileName();
|
||||||
|
tf.write("call \"" + varsbat.toLocal8Bit()+"\"\r\n");
|
||||||
|
tf.write(("set > \"" + QDir::tempPath() + "\\qtcreator-msvc-environment.txt\"\r\n").toLocal8Bit());
|
||||||
|
tf.flush();
|
||||||
|
tf.waitForBytesWritten(30000);
|
||||||
|
|
||||||
|
QProcess run;
|
||||||
|
QString cmdPath = env.searchInPath("cmd");
|
||||||
|
run.start(cmdPath, QStringList()<<"/c"<<filename);
|
||||||
|
run.waitForFinished();
|
||||||
|
tf.close();
|
||||||
|
|
||||||
|
QFile vars(QDir::tempPath() + "\\qtcreator-msvc-environment.txt");
|
||||||
|
if (vars.exists() && vars.open(QIODevice::ReadOnly)) {
|
||||||
|
while (!vars.atEnd()) {
|
||||||
|
QByteArray line = vars.readLine();
|
||||||
|
QString line2 = QString::fromLocal8Bit(line);
|
||||||
|
line2 = line2.trimmed();
|
||||||
|
QRegExp regexp("(\\w*)=(.*)");
|
||||||
|
if (regexp.exactMatch(line2)) {
|
||||||
|
QString variable = regexp.cap(1);
|
||||||
|
QString value = regexp.cap(2);
|
||||||
|
value.replace('%' + variable + '%', oldEnv.value(variable));
|
||||||
|
m_values.append(QPair<QString, QString>(variable, value));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vars.close();
|
||||||
|
vars.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_valuesSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
WinCEToolChain::WinCEToolChain(const QString &name, const QString &platform)
|
||||||
|
: MSVCToolChain(name), m_platform(platform)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolChain::ToolChainType WinCEToolChain::type() const
|
||||||
|
{
|
||||||
|
return ToolChain::WINCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WinCEToolChain::equals(ToolChain *other) const
|
||||||
|
{
|
||||||
|
WinCEToolChain *o = static_cast<WinCEToolChain *>(other);
|
||||||
|
return (m_platform == o->m_platform && this->MSVCToolChain::equals(other));
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray WinCEToolChain::predefinedMacros()
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return MSVCToolChain::predefinedMacros();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<HeaderPath> WinCEToolChain::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
|
||||||
|
}
|
||||||
|
|
||||||
|
void WinCEToolChain::addToEnvironment(ProjectExplorer::Environment &env)
|
||||||
|
{
|
||||||
|
MSVCToolChain::addToEnvironment(env);
|
||||||
|
QSettings registry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7",
|
||||||
|
QSettings::NativeFormat);
|
||||||
|
QString path = registry.value(m_name).toString();
|
||||||
|
// Find MSVC path
|
||||||
|
|
||||||
|
path += "/";
|
||||||
|
|
||||||
|
// qDebug()<<"MSVC path"<<msvcPath;
|
||||||
|
// qDebug()<<"looking for platform name in"<< path() + "/mkspecs/" + mkspec() +"/qmake.conf";
|
||||||
|
// Find Platform name
|
||||||
|
// qDebug()<<"Platform Name"<<platformName;
|
||||||
|
|
||||||
|
CeSdkHandler cesdkhandler;
|
||||||
|
cesdkhandler.parse(path);
|
||||||
|
cesdkhandler.find(m_platform).addToEnvironment(env);
|
||||||
|
}
|
||||||
135
src/plugins/projectexplorer/toolchain.h
Normal file
135
src/plugins/projectexplorer/toolchain.h
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
#ifndef TOOLCHAIN_H
|
||||||
|
#define TOOLCHAIN_H
|
||||||
|
|
||||||
|
#include "environment.h"
|
||||||
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QPair>
|
||||||
|
|
||||||
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
class PROJECTEXPLORER_EXPORT HeaderPath
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Kind {
|
||||||
|
GlobalHeaderPath,
|
||||||
|
UserHeaderPath,
|
||||||
|
FrameworkHeaderPath
|
||||||
|
};
|
||||||
|
|
||||||
|
HeaderPath()
|
||||||
|
: _kind(GlobalHeaderPath)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
HeaderPath(const QString &path, Kind kind)
|
||||||
|
: _path(path), _kind(kind)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
QString path() const { return _path; }
|
||||||
|
Kind kind() const { return _kind; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString _path;
|
||||||
|
Kind _kind;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class PROJECTEXPLORER_EXPORT ToolChain
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum ToolChainType
|
||||||
|
{
|
||||||
|
GCC,
|
||||||
|
MinGW,
|
||||||
|
MSVC,
|
||||||
|
WINCE,
|
||||||
|
OTHER,
|
||||||
|
INVALID
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual QByteArray predefinedMacros() = 0;
|
||||||
|
virtual QList<HeaderPath> systemHeaderPaths() = 0;
|
||||||
|
virtual void addToEnvironment(ProjectExplorer::Environment &env) = 0;
|
||||||
|
virtual ToolChainType type() const = 0;
|
||||||
|
|
||||||
|
ToolChain();
|
||||||
|
virtual ~ToolChain();
|
||||||
|
|
||||||
|
static bool equals(ToolChain *, ToolChain *);
|
||||||
|
static ToolChain *createGccToolChain(const QString &gcc);
|
||||||
|
static ToolChain *createMinGWToolChain(const QString &gcc, const QString &mingwPath);
|
||||||
|
static ToolChain *createMSVCToolChain(const QString &name);
|
||||||
|
static ToolChain *createWinCEToolChain(const QString &name, const QString &platform);
|
||||||
|
static QStringList availableMSVCVersions();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool equals(ToolChain *other) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
|
class GccToolChain : public ToolChain
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GccToolChain(const QString &gcc);
|
||||||
|
virtual QByteArray predefinedMacros();
|
||||||
|
virtual QList<HeaderPath> systemHeaderPaths();
|
||||||
|
virtual void addToEnvironment(ProjectExplorer::Environment &env);
|
||||||
|
virtual ToolChainType type() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool equals(ToolChain *other) const;
|
||||||
|
private:
|
||||||
|
QString m_gcc;
|
||||||
|
QByteArray m_predefinedMacros;
|
||||||
|
QList<HeaderPath> m_systemHeaderPaths;
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO this class needs to fleshed out more
|
||||||
|
class MinGWToolChain : public GccToolChain
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MinGWToolChain(const QString &gcc, const QString &mingwPath);
|
||||||
|
virtual void addToEnvironment(ProjectExplorer::Environment &env);
|
||||||
|
virtual ToolChainType type() const;
|
||||||
|
protected:
|
||||||
|
virtual bool equals(ToolChain *other) const;
|
||||||
|
private:
|
||||||
|
QString m_mingwPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO some stuff needs to be moved into this
|
||||||
|
class MSVCToolChain : public ToolChain
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MSVCToolChain(const QString &name);
|
||||||
|
virtual QByteArray predefinedMacros();
|
||||||
|
virtual QList<HeaderPath> systemHeaderPaths();
|
||||||
|
virtual void addToEnvironment(ProjectExplorer::Environment &env);
|
||||||
|
virtual ToolChainType type() const;
|
||||||
|
protected:
|
||||||
|
virtual bool equals(ToolChain *other) const;
|
||||||
|
QString m_name;
|
||||||
|
private:
|
||||||
|
mutable QList<QPair<QString, QString> > m_values;
|
||||||
|
mutable bool m_valuesSet;
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO some stuff needs to be moved into here
|
||||||
|
class WinCEToolChain : public MSVCToolChain
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WinCEToolChain(const QString &name, const QString &platform);
|
||||||
|
virtual QByteArray predefinedMacros();
|
||||||
|
virtual QList<HeaderPath> systemHeaderPaths();
|
||||||
|
virtual void addToEnvironment(ProjectExplorer::Environment &env);
|
||||||
|
virtual ToolChainType type() const;
|
||||||
|
protected:
|
||||||
|
virtual bool equals(ToolChain *other) const;
|
||||||
|
private:
|
||||||
|
QString m_platform;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // TOOLCHAIN_H
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator
|
|
||||||
**
|
|
||||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
**
|
|
||||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** Non-Open Source Usage
|
|
||||||
**
|
|
||||||
** Licensees may use this file in accordance with the Qt Beta Version
|
|
||||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
|
||||||
** alternatively, in accordance with the terms contained in a written
|
|
||||||
** agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
**
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
|
||||||
** of this file. Please review the following information to ensure GNU
|
|
||||||
** General Public Licensing requirements will be met:
|
|
||||||
**
|
|
||||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
|
||||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "gccpreprocessor.h"
|
|
||||||
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QString>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
using namespace Qt4ProjectManager::Internal;
|
|
||||||
|
|
||||||
GCCPreprocessor::GCCPreprocessor(const QString &gcc)
|
|
||||||
: m_gcc(gcc)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
GCCPreprocessor::~GCCPreprocessor()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void GCCPreprocessor::setGcc(const QString &gcc)
|
|
||||||
{
|
|
||||||
if (m_gcc == gcc)
|
|
||||||
return;
|
|
||||||
m_gcc = gcc;
|
|
||||||
m_predefinedMacros.clear();;
|
|
||||||
m_systemHeaderPaths.clear();;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray GCCPreprocessor::predefinedMacros()
|
|
||||||
{
|
|
||||||
if (m_predefinedMacros.isEmpty()) {
|
|
||||||
QStringList arguments;
|
|
||||||
arguments << QLatin1String("-xc++")
|
|
||||||
<< QLatin1String("-E")
|
|
||||||
<< QLatin1String("-dM")
|
|
||||||
<< QLatin1String("-");
|
|
||||||
|
|
||||||
QProcess cpp;
|
|
||||||
cpp.start(m_gcc, arguments);
|
|
||||||
cpp.closeWriteChannel();
|
|
||||||
cpp.waitForFinished();
|
|
||||||
m_predefinedMacros = cpp.readAllStandardOutput();
|
|
||||||
}
|
|
||||||
return m_predefinedMacros;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<HeaderPath> GCCPreprocessor::systemHeaderPaths()
|
|
||||||
{
|
|
||||||
if (m_systemHeaderPaths.isEmpty()) {
|
|
||||||
QStringList arguments;
|
|
||||||
arguments << QLatin1String("-xc++")
|
|
||||||
<< QLatin1String("-E")
|
|
||||||
<< QLatin1String("-v")
|
|
||||||
<< QLatin1String("-");
|
|
||||||
|
|
||||||
QProcess cpp;
|
|
||||||
cpp.setReadChannelMode(QProcess::MergedChannels);
|
|
||||||
cpp.start(m_gcc, arguments);
|
|
||||||
cpp.closeWriteChannel();
|
|
||||||
cpp.waitForFinished();
|
|
||||||
|
|
||||||
QByteArray line;
|
|
||||||
while (cpp.canReadLine()) {
|
|
||||||
line = cpp.readLine();
|
|
||||||
if (line.startsWith("#include"))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! line.isEmpty() && line.startsWith("#include")) {
|
|
||||||
HeaderPath::Kind kind = HeaderPath::UserHeaderPath;
|
|
||||||
while (cpp.canReadLine()) {
|
|
||||||
line = cpp.readLine();
|
|
||||||
if (line.startsWith("#include")) {
|
|
||||||
kind = HeaderPath::GlobalHeaderPath;
|
|
||||||
} else if (! line.isEmpty() && QChar(line.at(0)).isSpace()) {
|
|
||||||
HeaderPath::Kind thisHeaderKind = kind;
|
|
||||||
|
|
||||||
line = line.trimmed();
|
|
||||||
if (line.endsWith('\n'))
|
|
||||||
line.chop(1);
|
|
||||||
|
|
||||||
int index = line.indexOf(" (framework directory)");
|
|
||||||
if (index != -1) {
|
|
||||||
line = line.left(index);
|
|
||||||
thisHeaderKind = HeaderPath::FrameworkHeaderPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_systemHeaderPaths.append(HeaderPath(QFile::decodeName(line), thisHeaderKind));
|
|
||||||
} else if (line.startsWith("End of search list.")) {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
qWarning() << "ignore line:" << line;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return m_systemHeaderPaths;
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator
|
|
||||||
**
|
|
||||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
**
|
|
||||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** Non-Open Source Usage
|
|
||||||
**
|
|
||||||
** Licensees may use this file in accordance with the Qt Beta Version
|
|
||||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
|
||||||
** alternatively, in accordance with the terms contained in a written
|
|
||||||
** agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
**
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
|
||||||
** of this file. Please review the following information to ensure GNU
|
|
||||||
** General Public Licensing requirements will be met:
|
|
||||||
**
|
|
||||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
|
||||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef GCCPREPROCESSOR_H
|
|
||||||
#define GCCPREPROCESSOR_H
|
|
||||||
|
|
||||||
#include "headerpath.h"
|
|
||||||
#include <QByteArray>
|
|
||||||
#include <QList>
|
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class GCCPreprocessor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GCCPreprocessor(const QString &gcc = QLatin1String("g++"));
|
|
||||||
~GCCPreprocessor();
|
|
||||||
|
|
||||||
void setGcc(const QString &gcc);
|
|
||||||
QByteArray predefinedMacros();
|
|
||||||
QList<HeaderPath> systemHeaderPaths();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString m_gcc;
|
|
||||||
QByteArray m_predefinedMacros;
|
|
||||||
QList<HeaderPath> m_systemHeaderPaths;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Qt4ProjectManager
|
|
||||||
|
|
||||||
#endif // GCCPREPROCESSOR_H
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator
|
|
||||||
**
|
|
||||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
**
|
|
||||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** Non-Open Source Usage
|
|
||||||
**
|
|
||||||
** Licensees may use this file in accordance with the Qt Beta Version
|
|
||||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
|
||||||
** alternatively, in accordance with the terms contained in a written
|
|
||||||
** agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
**
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
|
||||||
** of this file. Please review the following information to ensure GNU
|
|
||||||
** General Public Licensing requirements will be met:
|
|
||||||
**
|
|
||||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
|
||||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef HEADERPATH_H
|
|
||||||
#define HEADERPATH_H
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class HeaderPath
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum Kind {
|
|
||||||
GlobalHeaderPath,
|
|
||||||
UserHeaderPath,
|
|
||||||
FrameworkHeaderPath
|
|
||||||
};
|
|
||||||
|
|
||||||
HeaderPath()
|
|
||||||
: _kind(GlobalHeaderPath)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
HeaderPath(const QString &path, Kind kind)
|
|
||||||
: _path(path), _kind(kind)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QString path() const { return _path; }
|
|
||||||
Kind kind() const { return _kind; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString _path;
|
|
||||||
Kind _kind;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Qt4ProjectManager
|
|
||||||
|
|
||||||
|
|
||||||
#endif // HEADERPATH_H
|
|
||||||
@@ -69,8 +69,8 @@ MakeStep::~MakeStep()
|
|||||||
ProjectExplorer::BuildParserInterface *MakeStep::buildParser(const QtVersion * const version)
|
ProjectExplorer::BuildParserInterface *MakeStep::buildParser(const QtVersion * const version)
|
||||||
{
|
{
|
||||||
QString buildParser;
|
QString buildParser;
|
||||||
QtVersion::ToolchainType type = version->toolchainType();
|
ProjectExplorer::ToolChain::ToolChainType type = version->toolchainType();
|
||||||
if ( type == QtVersion::MSVC || type == QtVersion::WINCE)
|
if ( type == ProjectExplorer::ToolChain::MSVC || type == ProjectExplorer::ToolChain::WINCE)
|
||||||
buildParser = Constants::BUILD_PARSER_MSVC;
|
buildParser = Constants::BUILD_PARSER_MSVC;
|
||||||
else
|
else
|
||||||
buildParser = Constants::BUILD_PARSER_GCC;
|
buildParser = Constants::BUILD_PARSER_GCC;
|
||||||
@@ -129,8 +129,8 @@ 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
|
||||||
QtVersion::ToolchainType t = qobject_cast<Qt4Project *>(project())->qtVersion(name)->toolchainType();
|
ProjectExplorer::ToolChain::ToolChainType t = qobject_cast<Qt4Project *>(project())->qtVersion(name)->toolchainType();
|
||||||
if (t != QtVersion::MSVC && t != QtVersion::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";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,158 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator
|
|
||||||
**
|
|
||||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
**
|
|
||||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** Non-Open Source Usage
|
|
||||||
**
|
|
||||||
** Licensees may use this file in accordance with the Qt Beta Version
|
|
||||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
|
||||||
** alternatively, in accordance with the terms contained in a written
|
|
||||||
** agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
**
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
|
||||||
** of this file. Please review the following information to ensure GNU
|
|
||||||
** General Public Licensing requirements will be met:
|
|
||||||
**
|
|
||||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
|
||||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "msvcenvironment.h"
|
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
|
||||||
#include <QtCore/QFile>
|
|
||||||
#include <QtCore/QProcess>
|
|
||||||
#include <QtCore/QRegExp>
|
|
||||||
#include <QtCore/QSettings>
|
|
||||||
#include <QtCore/QStringList>
|
|
||||||
#include <QtCore/QTemporaryFile>
|
|
||||||
|
|
||||||
using namespace Qt4ProjectManager::Internal;
|
|
||||||
using ProjectExplorer::Environment;
|
|
||||||
|
|
||||||
MSVCEnvironment::MSVCEnvironment(const QString &name, const QString &path)
|
|
||||||
: m_name(name), m_path(path), m_valuesSet(false)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QString MSVCEnvironment::name() const
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString MSVCEnvironment::path() const
|
|
||||||
{
|
|
||||||
return m_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<MSVCEnvironment> MSVCEnvironment::availableVersions()
|
|
||||||
{
|
|
||||||
QList<MSVCEnvironment> result;
|
|
||||||
|
|
||||||
QSettings registry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7",
|
|
||||||
QSettings::NativeFormat);
|
|
||||||
QStringList versions = registry.allKeys();
|
|
||||||
foreach (const QString &version, versions) {
|
|
||||||
QString dir = registry.value(version).toString();
|
|
||||||
result << MSVCEnvironment(version, dir);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString MSVCEnvironment::description() const
|
|
||||||
{
|
|
||||||
QString desc;
|
|
||||||
desc = "Microsoft Visual Studio " + m_name + " from " + m_path;
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This method is ugly as hell, but that is to be expected
|
|
||||||
// It crates a temporary batch file which first runs vsvars32.bat from MSVC
|
|
||||||
// and then runs *set* to get the environment
|
|
||||||
// We cache that information.
|
|
||||||
Environment MSVCEnvironment::addToEnvironment(const Environment &env) const
|
|
||||||
{
|
|
||||||
Environment e(env);
|
|
||||||
if (!m_valuesSet) {
|
|
||||||
QString desc;
|
|
||||||
QString varsbat = m_path + "Common7\\Tools\\vsvars32.bat";
|
|
||||||
if (QFileInfo(varsbat).exists()) {
|
|
||||||
QTemporaryFile tf(QDir::tempPath() + "\\XXXXXX.bat");
|
|
||||||
if (!tf.open())
|
|
||||||
return e;
|
|
||||||
QString filename = tf.fileName();
|
|
||||||
tf.write("call \"" + varsbat.toLocal8Bit()+"\"\r\n");
|
|
||||||
tf.write(("set > \"" + QDir::tempPath() + "\\qtcreator-msvc-environment.txt\"\r\n").toLocal8Bit());
|
|
||||||
tf.flush();
|
|
||||||
tf.waitForBytesWritten(30000);
|
|
||||||
|
|
||||||
QProcess run;
|
|
||||||
QString cmdPath = e.searchInPath("cmd");
|
|
||||||
run.start(cmdPath, QStringList()<<"/c"<<filename);
|
|
||||||
run.waitForFinished();
|
|
||||||
tf.close();
|
|
||||||
|
|
||||||
QFile vars(QDir::tempPath() + "\\qtcreator-msvc-environment.txt");
|
|
||||||
if (vars.exists() && vars.open(QIODevice::ReadOnly)) {
|
|
||||||
while (!vars.atEnd()) {
|
|
||||||
QByteArray line = vars.readLine();
|
|
||||||
QString line2 = QString::fromLocal8Bit(line);
|
|
||||||
line2 = line2.trimmed();
|
|
||||||
QRegExp regexp("(\\w*)=(.*)");
|
|
||||||
if (regexp.exactMatch(line2)) {
|
|
||||||
QString variable = regexp.cap(1);
|
|
||||||
QString value = regexp.cap(2);
|
|
||||||
value.replace('%' + variable + '%', e.value(variable));
|
|
||||||
m_values.append(QPair<QString, QString>(variable, value));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vars.close();
|
|
||||||
vars.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_valuesSet = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList< QPair<QString, QString> >::const_iterator it, end;
|
|
||||||
end = m_values.constEnd();
|
|
||||||
for (it = m_values.constBegin(); it != end; ++it) {
|
|
||||||
e.set((*it).first, (*it).second);
|
|
||||||
qDebug()<<"variable:"<<(*it).first<<"value:"<<(*it).second;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// QFile varsbat(m_path + "Common7\\Tools\\vsvars32.bat");
|
|
||||||
// if (varsbat.exists() && varsbat.open(QIODevice::ReadOnly)) {
|
|
||||||
// while (!varsbat.atEnd()) {
|
|
||||||
// QByteArray line = varsbat.readLine();
|
|
||||||
// QString line2 = QString::fromLocal8Bit(line);
|
|
||||||
// line2 = line2.trimmed();
|
|
||||||
// QRegExp regexp("\\s*@?(S|s)(E|e)(T|t)\\s*(\\w*)=(.*)");
|
|
||||||
// if (regexp.exactMatch(line2)) {
|
|
||||||
// QString variable = regexp.cap(4);
|
|
||||||
// QString value = regexp.cap(5);
|
|
||||||
// value.replace('%' + variable + '%', e.value(variable));
|
|
||||||
// e.set(variable, value);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// varsbat.close();
|
|
||||||
// }
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator
|
|
||||||
**
|
|
||||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
**
|
|
||||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** Non-Open Source Usage
|
|
||||||
**
|
|
||||||
** Licensees may use this file in accordance with the Qt Beta Version
|
|
||||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
|
||||||
** alternatively, in accordance with the terms contained in a written
|
|
||||||
** agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
**
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
|
||||||
** of this file. Please review the following information to ensure GNU
|
|
||||||
** General Public Licensing requirements will be met:
|
|
||||||
**
|
|
||||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
|
||||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef MSVCENVIRONMENT_H
|
|
||||||
#define MSVCENVIRONMENT_H
|
|
||||||
|
|
||||||
#include <QtCore/QString>
|
|
||||||
#include <QtCore/QList>
|
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class MSVCEnvironment
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QString name() const;
|
|
||||||
QString path() const;
|
|
||||||
ProjectExplorer::Environment addToEnvironment(const ProjectExplorer::Environment &env) const;
|
|
||||||
QString description() const;
|
|
||||||
|
|
||||||
static QList<MSVCEnvironment> availableVersions();
|
|
||||||
private:
|
|
||||||
|
|
||||||
MSVCEnvironment(const QString &name, const QString &path);
|
|
||||||
QString m_name;
|
|
||||||
QString m_path;
|
|
||||||
mutable QList<QPair<QString, QString> > m_values;
|
|
||||||
mutable bool m_valuesSet;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Qt4ProjectManager
|
|
||||||
|
|
||||||
#endif // MSVCENVIRONMENT_H
|
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Arguments:</string>
|
<string>Effective qmake call:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
@@ -84,6 +84,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPlainTextEdit" name="qmakeArgumentsEdit">
|
<widget class="QPlainTextEdit" name="qmakeArgumentsEdit">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
|
|||||||
@@ -231,6 +231,7 @@ void Qt4ProjectFile::modified(Core::IFile::ReloadBehavior *)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
|
Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
|
||||||
|
m_toolChain(0),
|
||||||
m_manager(manager),
|
m_manager(manager),
|
||||||
m_rootProjectNode(new Qt4ProFileNode(this, fileName, this)),
|
m_rootProjectNode(new Qt4ProFileNode(this, fileName, this)),
|
||||||
m_nodesWatcher(new Internal::Qt4NodesWatcher(this)),
|
m_nodesWatcher(new Internal::Qt4NodesWatcher(this)),
|
||||||
@@ -265,6 +266,7 @@ Qt4Project::~Qt4Project()
|
|||||||
{
|
{
|
||||||
m_manager->unregisterProject(this);
|
m_manager->unregisterProject(this);
|
||||||
delete m_projectFiles;
|
delete m_projectFiles;
|
||||||
|
delete m_toolChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4Project::defaultQtVersionChanged()
|
void Qt4Project::defaultQtVersionChanged()
|
||||||
@@ -400,6 +402,41 @@ void Qt4Project::scheduleUpdateCodeModel()
|
|||||||
m_updateCodeModelTimer.start();
|
m_updateCodeModelTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfiguration) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(buildConfiguration);
|
||||||
|
ToolChain *m_test;
|
||||||
|
QtVersion *version = qtVersion(activeBuildConfiguration());
|
||||||
|
ToolChain::ToolChainType t = version->toolchainType();
|
||||||
|
if (t == ToolChain::MinGW) {
|
||||||
|
QStringList list = rootProjectNode()->variableValue(Internal::CxxCompilerVar);
|
||||||
|
QString qmake_cxx = list.isEmpty() ? QString::null : list.first();
|
||||||
|
Environment env = Environment::systemEnvironment();
|
||||||
|
qtVersion(activeBuildConfiguration())->addToEnvironment(env);
|
||||||
|
qmake_cxx = env.searchInPath(qmake_cxx);
|
||||||
|
m_test = ToolChain::createMinGWToolChain(qmake_cxx, version->mingwDirectory());
|
||||||
|
} else if(t == ToolChain::MSVC) {
|
||||||
|
m_test = ToolChain::createMSVCToolChain(version->msvcVersion());
|
||||||
|
} else if(t == ToolChain::WINCE) {
|
||||||
|
m_test = ToolChain::createWinCEToolChain(version->msvcVersion(), version->wincePlatform());
|
||||||
|
} else if(t == ToolChain::GCC) {
|
||||||
|
QStringList list = rootProjectNode()->variableValue(Internal::CxxCompilerVar);
|
||||||
|
QString qmake_cxx = list.isEmpty() ? QString::null : list.first();
|
||||||
|
Environment env = Environment::systemEnvironment();
|
||||||
|
qtVersion(activeBuildConfiguration())->addToEnvironment(env);
|
||||||
|
qmake_cxx = env.searchInPath(qmake_cxx);
|
||||||
|
m_test = ToolChain::createGccToolChain(qmake_cxx);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_test == m_toolChain) {
|
||||||
|
delete m_test;
|
||||||
|
} else {
|
||||||
|
delete m_toolChain;
|
||||||
|
m_toolChain = m_test;
|
||||||
|
}
|
||||||
|
return m_toolChain;
|
||||||
|
}
|
||||||
|
|
||||||
void Qt4Project::updateCodeModel()
|
void Qt4Project::updateCodeModel()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
@@ -419,40 +456,17 @@ void Qt4Project::updateCodeModel()
|
|||||||
const QString newQtIncludePath = versionInfo.value(QLatin1String("QT_INSTALL_HEADERS"));
|
const QString newQtIncludePath = versionInfo.value(QLatin1String("QT_INSTALL_HEADERS"));
|
||||||
const QString newQtLibsPath = versionInfo.value(QLatin1String("QT_INSTALL_LIBS"));
|
const QString newQtLibsPath = versionInfo.value(QLatin1String("QT_INSTALL_LIBS"));
|
||||||
|
|
||||||
QByteArray predefinedMacros;
|
ToolChain *tc = toolChain(activeBuildConfiguration());
|
||||||
QtVersion::ToolchainType t = qtVersion(activeBuildConfiguration())->toolchainType();
|
QByteArray predefinedMacros = tc->predefinedMacros();
|
||||||
if (t == QtVersion::MinGW || t == QtVersion::OTHER) {
|
QList<HeaderPath> allHeaderPaths = tc->systemHeaderPaths();
|
||||||
QStringList list = rootProjectNode()->variableValue(Internal::CxxCompilerVar);
|
foreach (HeaderPath headerPath, allHeaderPaths) {
|
||||||
QString qmake_cxx = list.isEmpty() ? QString::null : list.first();
|
|
||||||
qmake_cxx = environment(activeBuildConfiguration()).searchInPath(qmake_cxx);
|
|
||||||
m_preproc.setGcc(qmake_cxx);
|
|
||||||
predefinedMacros = m_preproc.predefinedMacros();
|
|
||||||
foreach (HeaderPath headerPath, m_preproc.systemHeaderPaths()) {
|
|
||||||
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
|
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
|
||||||
allFrameworkPaths.append(headerPath.path());
|
allFrameworkPaths.append(headerPath.path());
|
||||||
else
|
else
|
||||||
allIncludePaths.append(headerPath.path());
|
allIncludePaths.append(headerPath.path());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (t == QtVersion::MSVC || t == QtVersion::WINCE) {
|
|
||||||
#ifdef QTCREATOR_WITH_MSVC_INCLUDES
|
|
||||||
Environment env = environment(activeBuildConfiguration());
|
|
||||||
allIncludePaths.append(env.value("INCLUDE").split(QLatin1Char(';')));
|
|
||||||
#endif
|
|
||||||
predefinedMacros +=
|
|
||||||
"#define __WIN32__\n"
|
|
||||||
"#define __WIN32\n"
|
|
||||||
"#define _WIN32\n"
|
|
||||||
"#define WIN32\n"
|
|
||||||
"#define __WINNT__\n"
|
|
||||||
"#define __WINNT\n"
|
|
||||||
"#define WINNT\n"
|
|
||||||
"#define _X86_\n"
|
|
||||||
"#define __MSVCRT__\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
allIncludePaths.append(newQtIncludePath);
|
allIncludePaths.append(newQtIncludePath);
|
||||||
|
|
||||||
QDir dir(newQtIncludePath);
|
QDir dir(newQtIncludePath);
|
||||||
foreach (QFileInfo info, dir.entryInfoList(QDir::Dirs)) {
|
foreach (QFileInfo info, dir.entryInfoList(QDir::Dirs)) {
|
||||||
if (! info.fileName().startsWith(QLatin1String("Qt")))
|
if (! info.fileName().startsWith(QLatin1String("Qt")))
|
||||||
@@ -681,7 +695,8 @@ Qt4ProFileNode *Qt4Project::rootProjectNode() const
|
|||||||
ProjectExplorer::Environment Qt4Project::baseEnvironment(const QString &buildConfiguration) const
|
ProjectExplorer::Environment Qt4Project::baseEnvironment(const QString &buildConfiguration) const
|
||||||
{
|
{
|
||||||
Environment env = useSystemEnvironment(buildConfiguration) ? Environment(QProcess::systemEnvironment()) : Environment();
|
Environment env = useSystemEnvironment(buildConfiguration) ? Environment(QProcess::systemEnvironment()) : Environment();
|
||||||
env = qtVersion(buildConfiguration)->addToEnvironment(env);
|
qtVersion(buildConfiguration)->addToEnvironment(env);
|
||||||
|
toolChain(buildConfiguration)->addToEnvironment(env);
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,13 +36,13 @@
|
|||||||
|
|
||||||
#include "qtversionmanager.h"
|
#include "qtversionmanager.h"
|
||||||
#include "qt4nodes.h"
|
#include "qt4nodes.h"
|
||||||
#include "gccpreprocessor.h"
|
|
||||||
#include "qmakestep.h"
|
#include "qmakestep.h"
|
||||||
#include "makestep.h"
|
#include "makestep.h"
|
||||||
|
|
||||||
#include <coreplugin/ifile.h>
|
#include <coreplugin/ifile.h>
|
||||||
#include <projectexplorer/applicationrunconfiguration.h>
|
#include <projectexplorer/applicationrunconfiguration.h>
|
||||||
#include <projectexplorer/projectnodes.h>
|
#include <projectexplorer/projectnodes.h>
|
||||||
|
#include <projectexplorer/toolchain.h>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
@@ -214,6 +214,10 @@ private:
|
|||||||
static void findProFile(const QString& fileName, Internal::Qt4ProFileNode *root, QList<Internal::Qt4ProFileNode *> &list);
|
static void findProFile(const QString& fileName, Internal::Qt4ProFileNode *root, QList<Internal::Qt4ProFileNode *> &list);
|
||||||
static bool hasSubNode(Internal::Qt4PriFileNode *root, const QString &path);
|
static bool hasSubNode(Internal::Qt4PriFileNode *root, const QString &path);
|
||||||
|
|
||||||
|
ProjectExplorer::ToolChain *toolChain(const QString &buildConfiguration) const;
|
||||||
|
mutable ProjectExplorer::ToolChain *m_toolChain;
|
||||||
|
|
||||||
|
|
||||||
QList<Internal::Qt4ProFileNode *> m_applicationProFileChange;
|
QList<Internal::Qt4ProFileNode *> m_applicationProFileChange;
|
||||||
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;
|
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;
|
||||||
|
|
||||||
@@ -238,7 +242,6 @@ private:
|
|||||||
QTimer m_updateCodeModelTimer;
|
QTimer m_updateCodeModelTimer;
|
||||||
QTimer m_addUiFilesTimer;
|
QTimer m_addUiFilesTimer;
|
||||||
QStringList m_uiFilesToAdd;
|
QStringList m_uiFilesToAdd;
|
||||||
Internal::GCCPreprocessor m_preproc;
|
|
||||||
|
|
||||||
friend class Qt4ProjectFile;
|
friend class Qt4ProjectFile;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,13 +32,9 @@ HEADERS = qt4projectmanagerplugin.h \
|
|||||||
msvcparser.h \
|
msvcparser.h \
|
||||||
buildparserfactory.h \
|
buildparserfactory.h \
|
||||||
deployhelper.h \
|
deployhelper.h \
|
||||||
msvcenvironment.h \
|
|
||||||
cesdkhandler.h \
|
|
||||||
embeddedpropertiespage.h \
|
embeddedpropertiespage.h \
|
||||||
qt4runconfiguration.h \
|
qt4runconfiguration.h \
|
||||||
speinfo.h \
|
speinfo.h \
|
||||||
headerpath.h \
|
|
||||||
gccpreprocessor.h \
|
|
||||||
qt4buildconfigwidget.h \
|
qt4buildconfigwidget.h \
|
||||||
qt4buildenvironmentwidget.h \
|
qt4buildenvironmentwidget.h \
|
||||||
projectloadwizard.h \
|
projectloadwizard.h \
|
||||||
@@ -71,12 +67,9 @@ SOURCES = qt4projectmanagerplugin.cpp \
|
|||||||
msvcparser.cpp \
|
msvcparser.cpp \
|
||||||
buildparserfactory.cpp \
|
buildparserfactory.cpp \
|
||||||
deployhelper.cpp \
|
deployhelper.cpp \
|
||||||
msvcenvironment.cpp \
|
|
||||||
cesdkhandler.cpp \
|
|
||||||
embeddedpropertiespage.cpp \
|
embeddedpropertiespage.cpp \
|
||||||
qt4runconfiguration.cpp \
|
qt4runconfiguration.cpp \
|
||||||
speinfo.cpp \
|
speinfo.cpp \
|
||||||
gccpreprocessor.cpp \
|
|
||||||
qt4buildconfigwidget.cpp \
|
qt4buildconfigwidget.cpp \
|
||||||
qt4buildenvironmentwidget.cpp \
|
qt4buildenvironmentwidget.cpp \
|
||||||
projectloadwizard.cpp \
|
projectloadwizard.cpp \
|
||||||
|
|||||||
@@ -34,12 +34,12 @@
|
|||||||
#include "qtversionmanager.h"
|
#include "qtversionmanager.h"
|
||||||
|
|
||||||
#include "qt4projectmanagerconstants.h"
|
#include "qt4projectmanagerconstants.h"
|
||||||
#include "msvcenvironment.h"
|
|
||||||
#include "cesdkhandler.h"
|
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
#include <projectexplorer/cesdkhandler.h>
|
||||||
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <help/helpplugin.h>
|
#include <help/helpplugin.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -495,35 +495,36 @@ void QtDirWidget::showEnvironmentPage(QTreeWidgetItem *item)
|
|||||||
if (item) {
|
if (item) {
|
||||||
int index = m_ui.qtdirList->indexOfTopLevelItem(item);
|
int index = m_ui.qtdirList->indexOfTopLevelItem(item);
|
||||||
m_ui.errorLabel->setText("");
|
m_ui.errorLabel->setText("");
|
||||||
QtVersion::ToolchainType t = m_versions.at(index)->toolchainType();
|
ProjectExplorer::ToolChain::ToolChainType t = m_versions.at(index)->toolchainType();
|
||||||
if (t == QtVersion::MinGW) {
|
if (t == ProjectExplorer::ToolChain::MinGW) {
|
||||||
m_ui.msvcComboBox->setVisible(false);
|
m_ui.msvcComboBox->setVisible(false);
|
||||||
m_ui.msvcLabel->setVisible(false);
|
m_ui.msvcLabel->setVisible(false);
|
||||||
makeMingwVisible(true);
|
makeMingwVisible(true);
|
||||||
m_ui.mingwPath->setPath(m_versions.at(index)->mingwDirectory());
|
m_ui.mingwPath->setPath(m_versions.at(index)->mingwDirectory());
|
||||||
} else if (t == QtVersion::MSVC || t == QtVersion::WINCE){
|
} else if (t == ProjectExplorer::ToolChain::MSVC || t == ProjectExplorer::ToolChain::WINCE){
|
||||||
m_ui.msvcComboBox->setVisible(false);
|
m_ui.msvcComboBox->setVisible(false);
|
||||||
m_ui.msvcLabel->setVisible(true);
|
m_ui.msvcLabel->setVisible(true);
|
||||||
makeMingwVisible(false);
|
makeMingwVisible(false);
|
||||||
QList<MSVCEnvironment> msvcenvironments = MSVCEnvironment::availableVersions();
|
QStringList msvcEnvironments = ProjectExplorer::ToolChain::availableMSVCVersions();
|
||||||
if (msvcenvironments.count() == 0) {
|
if (msvcEnvironments.count() == 0) {
|
||||||
m_ui.msvcLabel->setText(tr("No Visual Studio Installation found"));
|
m_ui.msvcLabel->setText(tr("No Visual Studio Installation found"));
|
||||||
} else if (msvcenvironments.count() == 1) {
|
} else if (msvcEnvironments.count() == 1) {
|
||||||
m_ui.msvcLabel->setText( msvcenvironments.at(0).description());
|
//TODO m_ui.msvcLabel->setText( msvcEnvironments.at(0).description());
|
||||||
|
m_ui.msvcLabel->setText("");
|
||||||
} else {
|
} else {
|
||||||
m_ui.msvcComboBox->setVisible(true);
|
m_ui.msvcComboBox->setVisible(true);
|
||||||
m_ui.msvcComboBox->clear();
|
m_ui.msvcComboBox->clear();
|
||||||
bool block = m_ui.msvcComboBox->blockSignals(true);
|
bool block = m_ui.msvcComboBox->blockSignals(true);
|
||||||
foreach(const MSVCEnvironment msvcenv, msvcenvironments) {
|
foreach(const QString &msvcenv, msvcEnvironments) {
|
||||||
m_ui.msvcComboBox->addItem(msvcenv.name());
|
m_ui.msvcComboBox->addItem(msvcenv);
|
||||||
if (msvcenv.name() == m_versions.at(index)->msvcVersion()) {
|
if (msvcenv == m_versions.at(index)->msvcVersion()) {
|
||||||
m_ui.msvcComboBox->setCurrentIndex(m_ui.msvcComboBox->count() - 1);
|
m_ui.msvcComboBox->setCurrentIndex(m_ui.msvcComboBox->count() - 1);
|
||||||
m_ui.msvcLabel->setText(msvcenv.description());
|
m_ui.msvcLabel->setText(""); //TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_ui.msvcComboBox->blockSignals(block);
|
m_ui.msvcComboBox->blockSignals(block);
|
||||||
}
|
}
|
||||||
} else if (t == QtVersion::INVALID) {
|
} else if (t == ProjectExplorer::ToolChain::INVALID) {
|
||||||
m_ui.msvcComboBox->setVisible(false);
|
m_ui.msvcComboBox->setVisible(false);
|
||||||
m_ui.msvcLabel->setVisible(false);
|
m_ui.msvcLabel->setVisible(false);
|
||||||
makeMingwVisible(false);
|
makeMingwVisible(false);
|
||||||
@@ -532,7 +533,7 @@ void QtDirWidget::showEnvironmentPage(QTreeWidgetItem *item)
|
|||||||
.arg(m_versions.at(index)->path()));
|
.arg(m_versions.at(index)->path()));
|
||||||
else
|
else
|
||||||
m_ui.errorLabel->setText(tr("%1 is not a valid qt directory").arg(m_versions.at(index)->path()));
|
m_ui.errorLabel->setText(tr("%1 is not a valid qt directory").arg(m_versions.at(index)->path()));
|
||||||
} else { //QtVersion::Other
|
} else { //ProjectExplorer::ToolChain::GCC
|
||||||
m_ui.msvcComboBox->setVisible(false);
|
m_ui.msvcComboBox->setVisible(false);
|
||||||
m_ui.msvcLabel->setVisible(false);
|
m_ui.msvcLabel->setVisible(false);
|
||||||
makeMingwVisible(false);
|
makeMingwVisible(false);
|
||||||
@@ -679,13 +680,14 @@ void QtDirWidget::msvcVersionChanged()
|
|||||||
m_versions[currentItemIndex]->setMsvcVersion(msvcVersion);
|
m_versions[currentItemIndex]->setMsvcVersion(msvcVersion);
|
||||||
|
|
||||||
//get descriptionx
|
//get descriptionx
|
||||||
QList<MSVCEnvironment> msvcEnvironments = MSVCEnvironment::availableVersions();
|
//TODO
|
||||||
foreach(const MSVCEnvironment &msvcEnv, msvcEnvironments) {
|
// QList<MSVCEnvironment> msvcEnvironments = MSVCEnvironment::availableVersions();
|
||||||
if (msvcEnv.name() == msvcVersion) {
|
// foreach(const MSVCEnvironment &msvcEnv, msvcEnvironments) {
|
||||||
m_ui.msvcLabel->setText(msvcEnv.description());
|
// if (msvcEnv.name() == msvcVersion) {
|
||||||
break;
|
// m_ui.msvcLabel->setText(msvcEnv.description());
|
||||||
}
|
// break;
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QtVersion *> QtDirWidget::versions() const
|
QList<QtVersion *> QtDirWidget::versions() const
|
||||||
@@ -1176,21 +1178,21 @@ QString QtVersion::qmakeCommand() const
|
|||||||
return QString::null;
|
return QString::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
QtVersion::ToolchainType QtVersion::toolchainType() const
|
ProjectExplorer::ToolChain::ToolChainType QtVersion::toolchainType() const
|
||||||
{
|
{
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return INVALID;
|
return ProjectExplorer::ToolChain::INVALID;
|
||||||
const QString &spec = mkspec();
|
const QString &spec = mkspec();
|
||||||
if (spec.contains("win32-msvc") || spec.contains(QLatin1String("win32-icc")))
|
if (spec.contains("win32-msvc") || spec.contains(QLatin1String("win32-icc")))
|
||||||
return MSVC;
|
return ProjectExplorer::ToolChain::MSVC;
|
||||||
else if (spec == "win32-g++")
|
else if (spec == "win32-g++")
|
||||||
return MinGW;
|
return ProjectExplorer::ToolChain::MinGW;
|
||||||
else if (spec == QString::null)
|
else if (spec == QString::null)
|
||||||
return INVALID;
|
return ProjectExplorer::ToolChain::INVALID;
|
||||||
else if (spec.startsWith("wince"))
|
else if (spec.startsWith("wince"))
|
||||||
return WINCE;
|
return ProjectExplorer::ToolChain::WINCE;
|
||||||
else
|
else
|
||||||
return OTHER;
|
return ProjectExplorer::ToolChain::GCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QtVersion::mingwDirectory() const
|
QString QtVersion::mingwDirectory() const
|
||||||
@@ -1218,70 +1220,26 @@ QString QtVersion::msvcVersion() const
|
|||||||
return m_msvcVersion;
|
return m_msvcVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QtVersion::wincePlatform() const
|
||||||
|
{
|
||||||
|
qDebug()<<"QtVersion::wincePlatform returning"<<ProjectExplorer::CeSdkHandler::platformName(mkspecPath() + "/qmake.conf");
|
||||||
|
return ProjectExplorer::CeSdkHandler::platformName(mkspecPath() + "/qmake.conf");
|
||||||
|
}
|
||||||
|
|
||||||
void QtVersion::setMsvcVersion(const QString &version)
|
void QtVersion::setMsvcVersion(const QString &version)
|
||||||
{
|
{
|
||||||
m_msvcVersion = version;
|
m_msvcVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment QtVersion::addToEnvironment(const Environment &env)
|
void QtVersion::addToEnvironment(Environment &env)
|
||||||
{
|
{
|
||||||
Environment e(env);
|
env.set("QTDIR", m_path);
|
||||||
e.set("QTDIR", m_path);
|
|
||||||
QString qtdirbin = versionInfo().value("QT_INSTALL_BINS");
|
QString qtdirbin = versionInfo().value("QT_INSTALL_BINS");
|
||||||
e.prependOrSetPath(qtdirbin);
|
env.prependOrSetPath(qtdirbin);
|
||||||
// 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
|
||||||
QtVersion::ToolchainType t = toolchainType();
|
|
||||||
if (t == QtVersion::MinGW) {
|
|
||||||
QFileInfo mingwFileInfo(m_mingwDirectory + "/bin");
|
|
||||||
if (mingwFileInfo.exists())
|
|
||||||
e.prependOrSetPath(m_mingwDirectory + "/bin");
|
|
||||||
} else if (t == QtVersion::MSVC) {
|
|
||||||
QList<MSVCEnvironment> list = MSVCEnvironment::availableVersions();
|
|
||||||
if (list.count() == 1) {
|
|
||||||
e = list.at(0).addToEnvironment(e);
|
|
||||||
} else {
|
|
||||||
foreach(const MSVCEnvironment &m, list) {
|
|
||||||
if (m.name() == m_msvcVersion) {
|
|
||||||
e = m.addToEnvironment(e);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (t == QtVersion::WINCE) {
|
|
||||||
QString msvcPath;
|
|
||||||
// Find MSVC path
|
|
||||||
QList<MSVCEnvironment> list = MSVCEnvironment::availableVersions();
|
|
||||||
if (list.count() == 1) {
|
|
||||||
msvcPath = list.at(0).path();
|
|
||||||
e = list.at(0).addToEnvironment(e);
|
|
||||||
} else {
|
|
||||||
foreach(const MSVCEnvironment &m, list) {
|
|
||||||
if (m.name() == m_msvcVersion) {
|
|
||||||
e = m.addToEnvironment(e);
|
|
||||||
msvcPath = m.path();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
msvcPath += "/";
|
|
||||||
|
|
||||||
// qDebug()<<"MSVC path"<<msvcPath;
|
|
||||||
// qDebug()<<"looking for platform name in"<< path() + "/mkspecs/" + mkspec() +"/qmake.conf";
|
|
||||||
// Find Platform name
|
|
||||||
|
|
||||||
QString platformName = CeSdkHandler::platformName(path() + "/mkspecs/" + mkspec()+ "/qmake.conf");
|
|
||||||
// qDebug()<<"Platform Name"<<platformName;
|
|
||||||
|
|
||||||
CeSdkHandler cesdkhandler;
|
|
||||||
cesdkhandler.parse(msvcPath);
|
|
||||||
e = cesdkhandler.find(platformName).addToEnvironment(e);
|
|
||||||
} else if (t == QtVersion::OTHER) {
|
|
||||||
if (!m_prependPath.isEmpty())
|
|
||||||
e.prependOrSetPath(m_prependPath);
|
|
||||||
}
|
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int QtVersion::uniqueId() const
|
int QtVersion::uniqueId() const
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
#include <projectexplorer/toolchain.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
@@ -73,17 +74,16 @@ 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;
|
||||||
|
|
||||||
enum ToolchainType { MinGW, MSVC, WINCE, OTHER, INVALID };
|
ProjectExplorer::ToolChain::ToolChainType toolchainType() const;
|
||||||
|
|
||||||
ToolchainType toolchainType() const;
|
|
||||||
|
|
||||||
QString mingwDirectory() const;
|
QString mingwDirectory() const;
|
||||||
void setMingwDirectory(const QString &directory);
|
void setMingwDirectory(const QString &directory);
|
||||||
QString prependPath() const;
|
QString prependPath() const;
|
||||||
void setPrependPath(const QString &string);
|
void setPrependPath(const QString &string);
|
||||||
QString msvcVersion() const;
|
QString msvcVersion() const;
|
||||||
|
QString wincePlatform() const;
|
||||||
void setMsvcVersion(const QString &version);
|
void setMsvcVersion(const QString &version);
|
||||||
ProjectExplorer::Environment addToEnvironment(const ProjectExplorer::Environment &env);
|
void addToEnvironment(ProjectExplorer::Environment &env);
|
||||||
|
|
||||||
int uniqueId() const;
|
int uniqueId() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user