qmake/generators/symbian/symmake_sbsv2.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
--- a/qmake/generators/symbian/symmake_sbsv2.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/qmake/generators/symbian/symmake_sbsv2.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -48,6 +48,9 @@
 #include <qdatetime.h>
 #include <qdebug.h>
 
+// Included from tools/shared
+#include <symbian/epocroot.h>
+
 SymbianSbsv2MakefileGenerator::SymbianSbsv2MakefileGenerator() : SymbianMakefileGenerator() { }
 SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { }
 
@@ -91,6 +94,23 @@
     }
 }
 
+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
@@ -110,7 +130,7 @@
     releasePlatforms.removeAll("winscw"); // No release for emulator
 
     QString testClause;
-    if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive))
+    if (project->isActiveConfig(SYMBIAN_TEST_CONFIG))
         testClause = QLatin1String(".test");
     else
         testClause = QLatin1String("");
@@ -131,6 +151,8 @@
     t << "QMAKE             = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
     t << "DEL_FILE          = " << var("QMAKE_DEL_FILE") << endl;
     t << "DEL_DIR           = " << var("QMAKE_DEL_DIR") << endl;
+    t << "CHK_DIR_EXISTS    = " << var("QMAKE_CHK_DIR_EXISTS") << endl;
+    t << "MKDIR             = " << var("QMAKE_MKDIR") << endl;
     t << "MOVE              = " << var("QMAKE_MOVE") << endl;
     t << "DEBUG_PLATFORMS   = " << debugPlatforms.join(" ") << endl;
     t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl;
@@ -175,18 +197,26 @@
         t << "\t$(QMAKE)" << endl;
         t << endl;
 
+        QString winscw("winscw");
         t << "debug: " << BLD_INF_FILENAME << endl;
+        t << "\t$(SBS)";
         foreach(QString item, debugPlatforms) {
-            t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl;
+            if(QString::compare(item, winscw) == 0)
+                t << " -c " << item << "_udeb.mwccinc" << testClause;
+            else
+                t << " -c " << item << "_udeb" << testClause;
         }
         t << endl;
         t << "release: " << BLD_INF_FILENAME << endl;
+        t << "\t$(SBS)";
         foreach(QString item, releasePlatforms) {
-            t << "\t$(SBS) -c " << item << "_urel" << testClause << endl;
+            if(QString::compare(item, winscw) == 0)
+                t << " -c " << item << "_urel.mwccinc" << testClause;
+            else
+                t << " -c " << item << "_urel" << testClause;
         }
         t << endl;
 
-        QString winscw("winscw");
         // For more specific builds, targets are in this form: build-platform, e.g. release-armv5
         foreach(QString item, debugPlatforms) {
             t << "debug-" << item << ": " << BLD_INF_FILENAME << endl;
@@ -235,11 +265,31 @@
     t << "\t-$(SBS) reallyclean" << endl;
     t << endl;
 
-    // create execution target
-    if (debugPlatforms.contains("winscw") && targetType == TypeExe) {
-        t << "run:" << endl;
-        t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << fixedTarget << ".exe" << endl << endl;
+    t << "clean-debug: " << BLD_INF_FILENAME << endl;
+    t << "\t$(SBS) reallyclean";
+    foreach(QString item, debugPlatforms) {
+        t << " -c " << item << "_udeb" << testClause;
+    }
+    t << endl;
+    t << "clean-release: " << BLD_INF_FILENAME << endl;
+    t << "\t$(SBS) reallyclean";
+    foreach(QString item, releasePlatforms) {
+        t << " -c " << item << "_urel" << testClause;
     }
+    t << endl;
+
+    // For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5
+    foreach(QString item, debugPlatforms) {
+        t << "clean-debug-" << item << ": " << BLD_INF_FILENAME << endl;
+        t << "\t$(SBS) reallyclean -c " << item << "_udeb" << testClause << endl;
+    }
+    foreach(QString item, releasePlatforms) {
+        t << "clean-release-" << item << ": " << BLD_INF_FILENAME << endl;
+        t << "\t$(SBS) reallyclean -c " << item << "_urel" << testClause << endl;
+    }
+    t << endl;
+
+    generateExecutionTargets(t, debugPlatforms);
 }
 
 void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile)
@@ -318,7 +368,7 @@
                     }
                 }
 
-                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;
 
