+++ /dev/null
-checkSDK is used to build Qt/WinCE successfully. It parses the Visual
-Studio configuration and sets up the environment for cross-compilation.
-
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 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 the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "cesdkhandler.h"
-#include <QtCore/QFile>
-#include <QtCore/QDebug>
-#include <QtCore/QXmlStreamReader>
-
-CeSdkInfo::CeSdkInfo() : m_major(0) , m_minor(0)
-{
-}
-
-QStringList CeSdkInfo::environment()
-{
- QStringList result;
- QString argument = QLatin1String("PATH=");
- argument += m_bin;
- result.append(argument);
- argument = QLatin1String("INCLUDE=");
- argument += m_include;
- result.append(argument);
- argument = QLatin1String("LIB=");
- argument += m_lib;
- result.append(argument);
- return result;
-}
-
-CeSdkHandler::CeSdkHandler()
-{
-}
-
-bool CeSdkHandler::parse()
-{
- // look at the file at %VCInstallDir%/vcpackages/WCE.VCPlatform.config
- // and scan through all installed sdks...
- m_list.clear();
- VCInstallDir = QString::fromLatin1(qgetenv("VCInstallDir"));
- VCInstallDir += QLatin1String("\\");
- VSInstallDir = QString::fromLatin1(qgetenv("VSInstallDir"));
- VSInstallDir += QLatin1String("\\");
- if (VCInstallDir.isEmpty() || VSInstallDir.isEmpty())
- return false;
-
- QDir vStudioDir(VCInstallDir);
- if (!vStudioDir.cd(QLatin1String("vcpackages")))
- return false;
-
- QFile configFile(vStudioDir.absoluteFilePath(QLatin1String("WCE.VCPlatform.config")));
- if (!configFile.exists() || !configFile.open(QIODevice::ReadOnly))
- return false;
-
- QString currentElement;
- CeSdkInfo currentItem;
- QXmlStreamReader xml(&configFile);
- while (!xml.atEnd()) {
- xml.readNext();
- if (xml.isStartElement()) {
- currentElement = xml.name().toString();
- if (currentElement == QLatin1String("Platform"))
- currentItem = CeSdkInfo();
- else if (currentElement == QLatin1String("Directories")) {
- QXmlStreamAttributes attr = xml.attributes();
- currentItem.m_include = fixPaths(attr.value(QLatin1String("Include")).toString());
- currentItem.m_lib = fixPaths(attr.value(QLatin1String("Library")).toString());
- currentItem.m_bin = fixPaths(attr.value(QLatin1String("Path")).toString());
- }
- } else if (xml.isEndElement()) {
- if (xml.name().toString() == QLatin1String("Platform"))
- m_list.append(currentItem);
- } else if (xml.isCharacters() && !xml.isWhitespace()) {
- if (currentElement == QLatin1String("PlatformName"))
- currentItem.m_name = xml.text().toString();
- else if (currentElement == QLatin1String("OSMajorVersion"))
- currentItem.m_major = xml.text().toString().toInt();
- else if (currentElement == QLatin1String("OSMinorVersion"))
- currentItem.m_minor = xml.text().toString().toInt();
- }
- }
-
- if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) {
- qWarning() << "XML ERROR:" << xml.lineNumber() << ": " << xml.errorString();
- return false;
- }
-
- return m_list.size() > 0 ? true : false;
-}
-
-CeSdkInfo CeSdkHandler::find(const QString &name)
-{
- for (QList<CeSdkInfo>::iterator it = m_list.begin(); it != m_list.end(); ++it) {
- if (it->name() == name)
- return *it;
- }
- return CeSdkInfo();
-}
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 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 the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef CE_SDK_HANDLER_INCL
-#define CE_SDK_HANDLER_INCL
-
-#include <QStringList>
-#include <QDir>
-
-QT_USE_NAMESPACE
-
-#define VCINSTALL_MACRO "$(VCInstallDir)"
-#define VSINSTALL_MACRO "$(VSInstallDir)"
-
-class CeSdkInfo
-{
-public:
- CeSdkInfo();
- inline QString name();
- inline QString binPath();
- inline QString includePath();
- inline QString libPath();
- QStringList environment();
- inline bool isValid();
- inline int majorVersion();
- inline int minorVersion();
- inline bool isSupported();
-private:
- friend class CeSdkHandler;
- QString m_name;
- QString m_bin;
- QString m_include;
- QString m_lib;
- int m_major;
- int m_minor;
-};
-
-inline QString CeSdkInfo::name(){ return m_name; }
-inline QString CeSdkInfo::binPath(){ return m_bin; }
-inline QString CeSdkInfo::includePath(){ return m_include; }
-inline QString CeSdkInfo::libPath(){ return m_lib; }
-inline bool CeSdkInfo::isValid(){ return !m_name.isEmpty() && !m_bin.isEmpty() && !m_include.isEmpty() && !m_lib.isEmpty(); }
-inline int CeSdkInfo::majorVersion(){ return m_major; }
-inline int CeSdkInfo::minorVersion(){ return m_minor; }
-inline bool CeSdkInfo::isSupported() { return m_major >= 5; }
-
-class CeSdkHandler
-{
-public:
- CeSdkHandler();
- bool parse();
- inline QList<CeSdkInfo> listAll() const;
- CeSdkInfo find(const QString &name);
-private:
- inline QString fixPaths(QString path) const;
- QList<CeSdkInfo> m_list;
- QString VCInstallDir;
- QString VSInstallDir;
-};
-
-inline QList<CeSdkInfo> CeSdkHandler::listAll() const
-{
- return m_list;
-}
-
-inline QString CeSdkHandler::fixPaths(QString path) const
-{
- QString str = QDir::toNativeSeparators(QDir::cleanPath(path.replace(QLatin1String(VCINSTALL_MACRO), VCInstallDir).replace(QLatin1String(VSINSTALL_MACRO), VSInstallDir).replace(QLatin1String("$(PATH)"), QLatin1String("%PATH%"))));
- if (str.endsWith(QLatin1Char(';')))
- str.truncate(str.length() - 1);
- return str;
-}
-
-#endif
+++ /dev/null
-TEMPLATE = app
-DESTDIR = $$QT.designer.bins
-TARGET = checksdk
-QT = core
-CONFIG += console
-
-build_all:!build_pass {
- CONFIG -= build_all
- CONFIG += release
-}
-
-SOURCES += \
- main.cpp \
- cesdkhandler.cpp
-
-HEADERS += \
- cesdkhandler.h
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 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 the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "cesdkhandler.h"
-#include <QtCore/QStringList>
-#include <QtCore/QFile>
-#include <QtCore/QDir>
-#include <QtCore/QDebug>
-
-void usage()
-{
- printf("SDK Scanner - Convenience Tool to setup your environment\n");
- printf(" for crosscompilation to Windows CE\n");
- printf("Options:\n");
- printf("-help This output\n");
- printf("-list List all available SDKs\n");
- printf("-sdk <name> Select specified SDK.\n");
- printf(" Note: SDK names with spaces need to be\n");
- printf(" specified in parenthesis\n");
- printf(" default: Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\n");
- printf("-script <file> Create a script file which can be launched\n");
- printf(" to setup your environment for specified SDK\n");
-}
-
-int main(int argc, char **argv)
-{
- if (argc == 1) {
- usage();
- return 0;
- }
- QString sdkName;
- bool operationList = false;
- QString scriptFile;
-
- QStringList arguments;
- for (int i=0; i < argc; ++i)
- arguments.append(QLatin1String(argv[i]));
- for (int i=1; i < arguments.size(); ++i) {
- if (arguments[i].toLower() == QLatin1String("-help")) {
- usage();
- return 0;
- } else if (arguments[i].toLower() == QLatin1String("-list")) {
- operationList = true;
- } else if (arguments[i].toLower() == QLatin1String("-sdk")) {
- if (i+1 >= arguments.size()) {
- qWarning("No SDK specified.");
- return -1;
- }
- sdkName = arguments[++i];
- } else if (arguments[i].toLower() == QLatin1String("-script")) {
- if (i+1 >= arguments.size()) {
- qWarning("No scriptfile specified.");
- return -1;
- }
- scriptFile = arguments[++i];
- } else {
- qWarning("Unknown option:%s", qPrintable(arguments[i]));
- usage();
- return -1;
- }
- }
-
- CeSdkHandler handler;
- if (!handler.parse()) {
- qWarning("Could not find any installed SDK, aborting!");
- return -1;
- }
-
- QList<CeSdkInfo> list = handler.listAll();
-
- if (operationList) {
- printf("Available SDKs:\n");
- for (QList<CeSdkInfo>::iterator it = list.begin(); it != list.end(); ++it) {
- printf("SDK Name: ");
- printf(qPrintable(it->name()));
- printf("\n");
- }
- return 0;
- }
-
- // Check for SDK Name, otherwise use Windows Mobile as default
- if (sdkName.isEmpty()) {
- qWarning("No SDK specified: Defaulting to Windows Mobile 5.0 Pocket PC SDK");
- sdkName = QString::fromLatin1("Windows Mobile 5.0 Pocket PC SDK (ARMV4I)");
- }
-
- // finally find the given SDK and prompt out the environment to be set
- for (QList<CeSdkInfo>::iterator it = list.begin(); it != list.end(); ++it ) {
- if (sdkName == it->name()) {
- if (!it->isValid()) {
- qWarning("Selected SDK is not valid!");
- return -1;
- } else if (!it->isSupported()) {
- qWarning("Selected SDK is not officially supported and might not work");
- }
- QString binPath, includePath, libPath;
- binPath = QString::fromLatin1("PATH=") + it->binPath();
- includePath = QString::fromLatin1("INCLUDE=") + it->includePath();
- libPath = QString::fromLatin1("LIB=") + it->libPath();
- if (scriptFile.isEmpty()) {
- printf("Please set up your environment with the following paths:\n");
- printf(qPrintable(binPath));
- printf("\n");
- printf(qPrintable(includePath));
- printf("\n");
- printf(qPrintable(libPath));
- printf("\n");
- return 0;
- } else {
- QFile file(scriptFile);
- if (!file.open(QIODevice::WriteOnly)) {
- qWarning("Could not open target script file");
- return -1;
- }
- QString content;
- content += QLatin1String("@echo off\n");
- content += QLatin1String("echo Environment Selection:") + sdkName + QLatin1String("\n");
- content += QLatin1String("set ") + binPath + QLatin1String("\n");
- content += QLatin1String("set ") + includePath + QLatin1String("\n");
- content += QLatin1String("set ") + libPath + QLatin1String("\n");
- file.write(content.toLatin1());
- return 0;
- }
- }
- }
- qWarning("Could not find specified SDK: %s" , qPrintable(sdkName));
- return -1;
-}