diff options
author | Thomas Zander <t.zander@nokia.com> | 2010-03-02 12:17:49 (GMT) |
---|---|---|
committer | Thomas Zander <t.zander@nokia.com> | 2010-03-02 12:17:49 (GMT) |
commit | d0c6958922627154bd907569e1ce5b830cb353f6 (patch) | |
tree | cbd6a74c2c008205ce596ab57fdd483764f20554 /qmake/generators | |
parent | 984c227bb23cff57fbad6710fdac5c5dfc056409 (diff) | |
parent | 04bda2f714ab2b8352d00a36cec906cdc0ca53ea (diff) | |
download | Qt-d0c6958922627154bd907569e1ce5b830cb353f6.zip Qt-d0c6958922627154bd907569e1ce5b830cb353f6.tar.gz Qt-d0c6958922627154bd907569e1ce5b830cb353f6.tar.bz2 |
Merge branch 'master' into gcce
Diffstat (limited to 'qmake/generators')
-rw-r--r-- | qmake/generators/symbian/epocroot.h | 51 | ||||
-rw-r--r-- | qmake/generators/symbian/initprojectdeploy_symbian.cpp | 146 | ||||
-rw-r--r-- | qmake/generators/symbian/initprojectdeploy_symbian.h | 4 | ||||
-rw-r--r-- | qmake/generators/symbian/symbiancommon.cpp | 34 | ||||
-rw-r--r-- | qmake/generators/symbian/symbiancommon.h | 1 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.cpp | 99 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.h | 4 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_abld.cpp | 60 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_abld.h | 2 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_sbsv2.cpp | 50 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_sbsv2.h | 1 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 97 |
12 files changed, 187 insertions, 362 deletions
diff --git a/qmake/generators/symbian/epocroot.h b/qmake/generators/symbian/epocroot.h deleted file mode 100644 index be26438..0000000 --- a/qmake/generators/symbian/epocroot.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef EPOCROOT_H -#define EPOCROOT_H - -#include <qstring.h> - -// Implementation of epocRoot method is in initprojectdeploy_symbian.cpp -// Defined in separate header for inclusion clarity -extern QString epocRoot(); - -#endif // EPOCROOT_H diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index 6a7f128..6407412 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -46,6 +46,9 @@ #include <qsettings.h> #include <qdebug.h> +// Included from tools/shared +#include <symbian/epocroot.h> + #define SYSBIN_DIR "/sys/bin" #define SUFFIX_DLL "dll" @@ -58,99 +61,6 @@ static QString fixPathToEpocOS(const QString &src) return ret.replace('/', '\\'); } -static void fixEpocRootStr(QString& path) -{ - path.replace("\\", "/"); - - if (path.size() > 1 && path[1] == QChar(':')) { - path = path.mid(2); - } - - if (!path.size() || path[path.size()-1] != QChar('/')) { - path += QChar('/'); - } -} - -#define SYMBIAN_SDKS_KEY "HKEY_LOCAL_MACHINE\\Software\\Symbian\\EPOC SDKs" - -static QString epocRootStr; - -QString epocRoot() -{ - if (!epocRootStr.isEmpty()) { - return epocRootStr; - } - - // First, check the env variable - epocRootStr = qgetenv("EPOCROOT"); - - if (epocRootStr.isEmpty()) { - // No EPOCROOT set, check the default device - // First check EPOCDEVICE env variable - QString defaultDevice = qgetenv("EPOCDEVICE"); - - // Check the windows registry via QSettings for devices.xml path - QSettings settings(SYMBIAN_SDKS_KEY, QSettings::NativeFormat); - QString devicesXmlPath = settings.value("CommonPath").toString(); - - if (!devicesXmlPath.isEmpty()) { - // Parse xml for correct device - devicesXmlPath += "/devices.xml"; - QFile devicesFile(devicesXmlPath); - if (devicesFile.open(QIODevice::ReadOnly)) { - QXmlStreamReader xml(&devicesFile); - while (!xml.atEnd()) { - xml.readNext(); - if (xml.isStartElement() && xml.name() == "devices") { - if (xml.attributes().value("version") == "1.0") { - // Look for correct device - while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) { - xml.readNext(); - if (xml.isStartElement() && xml.name() == "device") { - if ((defaultDevice.isEmpty() && xml.attributes().value("default") == "yes") || - (!defaultDevice.isEmpty() && (xml.attributes().value("id").toString() + QString(":") + xml.attributes().value("name").toString()) == defaultDevice)) { - // Found the correct device - while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) { - xml.readNext(); - if (xml.isStartElement() && xml.name() == "epocroot") { - epocRootStr = xml.readElementText(); - fixEpocRootStr(epocRootStr); - return epocRootStr; - } - } - xml.raiseError("No epocroot element found"); - } - } - } - } else { - xml.raiseError("Invalid 'devices' element version"); - } - } - } - if (xml.hasError()) { - fprintf(stderr, "ERROR: \"%s\" when parsing devices.xml\n", qPrintable(xml.errorString())); - } - } else { - fprintf(stderr, "Could not open devices.xml (%s)\n", qPrintable(devicesXmlPath)); - } - } else { - fprintf(stderr, "Could not retrieve " SYMBIAN_SDKS_KEY " setting\n"); - } - - fprintf(stderr, "Failed to determine epoc root.\n"); - if (!defaultDevice.isEmpty()) - fprintf(stderr, "The device indicated by EPOCDEVICE environment variable (%s) could not be found.\n", qPrintable(defaultDevice)); - fprintf(stderr, "Either set EPOCROOT or EPOCDEVICE environment variable to a valid value, or provide a default Symbian device.\n"); - - // No valid device found; set epocroot to "/" - epocRootStr = QLatin1String("/"); - } - - fixEpocRootStr(epocRootStr); - return epocRootStr; -} - - static bool isPlugin(const QFileInfo& info, const QString& devicePath) { // Libraries are plugins if deployment path is something else than @@ -186,7 +96,7 @@ static void createPluginStub(const QFileInfo& info, generatedDirs << PLUGIN_STUB_DIR; // Plugin stubs must have different name from the actual plugins, because // the toolchain for creating ROM images cannot handle non-binary .dll files properly. - QFile stubFile(QDir::toNativeSeparators(QLatin1String(PLUGIN_STUB_DIR "/") + info.completeBaseName() + "." SUFFIX_QTPLUGIN)); + QFile stubFile(QLatin1String(PLUGIN_STUB_DIR "/") + info.completeBaseName() + "." SUFFIX_QTPLUGIN); if (stubFile.open(QIODevice::WriteOnly)) { if (!generatedFiles.contains(stubFile.fileName())) generatedFiles << stubFile.fileName(); @@ -265,21 +175,29 @@ void initProjectDeploySymbian(QMakeProject* project, foreach(QString item, project->values("DEPLOYMENT")) { QString devicePath = project->first(item + ".path"); + QString devicePathWithoutDrive = devicePath; + + bool devicePathHasDriveLetter = false; + if (devicePath.size() > 1) { + devicePathHasDriveLetter = devicePath.at(1) == QLatin1Char(':'); + } + + // Sometimes devicePath can contain disk but APP_RESOURCE_DIR does not, + // so remove the drive letter for comparison purposes. + if (devicePathHasDriveLetter) + { + devicePathWithoutDrive.remove(0,2); + } if (!deployBinaries - && !devicePath.isEmpty() - && (0 == devicePath.compare(project->values("APP_RESOURCE_DIR").join(""), Qt::CaseInsensitive) - || 0 == devicePath.compare(project->values("REG_RESOURCE_IMPORT_DIR").join(""), Qt::CaseInsensitive))) { + && !devicePathWithoutDrive.isEmpty() + && (0 == devicePathWithoutDrive.compare(project->values("APP_RESOURCE_DIR").join(""), Qt::CaseInsensitive) + || 0 == devicePathWithoutDrive.compare(project->values("REG_RESOURCE_IMPORT_DIR").join(""), Qt::CaseInsensitive))) { // Do not deploy resources in emulator builds, as that seems to cause conflicts // If there is ever a real need to deploy pre-built resources for emulator, // BLD_INF_RULES.prj_exports can be used as a workaround. continue; } - bool devicePathHasDriveLetter = false; - if (devicePath.size() > 1) { - devicePathHasDriveLetter = devicePath.at(1) == QLatin1Char(':'); - } - if (devicePath.isEmpty() || devicePath == QLatin1String(".")) { devicePath = targetPath; } @@ -287,19 +205,30 @@ void initProjectDeploySymbian(QMakeProject* project, else if (!(devicePath.at(0) == QLatin1Char('/') || devicePath.at(0) == QLatin1Char('\\') || devicePathHasDriveLetter)) { - // create output path + // Create output path devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('/') + devicePath)); } else { - if (0 == platform.compare(QLatin1String("winscw"), Qt::CaseInsensitive)) { + if (!platform.compare(QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM))) { if (devicePathHasDriveLetter) { devicePath = epocRoot() + "epoc32/winscw/" + devicePath.remove(1, 1); } else { devicePath = epocRoot() + "epoc32/winscw/c" + devicePath; } } else { - // Drive letter needed if targetpath contains one and it is not already in - if (targetPathHasDriveLetter && !devicePathHasDriveLetter) { - devicePath = deploymentDrive + devicePath; + if (!devicePathHasDriveLetter) { + if (!platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) { + //For plugin deployment under ARM no needed drive letter + devicePath = epocRoot() + "epoc32/data/z" + devicePath; + } else if (targetPathHasDriveLetter) { + // Drive letter needed if targetpath contains one and it is not already in + devicePath = deploymentDrive + devicePath; + } + } else { + //it is necessary to delete drive letter for ARM deployment + if (!platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) { + devicePath.remove(0,2); + devicePath = epocRoot() + "epoc32/data/z" + devicePath; + } } } } @@ -397,7 +326,8 @@ void initProjectDeploySymbian(QMakeProject* project, + iterator.fileName()))); } } - createPluginStub(info, devicePath + "/" + absoluteItemPath.right(diffSize), deploymentList, generatedDirs, generatedFiles); + createPluginStub(info, devicePath + "/" + absoluteItemPath.right(diffSize), + deploymentList, generatedDirs, generatedFiles); continue; } else { deploymentList.append(CopyItem( diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.h b/qmake/generators/symbian/initprojectdeploy_symbian.h index 3c515d6..2653d2a 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.h +++ b/qmake/generators/symbian/initprojectdeploy_symbian.h @@ -50,9 +50,9 @@ #include <qfile.h> #include <stdlib.h> -#include "epocroot.h" - #define PLUGIN_STUB_DIR "qmakepluginstubs" +#define ROM_DEPLOYMENT_PLATFORM "rom" +#define EMULATOR_DEPLOYMENT_PLATFORM "emulator" struct CopyItem { diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index 4c8253f..c7f8cd4 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -42,6 +42,9 @@ #include "symbiancommon.h" #include <qdebug.h> +// Included from tools/shared +#include <symbian/epocroot.h> + #define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\" #define RSS_RULES "RSS_RULES" @@ -62,9 +65,16 @@ SymbianCommonGenerator::SymbianCommonGenerator(MakefileGenerator *generator) void SymbianCommonGenerator::init() { QMakeProject *project = generator->project; - fixedTarget = generator->escapeFilePath(project->first("TARGET")); + fixedTarget = project->first("QMAKE_ORIG_TARGET"); + if (fixedTarget.isEmpty()) + fixedTarget = project->first("TARGET"); + fixedTarget = generator->unescapeFilePath(fixedTarget); fixedTarget = removePathSeparators(fixedTarget); - removeSpecialCharacters(fixedTarget); + if (project->first("MAKEFILE_GENERATOR") == "SYMBIAN_ABLD" + || project->first("MAKEFILE_GENERATOR") == "SYMBIAN_SBSV2") + removeEpocSpecialCharacters(fixedTarget); + else + removeSpecialCharacters(fixedTarget); // This should not be empty since the mkspecs are supposed to set it if missing. uid3 = project->first("TARGET.UID3").trimmed(); @@ -114,16 +124,27 @@ void SymbianCommonGenerator::removeSpecialCharacters(QString& str) // When modifying this method check also application_icon.prf str.replace(QString("/"), QString("_")); str.replace(QString("\\"), QString("_")); + str.replace(QString(" "), QString("_")); +} + +void SymbianCommonGenerator::removeEpocSpecialCharacters(QString& str) +{ + // When modifying this method check also application_icon.prf str.replace(QString("-"), QString("_")); str.replace(QString(":"), QString("_")); str.replace(QString("."), QString("_")); - str.replace(QString(" "), QString("_")); + removeSpecialCharacters(str); } void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, DeploymentList &depList, bool epocBuild) { QMakeProject *project = generator->project; - QString pkgFilename = QString("%1_template.%2").arg(fixedTarget).arg("pkg"); + QString pkgTarget = project->first("QMAKE_ORIG_TARGET"); + if (pkgTarget.isEmpty()) + pkgTarget = project->first("TARGET"); + pkgTarget = generator->unescapeFilePath(pkgTarget); + pkgTarget = removePathSeparators(pkgTarget); + QString pkgFilename = QString("%1_template.%2").arg(pkgTarget).arg("pkg"); if (!Option::output_dir.isEmpty()) pkgFilename = Option::output_dir + '/' + pkgFilename; @@ -144,7 +165,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, Deployment // Header info QString wrapperPkgFilename = QString("%1_installer.%2") - .arg(fixedTarget) + .arg(pkgTarget) .arg("pkg"); QString headerComment = "; %1 generated by qmake at %2\n" "; This file is generated by qmake and should not be modified by the user\n" @@ -298,7 +319,6 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, Deployment QDir mifIconDir(project->first("DESTDIR")); QFileInfo mifIcon(mifIconDir.relativeFilePath(project->first("TARGET"))); QString mifIconFileName = mifIcon.fileName(); - mifIconFileName.replace(QRegExp("[-: .]"), "_"); mifIconFileName.append(".mif"); t << QString("\"%1/%2\" - \"!:%3\"") .arg(mifIcon.path()) @@ -380,7 +400,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, Deployment // Wrapped files deployment QString currentPath = qmake_getpwd(); - QString sisName = QString("%1.sis").arg(fixedTarget); + QString sisName = QString("%1.sis").arg(pkgTarget); twf << "\"" << currentPath << "/" << sisName << "\" - \"c:\\adm\\" << sisName << "\"" << endl; QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath); diff --git a/qmake/generators/symbian/symbiancommon.h b/qmake/generators/symbian/symbiancommon.h index 32f9483..9aaa9a1 100644 --- a/qmake/generators/symbian/symbiancommon.h +++ b/qmake/generators/symbian/symbiancommon.h @@ -67,6 +67,7 @@ protected: QString removePathSeparators(QString &file); void removeSpecialCharacters(QString& str); + void removeEpocSpecialCharacters(QString& str); void generatePkgFile(const QString &iconFile, DeploymentList &depList, bool epocBuild); bool containsStartWithItem(const QChar &c, const QStringList& src); diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 75b9a6d..a812e5f 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -49,11 +49,8 @@ #include <stdlib.h> #include <qdebug.h> -#ifdef Q_OS_WIN -#define SCRIPT_EXT ".bat" -#else -#define SCRIPT_EXT ".sh" -#endif +// Included from tools/shared +#include <symbian/epocroot.h> #define RESOURCE_DIRECTORY_MMP "/resource/apps" #define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps" @@ -66,7 +63,7 @@ #define BLD_INF_TAG_MMPFILES "prj_mmpfiles" #define BLD_INF_TAG_TESTMMPFILES "prj_testmmpfiles" #define BLD_INF_TAG_EXTENSIONS "prj_extensions" -#define BLD_INF_TAG_EXPORTS "prj_exports" +#define BLD_INF_TAG_TESTEXTENSIONS "prj_testextensions" #define MMP_TARGET "TARGET" #define MMP_TARGETTYPE "TARGETTYPE" @@ -91,11 +88,13 @@ QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const Q { static QString epocRootStr; if (epocRootStr.isEmpty()) { - QFileInfo efi(epocRoot()); - epocRootStr = efi.canonicalFilePath(); - if (epocRootStr.isEmpty()) { + epocRootStr = epocRoot(); + QFileInfo efi(epocRootStr); + if (!efi.exists() || epocRootStr.isEmpty()) { fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(epocRoot())); epocRootStr = "/"; + } else { + epocRootStr = efi.absoluteFilePath(); } if (!epocRootStr.endsWith("/")) epocRootStr += "/"; @@ -119,33 +118,26 @@ QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const Q return resultPath; } -QString SymbianMakefileGenerator::canonizePath(const QString& origPath) +QString SymbianMakefileGenerator::absolutizePath(const QString& origPath) { - // Since current path gets appended almost always anyway, use it as default - // for nonexisting paths. - static QString defaultPath; - if (defaultPath.isEmpty()) { - QFileInfo fi("."); - defaultPath = fi.canonicalFilePath(); - } - // Prepend epocroot to any paths beginning with "/epoc32/" QString resultPath = QDir::fromNativeSeparators(origPath); if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive)) resultPath = QDir::fromNativeSeparators(epocRoot()) + resultPath.mid(1); QFileInfo fi(fileInfo(resultPath)); - if (fi.isDir()) { - resultPath = fi.canonicalFilePath(); + + // Since origPath can be something given in HEADERS, we need to check if we are dealing + // with a file or a directory. In case the origPath doesn't yet exist, isFile() returns + // false and we default to assuming it is a dir. + if (fi.isFile()) { + resultPath = fi.absolutePath(); } else { - resultPath = fi.canonicalPath(); + resultPath = fi.absoluteFilePath(); } resultPath = QDir::cleanPath(resultPath); - if (resultPath.isEmpty()) - resultPath = defaultPath; - return resultPath; } @@ -176,7 +168,7 @@ void SymbianMakefileGenerator::writeHeader(QTextStream &t) bldinfDefine.append(generate_uid(project->projectFile())); bldinfDefine.prepend("BLD_INF_"); - removeSpecialCharacters(bldinfDefine); + removeEpocSpecialCharacters(bldinfDefine); t << "#define " << bldinfDefine.toUpper() << endl << endl; } @@ -382,7 +374,7 @@ void SymbianMakefileGenerator::initMmpVariables() srcpaths << project->values("UI_DIR"); QDir current = QDir::current(); - QString canonizedCurrent = canonizePath("."); + QString absolutizedCurrent = absolutizePath("."); for (int j = 0; j < srcpaths.size(); ++j) { QFileInfo fi(fileInfo(srcpaths.at(j))); @@ -390,10 +382,10 @@ void SymbianMakefileGenerator::initMmpVariables() if (fi.suffix().startsWith("c")) { if (fi.filePath().length() > fi.fileName().length()) { appendIfnotExist(srcincpaths, fi.path()); - sources[canonizePath(fi.path())] += fi.fileName(); + sources[absolutizePath(fi.path())] += fi.fileName(); } else { - sources[canonizedCurrent] += fi.fileName(); - appendIfnotExist(srcincpaths, canonizedCurrent); + sources[absolutizedCurrent] += fi.fileName(); + appendIfnotExist(srcincpaths, absolutizedCurrent); } } } @@ -407,7 +399,7 @@ void SymbianMakefileGenerator::initMmpVariables() incpaths << project->values("UI_DIR"); for (int j = 0; j < incpaths.size(); ++j) { - QString includepath = canonizePath(incpaths.at(j)); + QString includepath = absolutizePath(incpaths.at(j)); appendIfnotExist(sysincspaths, includepath); appendAbldTempDirs(sysincspaths, includepath); } @@ -449,15 +441,14 @@ void SymbianMakefileGenerator::initMmpVariables() QStringList restrictedMmpKeywords; bool inResourceBlock = false; - overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE); + overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) << QLatin1String(MMP_EPOCHEAPSIZE); restrictableMmpKeywords << QLatin1String(MMP_TARGET) << QLatin1String(MMP_SECUREID) << QLatin1String(MMP_OPTION_CW) << QLatin1String(MMP_OPTION_ARMCC) << QLatin1String(MMP_OPTION_GCCE) << QLatin1String(MMP_LINKEROPTION_CW) << QLatin1String(MMP_LINKEROPTION_ARMCC) << QLatin1String(MMP_LINKEROPTION_GCCE) << QLatin1String(MMP_CAPABILITY) << QLatin1String(MMP_EPOCALLOWDLLDATA) - << QLatin1String(MMP_EPOCHEAPSIZE) << QLatin1String(MMP_EPOCSTACKSIZE) - << QLatin1String(MMP_UID) << QLatin1String(MMP_VENDORID) - << QLatin1String(MMP_VERSION); + << QLatin1String(MMP_EPOCSTACKSIZE) << QLatin1String(MMP_UID) + << QLatin1String(MMP_VENDORID) << QLatin1String(MMP_VERSION); foreach (QString item, project->values("MMP_RULES")) { if (project->values(item).isEmpty()) { @@ -627,6 +618,7 @@ void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) { bool skipTargetType = overriddenMmpKeywords.contains(MMP_TARGETTYPE); + bool skipEpocHeapSize = overriddenMmpKeywords.contains(MMP_EPOCHEAPSIZE); if (targetType == TypeExe) { t << MMP_TARGET "\t\t" << fixedTarget << ".exe" << endl; @@ -678,7 +670,7 @@ void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) if (0 != project->first("TARGET.EPOCSTACKSIZE").size()) t << MMP_EPOCSTACKSIZE "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl; - if (0 != project->values("TARGET.EPOCHEAPSIZE").size()) + if (!skipEpocHeapSize && 0 != project->values("TARGET.EPOCHEAPSIZE").size()) t << MMP_EPOCHEAPSIZE "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl; if (0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) t << MMP_EPOCALLOWDLLDATA << endl; @@ -1035,10 +1027,10 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy QString uid = generate_uid(fullProName); QString bldinfDefine = QString("BLD_INF_") + subdirFileName + QString("_") + uid; bldinfDefine = bldinfDefine.toUpper(); - removeSpecialCharacters(bldinfDefine); + removeEpocSpecialCharacters(bldinfDefine); t << "#ifndef " << bldinfDefine << endl; - t << "\t#include \"" << QDir::toNativeSeparators(bldinfFilename) << "\"" << endl; + t << "\t#include \"" << bldinfFilename << "\"" << endl; t << "#endif // " << bldinfDefine << endl; } @@ -1057,7 +1049,7 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy // Add project mmps and old style extension makefiles QString mmpTag; - if (project->isActiveConfig("symbian_test")) + if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) mmpTag = QLatin1String(BLD_INF_TAG_TESTMMPFILES); else mmpTag = QLatin1String(BLD_INF_TAG_MMPFILES); @@ -1080,35 +1072,22 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy t << item << endl; userBldInfRules.remove(mmpTag); - t << endl << BLD_INF_TAG_EXTENSIONS << endl << endl; + QString extensionTag; + if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) + extensionTag = QLatin1String(BLD_INF_TAG_TESTEXTENSIONS); + else + extensionTag = QLatin1String(BLD_INF_TAG_EXTENSIONS); + + t << endl << extensionTag << endl << endl; // Generate extension rules writeBldInfExtensionRulesPart(t, iconFile); - userItems = userBldInfRules.value(BLD_INF_TAG_EXTENSIONS); - foreach(QString item, userItems) - t << item << endl; - userBldInfRules.remove(BLD_INF_TAG_EXTENSIONS); - - t << endl << BLD_INF_TAG_EXPORTS << endl << endl; - - // Generate export rules - - // Export any deployed plugin stubs under /epoc32/data/z to support ROM builds - for (int i = 0; i < depList.size(); ++i) { - int index = depList.at(i).from.indexOf(PLUGIN_STUB_DIR); - if (index != -1) { - t << QString("%1 /epoc32/data/z%2") - .arg(QString(depList.at(i).from).mid(index).replace('\\','/')) - .arg(QString(depList.at(i).to).mid(2).replace('\\','/')) << endl; - } - } - - userItems = userBldInfRules.value(BLD_INF_TAG_EXPORTS); + userItems = userBldInfRules.value(extensionTag); foreach(QString item, userItems) t << item << endl; - userBldInfRules.remove(BLD_INF_TAG_EXPORTS); + userBldInfRules.remove(extensionTag); // Add rest of the user defined content diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index b915ba7..a7610b0 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -50,9 +50,9 @@ QT_BEGIN_NAMESPACE #define BLD_INF_FILENAME "bld.inf" #define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t" - #define QT_EXTRA_INCLUDE_DIR "tmp" #define MAKE_CACHE_NAME ".make.cache" +#define SYMBIAN_TEST_CONFIG "symbian_test" class SymbianMakefileGenerator : public MakefileGenerator, public SymbianCommonGenerator { @@ -67,7 +67,7 @@ protected: QStringList overriddenMmpKeywords; QString fixPathForMmp(const QString& origPath, const QDir& parentDir); - QString canonizePath(const QString& origPath); + QString absolutizePath(const QString& origPath); virtual bool writeMakefile(QTextStream &t); diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 5dfdacc..1fc87aa 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -48,6 +48,9 @@ #include <qdatetime.h> #include <qdebug.h> +// Included from tools/shared +#include <symbian/epocroot.h> + #define DO_NOTHING_TARGET "do_nothing" #define CREATE_TEMPS_TARGET "create_temps" #define EXTENSION_CLEAN "extension_clean" @@ -56,6 +59,8 @@ #define FINALIZE_TARGET "finalize" #define GENERATED_SOURCES_TARGET "generated_sources" #define ALL_SOURCE_DEPS_TARGET "all_source_deps" +#define DEPLOYMENT_TARGET "deployment" +#define DEPLOYMENT_CLEAN_TARGET "deployment_clean" #define WINSCW_DEPLOYMENT_TARGET "winscw_deployment" #define WINSCW_DEPLOYMENT_CLEAN_TARGET "winscw_deployment_clean" #define STORE_BUILD_TARGET "store_build" @@ -66,7 +71,7 @@ SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) { QString gnuMakefileName = QLatin1String("Makefile_") + uid3; - removeSpecialCharacters(gnuMakefileName); + removeEpocSpecialCharacters(gnuMakefileName); gnuMakefileName.append(".mk"); QFile ft(gnuMakefileName); @@ -109,25 +114,29 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b QStringList wrapperTargets; if (deploymentOnly) { buildDeps.append(STORE_BUILD_TARGET); - cleanDeps.append(DO_NOTHING_TARGET); - cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET); - finalDeps.append(DO_NOTHING_TARGET); - finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET); + cleanDeps.append(DEPLOYMENT_CLEAN_TARGET); + cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET " " DEPLOYMENT_CLEAN_TARGET); + finalDeps.append(DEPLOYMENT_TARGET); + finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET " " DEPLOYMENT_TARGET); wrapperTargets << WINSCW_DEPLOYMENT_TARGET << WINSCW_DEPLOYMENT_CLEAN_TARGET + << DEPLOYMENT_TARGET + << DEPLOYMENT_CLEAN_TARGET << STORE_BUILD_TARGET; } else { buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_TARGET); - cleanDeps.append(EXTENSION_CLEAN); - cleanDepsWinscw.append(EXTENSION_CLEAN " " WINSCW_DEPLOYMENT_CLEAN_TARGET); - finalDeps.append(FINALIZE_TARGET); - finalDepsWinscw.append(FINALIZE_TARGET " " WINSCW_DEPLOYMENT_TARGET); + cleanDeps.append(EXTENSION_CLEAN " " DEPLOYMENT_CLEAN_TARGET); + cleanDepsWinscw.append(EXTENSION_CLEAN " " WINSCW_DEPLOYMENT_CLEAN_TARGET " " DEPLOYMENT_CLEAN_TARGET); + finalDeps.append(FINALIZE_TARGET " " DEPLOYMENT_TARGET); + finalDepsWinscw.append(FINALIZE_TARGET " " WINSCW_DEPLOYMENT_TARGET " " DEPLOYMENT_TARGET); wrapperTargets << PRE_TARGETDEPS_TARGET << CREATE_TEMPS_TARGET << EXTENSION_CLEAN << FINALIZE_TARGET << WINSCW_DEPLOYMENT_CLEAN_TARGET << WINSCW_DEPLOYMENT_TARGET + << DEPLOYMENT_CLEAN_TARGET + << DEPLOYMENT_TARGET << STORE_BUILD_TARGET; } @@ -172,7 +181,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool releasePlatforms.removeAll("winscw"); // No release for emulator QString testClause; - if (project->isActiveConfig("symbian_test")) + if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) testClause = QLatin1String(" test"); else testClause = QLatin1String(""); @@ -366,7 +375,9 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool qDeleteAll(subtargets); } - writeDeploymentTargets(t); + // Deploymend targets for both emulator and rom deployment + writeDeploymentTargets(t, false); + writeDeploymentTargets(t, true); generateDistcleanTargets(t); @@ -407,13 +418,21 @@ void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, Q_UNUSED(iconTargetFile); } -bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t) +bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t, bool isRom) { - t << WINSCW_DEPLOYMENT_TARGET ":" << endl; + if (isRom) + t << DEPLOYMENT_TARGET ":" << endl; + else + t << WINSCW_DEPLOYMENT_TARGET ":" << endl; - QString remoteTestPath = epocRoot() + QLatin1String("epoc32\\winscw\\c\\private\\") + privateDirUid; // default 4 OpenC; 4 all Symbian too + QString remoteTestPath = epocRoot() + + QLatin1String(isRom ? "epoc32\\data\\z\\private\\" : "epoc32\\winscw\\c\\private\\") + + privateDirUid; DeploymentList depList; - initProjectDeploySymbian(project, depList, remoteTestPath, false, true, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles); + + initProjectDeploySymbian(project, depList, remoteTestPath, false, true, + QLatin1String(isRom ? ROM_DEPLOYMENT_PLATFORM : EMULATOR_DEPLOYMENT_PLATFORM), + QString(), generatedDirs, generatedFiles); if (depList.size()) t << "\t-echo Deploying changed files..." << endl; @@ -422,12 +441,17 @@ bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t) // Xcopy prompts for selecting file or directory if target doesn't exist, // and doesn't provide switch to force file selection. It does provide dir forcing, though, // so strip the last part of the destination. - t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \"" << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\") + 1) << "\"" << endl; + t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \"" + << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\") + 1) << "\"" << endl; } t << endl; - t << WINSCW_DEPLOYMENT_CLEAN_TARGET ":" << endl; + if (isRom) + t << DEPLOYMENT_CLEAN_TARGET ":" << endl; + else + t << WINSCW_DEPLOYMENT_CLEAN_TARGET ":" << endl; + QStringList cleanList; for (int i = 0; i < depList.size(); ++i) { cleanList.append(depList.at(i).to); @@ -448,7 +472,7 @@ void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool ad // do not get that, special deployment only makefile is generated for them if needed. if (targetType != TypeSubdirs || addDeploymentExtension) { QString gnuMakefileName = QLatin1String("Makefile_") + uid3; - removeSpecialCharacters(gnuMakefileName); + removeEpocSpecialCharacters(gnuMakefileName); gnuMakefileName.append(".mk"); t << "gnumakefile " << gnuMakefileName << endl; } diff --git a/qmake/generators/symbian/symmake_abld.h b/qmake/generators/symbian/symmake_abld.h index d0f38b0..f998b28 100644 --- a/qmake/generators/symbian/symmake_abld.h +++ b/qmake/generators/symbian/symmake_abld.h @@ -57,7 +57,7 @@ protected: virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath); - bool writeDeploymentTargets(QTextStream &t); + bool writeDeploymentTargets(QTextStream &t, bool isRom); public: diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 421ba15..8c7eabf 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -48,6 +48,9 @@ #include <qdatetime.h> #include <qdebug.h> +// Included from tools/shared +#include <symbian/epocroot.h> + SymbianSbsv2MakefileGenerator::SymbianSbsv2MakefileGenerator() : SymbianMakefileGenerator() { } SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { } @@ -87,6 +90,23 @@ void SymbianSbsv2MakefileGenerator::exportFlm() } } +void SymbianSbsv2MakefileGenerator::writeSbsDeploymentList(const DeploymentList& depList, QTextStream& t) +{ + for (int i = 0; i < depList.size(); ++i) { + t << "START EXTENSION qt/qmake_emulator_deployment" << endl; + QString fromItem = depList.at(i).from; + QString toItem = depList.at(i).to; + fromItem.replace("\\", "/"); + toItem.replace("\\", "/"); +#if defined(Q_OS_WIN) + toItem.prepend(QDir::current().absolutePath().left(2)); // add drive +#endif + t << "OPTION DEPLOY_SOURCE " << fromItem << endl; + t << "OPTION DEPLOY_TARGET " << toItem << endl; + t << "END" << endl; + } +} + void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) { // Can't use extension makefile with sbsv2 @@ -106,7 +126,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo releasePlatforms.removeAll("winscw"); // No release for emulator QString testClause; - if (project->isActiveConfig("symbian_test")) + if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) testClause = QLatin1String(".test"); else testClause = QLatin1String(""); @@ -340,7 +360,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t } } - t << "START EXTENSION qt/qmake_extra_pre_targetdep" << endl; + t << "START EXTENSION qt/qmake_extra_pre_targetdep.export" << endl; t << "OPTION PREDEP_TARGET " << absoluteTarget << endl; t << "OPTION DEPS " << absoluteDeps << endl; @@ -360,27 +380,23 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << endl; - // Write winscw deployment rules + // Write deployment rules QString remoteTestPath = epocRoot() + QLatin1String("epoc32/winscw/c/private/") + privateDirUid; DeploymentList depList; - initProjectDeploySymbian(project, depList, remoteTestPath, false, true, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles); + //write emulator deployment t << "#if defined(WINSCW)" << endl; - for (int i = 0; i < depList.size(); ++i) { - t << "START EXTENSION qt/qmake_emulator_deployment" << endl; - QString fromItem = depList.at(i).from; - QString toItem = depList.at(i).to; - fromItem.replace("\\", "/"); - toItem.replace("\\", "/"); -#if defined(Q_OS_WIN) - toItem.prepend(QDir::current().absolutePath().left(2)); // add drive -#endif - t << "OPTION DEPLOY_SOURCE " << fromItem << endl; - t << "OPTION DEPLOY_TARGET " << toItem << endl; - t << "END" << endl; - } + initProjectDeploySymbian(project, depList, remoteTestPath, false, true, + QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM), QString(), generatedDirs, generatedFiles); + writeSbsDeploymentList(depList, t); t << "#endif" << endl; + //write ROM deployment + remoteTestPath = epocRoot() + QLatin1String("epoc32/data/z/private/") + privateDirUid; + depList.clear(); + initProjectDeploySymbian(project, depList, remoteTestPath, false, true, + QLatin1String(ROM_DEPLOYMENT_PLATFORM), QString(), generatedDirs, generatedFiles); + writeSbsDeploymentList(depList, t); t << endl; // Write post link rules diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h index 5c31249..b8ccdbe 100644 --- a/qmake/generators/symbian/symmake_sbsv2.h +++ b/qmake/generators/symbian/symmake_sbsv2.h @@ -64,6 +64,7 @@ public: private: void exportFlm(); + void writeSbsDeploymentList(const DeploymentList& depList, QTextStream& t); QString extraTargetsCache; QString extraCompilersCache; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 3536a02..f1777e1 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -67,6 +67,7 @@ QT_END_NAMESPACE #ifdef Q_OS_WIN32 #include <qt_windows.h> +#include <windows/registry.h> QT_BEGIN_NAMESPACE @@ -93,102 +94,6 @@ struct { {NETUnknown, "", ""}, }; -static QString keyPath(const QString &rKey) -{ - int idx = rKey.lastIndexOf(QLatin1Char('\\')); - if (idx == -1) - return QString(); - return rKey.left(idx + 1); -} - -static QString keyName(const QString &rKey) -{ - int idx = rKey.lastIndexOf(QLatin1Char('\\')); - if (idx == -1) - return rKey; - - QString res(rKey.mid(idx + 1)); - if (res == "Default" || res == ".") - res = ""; - return res; -} - -static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) -{ - - QString rSubkeyName = keyName(rSubkey); - QString rSubkeyPath = keyPath(rSubkey); - - HKEY handle = 0; - LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle); - - if (res != ERROR_SUCCESS) - return QString(); - - // get the size and type of the value - DWORD dataType; - DWORD dataSize; - res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); - if (res != ERROR_SUCCESS) { - RegCloseKey(handle); - return QString(); - } - - // get the value - QByteArray data(dataSize, 0); - res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0, - reinterpret_cast<unsigned char*>(data.data()), &dataSize); - if (res != ERROR_SUCCESS) { - RegCloseKey(handle); - return QString(); - } - - QString result; - switch (dataType) { - case REG_EXPAND_SZ: - case REG_SZ: { - result = QString::fromWCharArray(((const wchar_t *)data.constData())); - break; - } - - case REG_MULTI_SZ: { - QStringList l; - int i = 0; - for (;;) { - QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i); - i += s.length() + 1; - - if (s.isEmpty()) - break; - l.append(s); - } - result = l.join(", "); - break; - } - - case REG_NONE: - case REG_BINARY: { - result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2); - break; - } - - case REG_DWORD_BIG_ENDIAN: - case REG_DWORD: { - Q_ASSERT(data.size() == sizeof(int)); - int i; - memcpy((char*)&i, data.constData(), sizeof(int)); - result = QString::number(i); - break; - } - - default: - qWarning("QSettings: unknown data %d type in windows registry", dataType); - break; - } - - RegCloseKey(handle); - return result; -} QT_END_NAMESPACE #endif |