@@ -342,41 +392,83 @@
     if (!project->values("SYMBIANTRANSLATIONS").isEmpty() && !translationFilename.isEmpty()) {
         QStringList symbianTranslations = project->values("SYMBIANTRANSLATIONS");
         QString symbianTrPath = project->first("SYMBIANTRANSLATIONDIR");
+        QString symbianTrSrcPath = project->first("SYMBIANTRANSLATIONSRCDIR");    	
+        QString symbianWinscwUdebQmPath = project->first("SYMBIANWINSCWUDEBTRANSLATIONDIR");  
+        QString symbianWinscwUrelQmPath = project->first("SYMBIANWINSCWURELTRANSLATIONDIR");  
         foreach (const QString &symbianTrans, symbianTranslations) {
-            QString translationTsFilename(translationFilename);
-            translationTsFilename.chop(3);
-            translationTsFilename.insert(0,symbianTrPath);
-            translationTsFilename.append(QString::fromLatin1("_"));
-            translationTsFilename.append(symbianTrans);
-            QString translationQmFilename(translationTsFilename);
-            translationTsFilename.append(QString::fromLatin1(".ts"));
-            translationQmFilename.append(QString::fromLatin1(".qm"));
+                    QString translationTsFilename(translationFilename);
+                    translationTsFilename.chop(3);
+                    translationTsFilename.insert(0,symbianTrPath);
+                    translationTsFilename.append(QString::fromLatin1("_"));
+                    translationTsFilename.append(symbianTrans);
+                    QString translationQmFilename(translationTsFilename);
+
+                    translationTsFilename.append(QString::fromLatin1(".ts"));
+                    // output path for armv5 qm files./epoc32/data/z/resource/qt/translations/
+                    translationQmFilename.append(QString::fromLatin1(".qm"));
+
+										// input path for ts files. /epoc32/include/platform/qt/translations/
+                    QString translationTsSrcFilename(translationFilename);
+                    translationTsSrcFilename.chop(3);
+                    translationTsSrcFilename.insert(0,symbianTrSrcPath);
+                    translationTsSrcFilename.append(QString::fromLatin1("_"));
+                    translationTsSrcFilename.append(symbianTrans);	
+                    translationTsSrcFilename.append(QString::fromLatin1(".ts"));
+                    	
+										// output path for winscw qm files. /epoc32/release/winscw/udeb/z/resource/qt/translations/
+                    QString translationQmWinscwUdebFilename(translationFilename);
+                    translationQmWinscwUdebFilename.chop(3);
+                    translationQmWinscwUdebFilename.insert(0,symbianWinscwUdebQmPath);
+                    translationQmWinscwUdebFilename.append(QString::fromLatin1("_"));
+                    translationQmWinscwUdebFilename.append(symbianTrans);
+                    translationQmWinscwUdebFilename.append(QString::fromLatin1(".qm"));                    	
+
+										// output path for winscw qm files. /epoc32/release/winscw/urel/z/resource/qt/translations/
+                    QString translationQmWinscwUrelFilename(translationFilename);
+                    translationQmWinscwUrelFilename.chop(3);
+                    translationQmWinscwUrelFilename.insert(0,symbianWinscwUrelQmPath);
+                    translationQmWinscwUrelFilename.append(QString::fromLatin1("_"));
+                    translationQmWinscwUrelFilename.append(symbianTrans);	
+                    translationQmWinscwUrelFilename.append(QString::fromLatin1(".qm")); 
+            
             t << "START EXTENSION qt/ts2qm" << endl;
-            t << "OPTION TSFILE " << translationTsFilename << endl;
+            t << "OPTION TSFILE " << translationTsSrcFilename << endl;
             t << "OPTION QMFILE " << translationQmFilename << endl;
             t << "END" << endl;
             t << endl;
+            
+            //winscw udeb  
+            t << "START EXTENSION qt/ts2qm" << endl;
+            t << "OPTION TSFILE " << translationTsSrcFilename << endl;
+            t << "OPTION QMFILE " << translationQmWinscwUdebFilename << endl;
+            t << "END" << endl;
+            t << endl;
+            //winscw urel
+            t << "START EXTENSION qt/ts2qm" << endl;
+            t << "OPTION TSFILE " << translationTsSrcFilename << endl;
+            t << "OPTION QMFILE " << translationQmWinscwUrelFilename << endl;
+            t << "END" << endl;
+            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, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles);
 
-    //:QTP:QTPROD-92 Deployment of plugins requires WINSCW build before ARM build
+    //write emulator deployment
     t << "#if defined(WINSCW)" << endl;
-    //write WINSCW deployment
-    writeSbsDeploymentList(depList, t);
-    t << "#else" << endl;
-    //write ARMV5 deployment
-	remoteTestPath = epocRoot() + QLatin1String("epoc32/data/z/private/") + privateDirUid;
-    depList.clear();
-    generatedDirs.clear();
-    generatedFiles.clear();
-    initProjectDeploySymbian(project, depList, remoteTestPath, false, QLatin1String("armv5"), QLatin1String("urel"), generatedDirs, generatedFiles);
+    initProjectDeploySymbian(project, depList, remoteTestPath, false,
+        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,
+        QLatin1String(ROM_DEPLOYMENT_PLATFORM), QString(), generatedDirs, generatedFiles);
+    writeSbsDeploymentList(depList, t);
     t << endl;
 
     // Write post link rules
@@ -414,12 +506,9 @@
         t << "END" << endl;
     }
 
-    /* :QTP:QTPROD-155: Don't write .make.cache during the compilation, it causes dependency problems in
-     * the parallel build clusters
     t << "START EXTENSION qt/qmake_store_build" << endl;
     t << "END" << endl;
     t << endl;
-    */
 
     t << endl;
 }