qmake/generators/symbian/symmake_sbsv2.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the qmake application of the Qt Toolkit.
     7 ** This file is part of the qmake application of the Qt Toolkit.
     8 **
     8 **
    45 #include <qstring.h>
    45 #include <qstring.h>
    46 #include <qstringlist.h>
    46 #include <qstringlist.h>
    47 #include <qdir.h>
    47 #include <qdir.h>
    48 #include <qdatetime.h>
    48 #include <qdatetime.h>
    49 #include <qdebug.h>
    49 #include <qdebug.h>
       
    50 
       
    51 // Included from tools/shared
       
    52 #include <symbian/epocroot.h>
    50 
    53 
    51 SymbianSbsv2MakefileGenerator::SymbianSbsv2MakefileGenerator() : SymbianMakefileGenerator() { }
    54 SymbianSbsv2MakefileGenerator::SymbianSbsv2MakefileGenerator() : SymbianMakefileGenerator() { }
    52 SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { }
    55 SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { }
    53 
    56 
    54 #define FLM_DEST_DIR "epoc32/tools/makefile_templates/qt"
    57 #define FLM_DEST_DIR "epoc32/tools/makefile_templates/qt"
    89         }
    92         }
    90         flmExportDone = true;
    93         flmExportDone = true;
    91     }
    94     }
    92 }
    95 }
    93 
    96 
       
    97 void SymbianSbsv2MakefileGenerator::writeSbsDeploymentList(const DeploymentList& depList, QTextStream& t)
       
    98 {
       
    99     for (int i = 0; i < depList.size(); ++i) {
       
   100         t << "START EXTENSION qt/qmake_emulator_deployment" << endl;
       
   101         QString fromItem = depList.at(i).from;
       
   102         QString toItem = depList.at(i).to;
       
   103         fromItem.replace("\\", "/");
       
   104         toItem.replace("\\", "/");
       
   105 #if defined(Q_OS_WIN)
       
   106         toItem.prepend(QDir::current().absolutePath().left(2)); // add drive
       
   107 #endif
       
   108         t << "OPTION DEPLOY_SOURCE " << fromItem << endl;
       
   109         t << "OPTION DEPLOY_TARGET " << toItem << endl;
       
   110         t << "END" << endl;
       
   111     }
       
   112 }
       
   113 
    94 void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly)
   114 void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly)
    95 {
   115 {
    96     // Can't use extension makefile with sbsv2
   116     // Can't use extension makefile with sbsv2
    97     Q_UNUSED(wrapperFileName);
   117     Q_UNUSED(wrapperFileName);
    98     Q_UNUSED(deploymentOnly);
   118     Q_UNUSED(deploymentOnly);
   108     QStringList debugPlatforms = allPlatforms;
   128     QStringList debugPlatforms = allPlatforms;
   109     QStringList releasePlatforms = allPlatforms;
   129     QStringList releasePlatforms = allPlatforms;
   110     releasePlatforms.removeAll("winscw"); // No release for emulator
   130     releasePlatforms.removeAll("winscw"); // No release for emulator
   111 
   131 
   112     QString testClause;
   132     QString testClause;
   113     if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive))
   133     if (project->isActiveConfig(SYMBIAN_TEST_CONFIG))
   114         testClause = QLatin1String(".test");
   134         testClause = QLatin1String(".test");
   115     else
   135     else
   116         testClause = QLatin1String("");
   136         testClause = QLatin1String("");
   117 
   137 
   118     QTextStream t(&wrapperFile);
   138     QTextStream t(&wrapperFile);
   129     t << endl;
   149     t << endl;
   130     t << "MAKEFILE          = " << wrapperFile.fileName() << endl;
   150     t << "MAKEFILE          = " << wrapperFile.fileName() << endl;
   131     t << "QMAKE             = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
   151     t << "QMAKE             = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
   132     t << "DEL_FILE          = " << var("QMAKE_DEL_FILE") << endl;
   152     t << "DEL_FILE          = " << var("QMAKE_DEL_FILE") << endl;
   133     t << "DEL_DIR           = " << var("QMAKE_DEL_DIR") << endl;
   153     t << "DEL_DIR           = " << var("QMAKE_DEL_DIR") << endl;
       
   154     t << "CHK_DIR_EXISTS    = " << var("QMAKE_CHK_DIR_EXISTS") << endl;
       
   155     t << "MKDIR             = " << var("QMAKE_MKDIR") << endl;
   134     t << "MOVE              = " << var("QMAKE_MOVE") << endl;
   156     t << "MOVE              = " << var("QMAKE_MOVE") << endl;
   135     t << "DEBUG_PLATFORMS   = " << debugPlatforms.join(" ") << endl;
   157     t << "DEBUG_PLATFORMS   = " << debugPlatforms.join(" ") << endl;
   136     t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl;
   158     t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl;
   137     t << "MAKE              = make" << endl;
   159     t << "MAKE              = make" << endl;
   138     t << "SBS               = sbs" << endl;
   160     t << "SBS               = sbs" << endl;
   173         t << endl;
   195         t << endl;
   174         t << BLD_INF_FILENAME ":" << endl;
   196         t << BLD_INF_FILENAME ":" << endl;
   175         t << "\t$(QMAKE)" << endl;
   197         t << "\t$(QMAKE)" << endl;
   176         t << endl;
   198         t << endl;
   177 
   199 
       
   200         QString winscw("winscw");
   178         t << "debug: " << BLD_INF_FILENAME << endl;
   201         t << "debug: " << BLD_INF_FILENAME << endl;
       
   202         t << "\t$(SBS)";
   179         foreach(QString item, debugPlatforms) {
   203         foreach(QString item, debugPlatforms) {
   180             t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl;
   204             if(QString::compare(item, winscw) == 0)
       
   205                 t << " -c " << item << "_udeb.mwccinc" << testClause;
       
   206             else
       
   207                 t << " -c " << item << "_udeb" << testClause;
   181         }
   208         }
   182         t << endl;
   209         t << endl;
   183         t << "release: " << BLD_INF_FILENAME << endl;
   210         t << "release: " << BLD_INF_FILENAME << endl;
       
   211         t << "\t$(SBS)";
   184         foreach(QString item, releasePlatforms) {
   212         foreach(QString item, releasePlatforms) {
   185             t << "\t$(SBS) -c " << item << "_urel" << testClause << endl;
   213             if(QString::compare(item, winscw) == 0)
   186         }
   214                 t << " -c " << item << "_urel.mwccinc" << testClause;
   187         t << endl;
   215             else
   188 
   216                 t << " -c " << item << "_urel" << testClause;
   189         QString winscw("winscw");
   217         }
       
   218         t << endl;
       
   219 
   190         // For more specific builds, targets are in this form: build-platform, e.g. release-armv5
   220         // For more specific builds, targets are in this form: build-platform, e.g. release-armv5
   191         foreach(QString item, debugPlatforms) {
   221         foreach(QString item, debugPlatforms) {
   192             t << "debug-" << item << ": " << BLD_INF_FILENAME << endl;
   222             t << "debug-" << item << ": " << BLD_INF_FILENAME << endl;
   193             if(QString::compare(item, winscw) == 0)
   223             if(QString::compare(item, winscw) == 0)
   194                 t << "\t$(SBS) -c " << item << "_udeb.mwccinc" << testClause << endl;
   224                 t << "\t$(SBS) -c " << item << "_udeb.mwccinc" << testClause << endl;
   233 
   263 
   234     t << "clean: " << BLD_INF_FILENAME << endl;
   264     t << "clean: " << BLD_INF_FILENAME << endl;
   235     t << "\t-$(SBS) reallyclean" << endl;
   265     t << "\t-$(SBS) reallyclean" << endl;
   236     t << endl;
   266     t << endl;
   237 
   267 
   238     // create execution target
   268     t << "clean-debug: " << BLD_INF_FILENAME << endl;
   239     if (debugPlatforms.contains("winscw") && targetType == TypeExe) {
   269     t << "\t$(SBS) reallyclean";
   240         t << "run:" << endl;
   270     foreach(QString item, debugPlatforms) {
   241         t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << fixedTarget << ".exe" << endl << endl;
   271         t << " -c " << item << "_udeb" << testClause;
   242     }
   272     }
       
   273     t << endl;
       
   274     t << "clean-release: " << BLD_INF_FILENAME << endl;
       
   275     t << "\t$(SBS) reallyclean";
       
   276     foreach(QString item, releasePlatforms) {
       
   277         t << " -c " << item << "_urel" << testClause;
       
   278     }
       
   279     t << endl;
       
   280 
       
   281     // For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5
       
   282     foreach(QString item, debugPlatforms) {
       
   283         t << "clean-debug-" << item << ": " << BLD_INF_FILENAME << endl;
       
   284         t << "\t$(SBS) reallyclean -c " << item << "_udeb" << testClause << endl;
       
   285     }
       
   286     foreach(QString item, releasePlatforms) {
       
   287         t << "clean-release-" << item << ": " << BLD_INF_FILENAME << endl;
       
   288         t << "\t$(SBS) reallyclean -c " << item << "_urel" << testClause << endl;
       
   289     }
       
   290     t << endl;
       
   291 
       
   292     generateExecutionTargets(t, debugPlatforms);
   243 }
   293 }
   244 
   294 
   245 void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile)
   295 void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile)
   246 {
   296 {
   247     // Makes sure we have needed FLMs in place.
   297     // Makes sure we have needed FLMs in place.
   316                         absoluteDeps.append(fileInfo(depItem).absoluteFilePath());
   366                         absoluteDeps.append(fileInfo(depItem).absoluteFilePath());
   317                         absoluteDeps.append(" ");
   367                         absoluteDeps.append(" ");
   318                     }
   368                     }
   319                 }
   369                 }
   320 
   370 
   321                 t << "START EXTENSION qt/qmake_extra_pre_targetdep" << endl;
   371                 t << "START EXTENSION qt/qmake_extra_pre_targetdep.export" << endl;
   322                 t << "OPTION PREDEP_TARGET " << absoluteTarget << endl;
   372                 t << "OPTION PREDEP_TARGET " << absoluteTarget << endl;
   323                 t << "OPTION DEPS " << absoluteDeps << endl;
   373                 t << "OPTION DEPS " << absoluteDeps << endl;
   324 
   374 
   325                 if (commandItem.indexOf("$(INCPATH)") != -1)
   375                 if (commandItem.indexOf("$(INCPATH)") != -1)
   326                     commandItem.replace("$(INCPATH)", incPath.join(" "));
   376                     commandItem.replace("$(INCPATH)", incPath.join(" "));
   340 
   390 
   341     QString translationFilename = project->first("TRANSLATIONS");
   391     QString translationFilename = project->first("TRANSLATIONS");
   342     if (!project->values("SYMBIANTRANSLATIONS").isEmpty() && !translationFilename.isEmpty()) {
   392     if (!project->values("SYMBIANTRANSLATIONS").isEmpty() && !translationFilename.isEmpty()) {
   343         QStringList symbianTranslations = project->values("SYMBIANTRANSLATIONS");
   393         QStringList symbianTranslations = project->values("SYMBIANTRANSLATIONS");
   344         QString symbianTrPath = project->first("SYMBIANTRANSLATIONDIR");
   394         QString symbianTrPath = project->first("SYMBIANTRANSLATIONDIR");
       
   395         QString symbianTrSrcPath = project->first("SYMBIANTRANSLATIONSRCDIR");    	
       
   396         QString symbianWinscwUdebQmPath = project->first("SYMBIANWINSCWUDEBTRANSLATIONDIR");  
       
   397         QString symbianWinscwUrelQmPath = project->first("SYMBIANWINSCWURELTRANSLATIONDIR");  
   345         foreach (const QString &symbianTrans, symbianTranslations) {
   398         foreach (const QString &symbianTrans, symbianTranslations) {
   346             QString translationTsFilename(translationFilename);
   399                     QString translationTsFilename(translationFilename);
   347             translationTsFilename.chop(3);
   400                     translationTsFilename.chop(3);
   348             translationTsFilename.insert(0,symbianTrPath);
   401                     translationTsFilename.insert(0,symbianTrPath);
   349             translationTsFilename.append(QString::fromLatin1("_"));
   402                     translationTsFilename.append(QString::fromLatin1("_"));
   350             translationTsFilename.append(symbianTrans);
   403                     translationTsFilename.append(symbianTrans);
   351             QString translationQmFilename(translationTsFilename);
   404                     QString translationQmFilename(translationTsFilename);
   352             translationTsFilename.append(QString::fromLatin1(".ts"));
   405 
   353             translationQmFilename.append(QString::fromLatin1(".qm"));
   406                     translationTsFilename.append(QString::fromLatin1(".ts"));
       
   407                     // output path for armv5 qm files./epoc32/data/z/resource/qt/translations/
       
   408                     translationQmFilename.append(QString::fromLatin1(".qm"));
       
   409 
       
   410 										// input path for ts files. /epoc32/include/platform/qt/translations/
       
   411                     QString translationTsSrcFilename(translationFilename);
       
   412                     translationTsSrcFilename.chop(3);
       
   413                     translationTsSrcFilename.insert(0,symbianTrSrcPath);
       
   414                     translationTsSrcFilename.append(QString::fromLatin1("_"));
       
   415                     translationTsSrcFilename.append(symbianTrans);	
       
   416                     translationTsSrcFilename.append(QString::fromLatin1(".ts"));
       
   417                     	
       
   418 										// output path for winscw qm files. /epoc32/release/winscw/udeb/z/resource/qt/translations/
       
   419                     QString translationQmWinscwUdebFilename(translationFilename);
       
   420                     translationQmWinscwUdebFilename.chop(3);
       
   421                     translationQmWinscwUdebFilename.insert(0,symbianWinscwUdebQmPath);
       
   422                     translationQmWinscwUdebFilename.append(QString::fromLatin1("_"));
       
   423                     translationQmWinscwUdebFilename.append(symbianTrans);
       
   424                     translationQmWinscwUdebFilename.append(QString::fromLatin1(".qm"));                    	
       
   425 
       
   426 										// output path for winscw qm files. /epoc32/release/winscw/urel/z/resource/qt/translations/
       
   427                     QString translationQmWinscwUrelFilename(translationFilename);
       
   428                     translationQmWinscwUrelFilename.chop(3);
       
   429                     translationQmWinscwUrelFilename.insert(0,symbianWinscwUrelQmPath);
       
   430                     translationQmWinscwUrelFilename.append(QString::fromLatin1("_"));
       
   431                     translationQmWinscwUrelFilename.append(symbianTrans);	
       
   432                     translationQmWinscwUrelFilename.append(QString::fromLatin1(".qm")); 
       
   433             
   354             t << "START EXTENSION qt/ts2qm" << endl;
   434             t << "START EXTENSION qt/ts2qm" << endl;
   355             t << "OPTION TSFILE " << translationTsFilename << endl;
   435             t << "OPTION TSFILE " << translationTsSrcFilename << endl;
   356             t << "OPTION QMFILE " << translationQmFilename << endl;
   436             t << "OPTION QMFILE " << translationQmFilename << endl;
   357             t << "END" << endl;
   437             t << "END" << endl;
   358             t << endl;
   438             t << endl;
   359         }
   439             
   360     }
   440             //winscw udeb  
   361 
   441             t << "START EXTENSION qt/ts2qm" << endl;
   362     // Write winscw deployment rules
   442             t << "OPTION TSFILE " << translationTsSrcFilename << endl;
       
   443             t << "OPTION QMFILE " << translationQmWinscwUdebFilename << endl;
       
   444             t << "END" << endl;
       
   445             t << endl;
       
   446             //winscw urel
       
   447             t << "START EXTENSION qt/ts2qm" << endl;
       
   448             t << "OPTION TSFILE " << translationTsSrcFilename << endl;
       
   449             t << "OPTION QMFILE " << translationQmWinscwUrelFilename << endl;
       
   450             t << "END" << endl;
       
   451             t << endl;
       
   452         }
       
   453     }
       
   454 
       
   455     // Write deployment rules
   363     QString remoteTestPath = epocRoot() + QLatin1String("epoc32/winscw/c/private/") + privateDirUid;
   456     QString remoteTestPath = epocRoot() + QLatin1String("epoc32/winscw/c/private/") + privateDirUid;
   364     DeploymentList depList;
   457     DeploymentList depList;
   365     initProjectDeploySymbian(project, depList, remoteTestPath, false, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles);
   458 
   366 
   459     //write emulator deployment
   367     //:QTP:QTPROD-92 Deployment of plugins requires WINSCW build before ARM build
       
   368     t << "#if defined(WINSCW)" << endl;
   460     t << "#if defined(WINSCW)" << endl;
   369     //write WINSCW deployment
   461     initProjectDeploySymbian(project, depList, remoteTestPath, false,
   370     writeSbsDeploymentList(depList, t);
   462         QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM), QString(), generatedDirs, generatedFiles);
   371     t << "#else" << endl;
       
   372     //write ARMV5 deployment
       
   373 	remoteTestPath = epocRoot() + QLatin1String("epoc32/data/z/private/") + privateDirUid;
       
   374     depList.clear();
       
   375     generatedDirs.clear();
       
   376     generatedFiles.clear();
       
   377     initProjectDeploySymbian(project, depList, remoteTestPath, false, QLatin1String("armv5"), QLatin1String("urel"), generatedDirs, generatedFiles);
       
   378     writeSbsDeploymentList(depList, t);
   463     writeSbsDeploymentList(depList, t);
   379     t << "#endif" << endl;
   464     t << "#endif" << endl;
       
   465 
       
   466     //write ROM deployment
       
   467     remoteTestPath = epocRoot() + QLatin1String("epoc32/data/z/private/") + privateDirUid;
       
   468     depList.clear();
       
   469     initProjectDeploySymbian(project, depList, remoteTestPath, false,
       
   470         QLatin1String(ROM_DEPLOYMENT_PLATFORM), QString(), generatedDirs, generatedFiles);
       
   471     writeSbsDeploymentList(depList, t);
   380     t << endl;
   472     t << endl;
   381 
   473 
   382     // Write post link rules
   474     // Write post link rules
   383     if (!project->isEmpty("QMAKE_POST_LINK")) {
   475     if (!project->isEmpty("QMAKE_POST_LINK")) {
   384         t << "START EXTENSION qt/qmake_post_link" << endl;
   476         t << "START EXTENSION qt/qmake_post_link" << endl;
   412         t << "OPTION TARGETFILE " << iconTarget << endl;
   504         t << "OPTION TARGETFILE " << iconTarget << endl;
   413         t << "OPTION SVGENCODINGVERSION 3" << endl; // Compatibility with S60 3.1 devices and up
   505         t << "OPTION SVGENCODINGVERSION 3" << endl; // Compatibility with S60 3.1 devices and up
   414         t << "END" << endl;
   506         t << "END" << endl;
   415     }
   507     }
   416 
   508 
   417     /* :QTP:QTPROD-155: Don't write .make.cache during the compilation, it causes dependency problems in
       
   418      * the parallel build clusters
       
   419     t << "START EXTENSION qt/qmake_store_build" << endl;
   509     t << "START EXTENSION qt/qmake_store_build" << endl;
   420     t << "END" << endl;
   510     t << "END" << endl;
   421     t << endl;
   511     t << endl;
   422     */
       
   423 
   512 
   424     t << endl;
   513     t << endl;
   425 }
   514 }
   426 
   515 
   427 void SymbianSbsv2MakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension)
   516 void SymbianSbsv2MakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension)