forked from qt-creator/qt-creator
CE-SDK: Compile with QT_NO_CAST_FROM_ASCII
- Remove qDebug()-output - Make const-correct Change-Id: Ie0f81e5d3bcede38c85880c924116dfc722054cc Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
@@ -49,9 +49,9 @@ CeSdkInfo::CeSdkInfo()
|
|||||||
|
|
||||||
void CeSdkInfo::addToEnvironment(Environment &env)
|
void CeSdkInfo::addToEnvironment(Environment &env)
|
||||||
{
|
{
|
||||||
qDebug() << "adding " << name() << "to Environment";
|
// qDebug() << "adding " << name() << "to Environment";
|
||||||
env.set("INCLUDE", m_include);
|
env.set(QLatin1String("INCLUDE"), m_include);
|
||||||
env.set("LIB", m_lib);
|
env.set(QLatin1String("LIB"), m_lib);
|
||||||
env.prependOrSetPath(m_bin);
|
env.prependOrSetPath(m_bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,16 +68,13 @@ bool CeSdkHandler::parse(const QString &vsdir)
|
|||||||
VCInstallDir = vsdir;
|
VCInstallDir = vsdir;
|
||||||
|
|
||||||
QDir vStudioDir(VCInstallDir);
|
QDir vStudioDir(VCInstallDir);
|
||||||
if (!vStudioDir.cd("vcpackages"))
|
if (!vStudioDir.cd(QLatin1String("vcpackages")))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QFile configFile(vStudioDir.absoluteFilePath(QLatin1String("WCE.VCPlatform.config")));
|
QFile configFile(vStudioDir.absoluteFilePath(QLatin1String("WCE.VCPlatform.config")));
|
||||||
qDebug()<<"##";
|
|
||||||
if (!configFile.exists() || !configFile.open(QIODevice::ReadOnly))
|
if (!configFile.exists() || !configFile.open(QIODevice::ReadOnly))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
qDebug()<<"parsing";
|
|
||||||
|
|
||||||
QString currentElement;
|
QString currentElement;
|
||||||
CeSdkInfo currentItem;
|
CeSdkInfo currentItem;
|
||||||
QXmlStreamReader xml(&configFile);
|
QXmlStreamReader xml(&configFile);
|
||||||
@@ -113,11 +110,12 @@ bool CeSdkHandler::parse(const QString &vsdir)
|
|||||||
return m_list.size() > 0 ? true : false;
|
return m_list.size() > 0 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CeSdkInfo CeSdkHandler::find(const QString &name)
|
CeSdkInfo CeSdkHandler::find(const QString &name) const
|
||||||
{
|
{
|
||||||
qDebug() << "looking for platform " << name;
|
typedef QList<CeSdkInfo>::const_iterator Iterator;
|
||||||
for (QList<CeSdkInfo>::iterator it = m_list.begin(); it != m_list.end(); ++it) {
|
|
||||||
qDebug() << "...." << it->name();
|
const Iterator cend = m_list.constEnd();
|
||||||
|
for (Iterator it = m_list.constBegin(); it != cend; ++it) {
|
||||||
if (it->name() == name)
|
if (it->name() == name)
|
||||||
return *it;
|
return *it;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,6 @@
|
|||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
|
|
||||||
#define VCINSTALL_MACRO "$(VCInstallDir)"
|
|
||||||
#define VSINSTALL_MACRO "$(VSInstallDir)"
|
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
class Environment;
|
class Environment;
|
||||||
}
|
}
|
||||||
@@ -51,15 +48,15 @@ class PROJECTEXPLORER_EXPORT CeSdkInfo
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CeSdkInfo();
|
CeSdkInfo();
|
||||||
inline QString name();
|
inline QString name() const;
|
||||||
inline QString binPath();
|
inline QString binPath() const;
|
||||||
inline QString includePath();
|
inline QString includePath() const;
|
||||||
inline QString libPath();
|
inline QString libPath() const;
|
||||||
void addToEnvironment(Utils::Environment &env);
|
void addToEnvironment(Utils::Environment &env);
|
||||||
inline bool isValid();
|
inline bool isValid() const;
|
||||||
inline int majorVersion();
|
inline int majorVersion() const;
|
||||||
inline int minorVersion();
|
inline int minorVersion() const;
|
||||||
inline bool isSupported();
|
inline bool isSupported() const;
|
||||||
private:
|
private:
|
||||||
friend class CeSdkHandler;
|
friend class CeSdkHandler;
|
||||||
QString m_name;
|
QString m_name;
|
||||||
@@ -70,14 +67,14 @@ private:
|
|||||||
int m_minor;
|
int m_minor;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline QString CeSdkInfo::name() { return m_name; }
|
inline QString CeSdkInfo::name() const { return m_name; }
|
||||||
inline QString CeSdkInfo::binPath() { return m_bin; }
|
inline QString CeSdkInfo::binPath() const { return m_bin; }
|
||||||
inline QString CeSdkInfo::includePath() { return m_include; }
|
inline QString CeSdkInfo::includePath() const { return m_include; }
|
||||||
inline QString CeSdkInfo::libPath() { return m_lib; }
|
inline QString CeSdkInfo::libPath() const { return m_lib; }
|
||||||
inline bool CeSdkInfo::isValid() { return !m_name.isEmpty() && !m_bin.isEmpty() && !m_include.isEmpty() && !m_lib.isEmpty(); }
|
inline bool CeSdkInfo::isValid() const { return !m_name.isEmpty() && !m_bin.isEmpty() && !m_include.isEmpty() && !m_lib.isEmpty(); }
|
||||||
inline int CeSdkInfo::majorVersion() { return m_major; }
|
inline int CeSdkInfo::majorVersion() const { return m_major; }
|
||||||
inline int CeSdkInfo::minorVersion() { return m_minor; }
|
inline int CeSdkInfo::minorVersion() const { return m_minor; }
|
||||||
inline bool CeSdkInfo::isSupported() { return m_major >= 5; }
|
inline bool CeSdkInfo::isSupported() const { return m_major >= 5; }
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT CeSdkHandler
|
class PROJECTEXPLORER_EXPORT CeSdkHandler
|
||||||
{
|
{
|
||||||
@@ -85,7 +82,7 @@ public:
|
|||||||
CeSdkHandler();
|
CeSdkHandler();
|
||||||
bool parse(const QString &path);
|
bool parse(const QString &path);
|
||||||
inline QList<CeSdkInfo> listAll() const;
|
inline QList<CeSdkInfo> listAll() const;
|
||||||
CeSdkInfo find(const QString &name);
|
CeSdkInfo find(const QString &name) const;
|
||||||
static QString platformName(const QString &qtpath);
|
static QString platformName(const QString &qtpath);
|
||||||
private:
|
private:
|
||||||
inline QString fixPaths(QString path) const;
|
inline QString fixPaths(QString path) const;
|
||||||
@@ -101,7 +98,13 @@ inline QList<CeSdkInfo> CeSdkHandler::listAll() const
|
|||||||
|
|
||||||
inline QString CeSdkHandler::fixPaths(QString path) const
|
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(""))));
|
const char vcInstallMacro[] = "$(VCInstallDir)";
|
||||||
|
const char vsInstallMacro[] = "$(VSInstallDir)";
|
||||||
|
|
||||||
|
path.replace(QLatin1String(vcInstallMacro), VCInstallDir);
|
||||||
|
path.replace(QLatin1String(vsInstallMacro), VSInstallDir);
|
||||||
|
path.remove(QLatin1String(";$(PATH)"));
|
||||||
|
return QDir::toNativeSeparators(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|||||||
@@ -108,8 +108,8 @@ static QString winExpandDelayedEnvReferences(QString in, const Utils::Environmen
|
|||||||
// 1) Having \\ in a path is valid (it is on WinXP)
|
// 1) Having \\ in a path is valid (it is on WinXP)
|
||||||
// 2) We're only replacing in paths. This will cause problems if there's
|
// 2) We're only replacing in paths. This will cause problems if there's
|
||||||
// a replace of a string
|
// a replace of a string
|
||||||
if (!replacement.endsWith('\\'))
|
if (!replacement.endsWith(QLatin1Char('\\')))
|
||||||
replacement += '\\';
|
replacement += QLatin1Char('\\');
|
||||||
|
|
||||||
in.replace(pos, nextPos + 1 - pos, replacement);
|
in.replace(pos, nextPos + 1 - pos, replacement);
|
||||||
pos += replacement.size();
|
pos += replacement.size();
|
||||||
@@ -137,11 +137,11 @@ Utils::Environment WinCEToolChain::readEnvironmentSetting(Utils::Environment &en
|
|||||||
for (envPairIter = envPairs.begin(); envPairIter!=envPairs.end(); ++envPairIter) {
|
for (envPairIter = envPairs.begin(); envPairIter!=envPairs.end(); ++envPairIter) {
|
||||||
// Replace the env values with those from the WinCE SDK
|
// Replace the env values with those from the WinCE SDK
|
||||||
QString varValue = envPairIter.value();
|
QString varValue = envPairIter.value();
|
||||||
if ("PATH" == envPairIter.key())
|
if (envPairIter.key() == QLatin1String("PATH"))
|
||||||
varValue = m_binPath + ";" + varValue;
|
varValue = m_binPath + QLatin1Char(';') + varValue;
|
||||||
else if ("INCLUDE" == envPairIter.key())
|
else if (envPairIter.key() == QLatin1String("INCLUDE"))
|
||||||
varValue = m_includePath;
|
varValue = m_includePath;
|
||||||
else if ("LIB" == envPairIter.key())
|
else if (envPairIter.key() == QLatin1String("LIB"))
|
||||||
varValue = m_libPath;
|
varValue = m_libPath;
|
||||||
|
|
||||||
if (!varValue.isEmpty())
|
if (!varValue.isEmpty())
|
||||||
@@ -184,7 +184,7 @@ static bool parseSDK(QXmlStreamReader& theReader,
|
|||||||
QString& libPath)
|
QString& libPath)
|
||||||
{
|
{
|
||||||
sdkArch = Abi::UnknownArchitecture;
|
sdkArch = Abi::UnknownArchitecture;
|
||||||
sdkName = "";
|
sdkName.clear();
|
||||||
|
|
||||||
// Loop through until either the end of the file or until is gets to the next
|
// Loop through until either the end of the file or until is gets to the next
|
||||||
// end element.
|
// end element.
|
||||||
@@ -197,16 +197,16 @@ static bool parseSDK(QXmlStreamReader& theReader,
|
|||||||
return (sdkArch!=Abi::UnknownArchitecture && !sdkName.isEmpty());
|
return (sdkArch!=Abi::UnknownArchitecture && !sdkName.isEmpty());
|
||||||
} else if (theReader.isStartElement()) {
|
} else if (theReader.isStartElement()) {
|
||||||
const QStringRef elemName = theReader.name();
|
const QStringRef elemName = theReader.name();
|
||||||
if (elemName == "PlatformName") {
|
if (elemName == QLatin1String("PlatformName")) {
|
||||||
sdkName = theReader.readElementText();
|
sdkName = theReader.readElementText();
|
||||||
} else if (elemName == "Directories") {
|
} else if (elemName == QLatin1String("Directories")) {
|
||||||
// Populate the paths from this element. Note: we remove the
|
// Populate the paths from this element. Note: we remove the
|
||||||
// $(PATH) from the binPath as this will be pre-pended in code
|
// $(PATH) from the binPath as this will be pre-pended in code
|
||||||
binPath = theReader.attributes().value("Path").toString();
|
binPath = theReader.attributes().value(QLatin1String("Path")).toString();
|
||||||
binPath.remove("$(PATH)");
|
binPath.remove(QLatin1String("$(PATH)"));
|
||||||
includePath = theReader.attributes().value("Include").toString();
|
includePath = theReader.attributes().value(QLatin1String("Include")).toString();
|
||||||
libPath = theReader.attributes().value("Library").toString();
|
libPath = theReader.attributes().value(QLatin1String("Library")).toString();
|
||||||
} else if (elemName == "OSMajorVersion") {
|
} else if (elemName == QLatin1String("OSMajorVersion")) {
|
||||||
// Qt only supports CE5 and higher so drop out here if this version is
|
// Qt only supports CE5 and higher so drop out here if this version is
|
||||||
// invalid
|
// invalid
|
||||||
ceVer = theReader.readElementText();
|
ceVer = theReader.readElementText();
|
||||||
@@ -215,16 +215,16 @@ static bool parseSDK(QXmlStreamReader& theReader,
|
|||||||
qDebug("Ignoring SDK '%s'. Windows CE version %d is unsupported.", qPrintable(sdkName), ceVer.toInt());
|
qDebug("Ignoring SDK '%s'. Windows CE version %d is unsupported.", qPrintable(sdkName), ceVer.toInt());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (elemName == "Macro") {
|
} else if (elemName == QLatin1String("Macro")) {
|
||||||
// Pull out the architecture from the macro values.
|
// Pull out the architecture from the macro values.
|
||||||
if (theReader.attributes().value("Name") == "ARCHFAM") {
|
if (theReader.attributes().value(QLatin1String("Name")) == QLatin1String("ARCHFAM")) {
|
||||||
const QStringRef archFam = theReader.attributes().value("Value");
|
const QStringRef archFam = theReader.attributes().value(QLatin1String("Value"));
|
||||||
|
|
||||||
if (archFam == "ARM")
|
if (archFam == QLatin1String("ARM"))
|
||||||
sdkArch = Abi::ArmArchitecture;
|
sdkArch = Abi::ArmArchitecture;
|
||||||
else if (archFam == "x86")
|
else if (archFam == QLatin1String("x86"))
|
||||||
sdkArch = Abi::X86Architecture;
|
sdkArch = Abi::X86Architecture;
|
||||||
else if (archFam == "MIPS")
|
else if (archFam == QLatin1String("MIPS"))
|
||||||
sdkArch = Abi::MipsArchitecture;
|
sdkArch = Abi::MipsArchitecture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ QString WinCEToolChain::typeName() const
|
|||||||
|
|
||||||
Utils::FileName WinCEToolChain::mkspec() const
|
Utils::FileName WinCEToolChain::mkspec() const
|
||||||
{
|
{
|
||||||
const QChar specSeperator('-');
|
const QChar specSeperator(QLatin1Char('-'));
|
||||||
|
|
||||||
QString specString = QLatin1String("wince");
|
QString specString = QLatin1String("wince");
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ QList<ToolChain *> WinCEToolChainFactory::autoDetect()
|
|||||||
|
|
||||||
// Check existence of various install scripts
|
// Check existence of various install scripts
|
||||||
const QString vcvars32bat = path + QLatin1String("bin/vcvars32.bat");
|
const QString vcvars32bat = path + QLatin1String("bin/vcvars32.bat");
|
||||||
QFile cePlatforms(path + "vcpackages/WCE.VCPlatform.config");
|
QFile cePlatforms(path + QLatin1String("vcpackages/WCE.VCPlatform.config"));
|
||||||
|
|
||||||
if (cePlatforms.exists()) {
|
if (cePlatforms.exists()) {
|
||||||
const QString msvcVer = findMsvcVer(version);
|
const QString msvcVer = findMsvcVer(version);
|
||||||
@@ -422,7 +422,7 @@ QList<ToolChain *> WinCEToolChainFactory::autoDetect()
|
|||||||
while (!platformReader.atEnd()) {
|
while (!platformReader.atEnd()) {
|
||||||
platformReader.readNext();
|
platformReader.readNext();
|
||||||
if (platformReader.isStartElement()) {
|
if (platformReader.isStartElement()) {
|
||||||
if (platformReader.name() == "Platform") {
|
if (platformReader.name() == QLatin1String("Platform")) {
|
||||||
Abi::Architecture theArch;
|
Abi::Architecture theArch;
|
||||||
QString thePlat;
|
QString thePlat;
|
||||||
QString binPath;
|
QString binPath;
|
||||||
|
|||||||
Reference in New Issue
Block a user