tools/configure/configureapp.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
child 19 fcece45ef507
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
     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 tools applications of the Qt Toolkit.
     7 ** This file is part of the tools applications of the Qt Toolkit.
     8 **
     8 **
   245     dictionary[ "SCRIPTTOOLS" ]     = "auto";
   245     dictionary[ "SCRIPTTOOLS" ]     = "auto";
   246     dictionary[ "XMLPATTERNS" ]     = "auto";
   246     dictionary[ "XMLPATTERNS" ]     = "auto";
   247     dictionary[ "PHONON" ]          = "auto";
   247     dictionary[ "PHONON" ]          = "auto";
   248     dictionary[ "PHONON_BACKEND" ]  = "yes";
   248     dictionary[ "PHONON_BACKEND" ]  = "yes";
   249     dictionary[ "MULTIMEDIA" ]      = "yes";
   249     dictionary[ "MULTIMEDIA" ]      = "yes";
   250     dictionary[ "AUDIO_BACKEND" ]   = "yes";
   250     dictionary[ "AUDIO_BACKEND" ]   = "auto";
   251     dictionary[ "DIRECTSHOW" ]      = "no";
   251     dictionary[ "DIRECTSHOW" ]      = "no";
   252     dictionary[ "WEBKIT" ]          = "auto";
   252     dictionary[ "WEBKIT" ]          = "auto";
   253     dictionary[ "DECLARATIVE" ]     = "auto";
   253     dictionary[ "DECLARATIVE" ]     = "auto";
   254     dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
   254     dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
   255 
   255 
   480             cout << "Nokia employees and agents are allowed to use this software under" << endl;
   480             cout << "Nokia employees and agents are allowed to use this software under" << endl;
   481             cout << "the authority of Nokia Corporation and/or its subsidiary(-ies)" << endl;
   481             cout << "the authority of Nokia Corporation and/or its subsidiary(-ies)" << endl;
   482             dictionary[ "BUILDNOKIA" ] = "yes";
   482             dictionary[ "BUILDNOKIA" ] = "yes";
   483             dictionary[ "BUILDDEV" ] = "yes";
   483             dictionary[ "BUILDDEV" ] = "yes";
   484             dictionary["LICENSE_CONFIRMED"] = "yes";
   484             dictionary["LICENSE_CONFIRMED"] = "yes";
       
   485             if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
       
   486                 dictionary[ "SYMBIAN_DEFFILES" ] = "no";
       
   487             }
   485         }
   488         }
   486         else if( configCmdLine.at(i) == "-opensource" ) {
   489         else if( configCmdLine.at(i) == "-opensource" ) {
   487             dictionary[ "BUILDTYPE" ] = "opensource";
   490             dictionary[ "BUILDTYPE" ] = "opensource";
   488         }
   491         }
   489         else if( configCmdLine.at(i) == "-commercial" ) {
   492         else if( configCmdLine.at(i) == "-commercial" ) {
   801         else if( configCmdLine.at(i) == "-native-gestures" )
   804         else if( configCmdLine.at(i) == "-native-gestures" )
   802             dictionary[ "NATIVE_GESTURES" ] = "yes";
   805             dictionary[ "NATIVE_GESTURES" ] = "yes";
   803         else if( configCmdLine.at(i) == "-no-native-gestures" )
   806         else if( configCmdLine.at(i) == "-no-native-gestures" )
   804             dictionary[ "NATIVE_GESTURES" ] = "no";
   807             dictionary[ "NATIVE_GESTURES" ] = "no";
   805 #if !defined(EVAL)
   808 #if !defined(EVAL)
   806         // Others ---------------------------------------------------
   809         // Symbian Support -------------------------------------------
   807         else if (configCmdLine.at(i) == "-fpu" )
   810         else if (configCmdLine.at(i) == "-fpu" )
   808         {
   811         {
   809             ++i;
   812             ++i;
   810             if(i==argCount)
   813             if(i==argCount)
   811                 break;
   814                 break;
   812             dictionary[ "ARM_FPU_TYPE" ] = configCmdLine.at(i);
   815             dictionary[ "ARM_FPU_TYPE" ] = configCmdLine.at(i);
   813         }
   816         }
   814 
   817 
   815         // S60 Support -------------------------------------------
       
   816         else if( configCmdLine.at(i) == "-s60" )
   818         else if( configCmdLine.at(i) == "-s60" )
   817             dictionary[ "S60" ]    = "yes";
   819             dictionary[ "S60" ]    = "yes";
   818         else if( configCmdLine.at(i) == "-no-s60" )
   820         else if( configCmdLine.at(i) == "-no-s60" )
   819             dictionary[ "S60" ]    = "no";
   821             dictionary[ "S60" ]    = "no";
   820 
   822 
       
   823         else if( configCmdLine.at(i) == "-usedeffiles" )
       
   824             dictionary[ "SYMBIAN_DEFFILES" ] = "yes";
       
   825         else if( configCmdLine.at(i) == "-no-usedeffiles" )
       
   826             dictionary[ "SYMBIAN_DEFFILES" ] = "no";
       
   827 
       
   828         // Others ---------------------------------------------------
   821         else if (configCmdLine.at(i) == "-fast" )
   829         else if (configCmdLine.at(i) == "-fast" )
   822             dictionary[ "FAST" ] = "yes";
   830             dictionary[ "FAST" ] = "yes";
   823         else if (configCmdLine.at(i) == "-no-fast" )
   831         else if (configCmdLine.at(i) == "-no-fast" )
   824             dictionary[ "FAST" ] = "no";
   832             dictionary[ "FAST" ] = "no";
   825 
   833 
  1469         dictionary[ "ASSISTANT_WEBKIT" ]    = "no";
  1477         dictionary[ "ASSISTANT_WEBKIT" ]    = "no";
  1470         dictionary[ "PHONON" ]              = "yes";
  1478         dictionary[ "PHONON" ]              = "yes";
  1471         dictionary[ "XMLPATTERNS" ]         = "yes";
  1479         dictionary[ "XMLPATTERNS" ]         = "yes";
  1472         dictionary[ "QT_GLIB" ]             = "no";
  1480         dictionary[ "QT_GLIB" ]             = "no";
  1473         dictionary[ "S60" ]                 = "yes";
  1481         dictionary[ "S60" ]                 = "yes";
       
  1482         dictionary[ "SYMBIAN_DEFFILES" ]    = "yes";
  1474         // iconv makes makes apps start and run ridiculously slowly in symbian emulator (HW not tested)
  1483         // iconv makes makes apps start and run ridiculously slowly in symbian emulator (HW not tested)
  1475         // iconv_open seems to return -1 always, so something is probably missing from the platform.
  1484         // iconv_open seems to return -1 always, so something is probably missing from the platform.
  1476         dictionary[ "QT_ICONV" ]            = "no";
  1485         dictionary[ "QT_ICONV" ]            = "no";
  1477         dictionary[ "SCRIPTTOOLS" ]         = "no";
  1486         dictionary[ "SCRIPTTOOLS" ]         = "no";
  1478         dictionary[ "QT_HOST_PREFIX" ]      = dictionary[ "QT_INSTALL_PREFIX" ];
  1487         dictionary[ "QT_HOST_PREFIX" ]      = dictionary[ "QT_INSTALL_PREFIX" ];
  1823         desc("Qt for Symbian OS only:\n\n");
  1832         desc("Qt for Symbian OS only:\n\n");
  1824         desc("FREETYPE", "no",     "-no-freetype",         "Do not compile in Freetype2 support.");
  1833         desc("FREETYPE", "no",     "-no-freetype",         "Do not compile in Freetype2 support.");
  1825         desc("FREETYPE", "yes",    "-qt-freetype",         "Use the libfreetype bundled with Qt.");
  1834         desc("FREETYPE", "yes",    "-qt-freetype",         "Use the libfreetype bundled with Qt.");
  1826         desc(                      "-fpu <flags>",         "VFP type on ARM, supported options: softvfp(default) | vfpv2 | softvfp+vfpv2");
  1835         desc(                      "-fpu <flags>",         "VFP type on ARM, supported options: softvfp(default) | vfpv2 | softvfp+vfpv2");
  1827         desc("S60", "no",          "-no-s60",              "Do not compile in S60 support.");
  1836         desc("S60", "no",          "-no-s60",              "Do not compile in S60 support.");
  1828         desc("S60", "yes",         "-s60",                 "Compile with support for the S60 UI Framework\n");
  1837         desc("S60", "yes",         "-s60",                 "Compile with support for the S60 UI Framework");
       
  1838         desc("SYMBIAN_DEFFILES", "no",  "-no-usedeffiles",  "Disable the usage of DEF files.");
       
  1839         desc("SYMBIAN_DEFFILES", "yes", "-usedeffiles",     "Enable the usage of DEF files.\n");
  1829         return true;
  1840         return true;
  1830     }
  1841     }
  1831     return false;
  1842     return false;
  1832 }
  1843 }
  1833 
  1844 
  2055         available = true;
  2066         available = true;
  2056     } else if (part == "WEBKIT") {
  2067     } else if (part == "WEBKIT") {
  2057         available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-g++");
  2068         available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-g++");
  2058     } else if (part == "DECLARATIVE") {
  2069     } else if (part == "DECLARATIVE") {
  2059         available = QFile::exists(sourcePath + "/src/declarative/qml/qmlcomponent.h");
  2070         available = QFile::exists(sourcePath + "/src/declarative/qml/qmlcomponent.h");
       
  2071     } else if (part == "AUDIO_BACKEND") {
       
  2072         available = true;
       
  2073         if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
       
  2074             QString epocRoot = Environment::symbianEpocRoot();
       
  2075             const QDir epocRootDir(epocRoot);
       
  2076             if (epocRootDir.exists()) {
       
  2077                 QStringList paths;
       
  2078                 paths << "epoc32/release/armv5/lib/mmfdevsound.dso"
       
  2079                       << "epoc32/release/armv5/lib/mmfdevsound.lib"
       
  2080                       << "epoc32/release/winscw/udeb/mmfdevsound.dll"
       
  2081                       << "epoc32/release/winscw/udeb/mmfdevsound.lib"
       
  2082                       << "epoc32/include/mmf/server/sounddevice.h";
       
  2083 
       
  2084                 QStringList::iterator i = paths.begin();
       
  2085                 while (i != paths.end()) {
       
  2086                     const QString &path = epocRoot + *i;
       
  2087                     if (QFile::exists(path))
       
  2088                         i = paths.erase(i);
       
  2089                     else
       
  2090                         ++i;
       
  2091                 }
       
  2092 
       
  2093                 available = (paths.size() == 0);
       
  2094                 if (!available) {
       
  2095                     if (epocRoot.isNull() || epocRoot == "")
       
  2096                         epocRoot = "<empty string>";
       
  2097                     cout << endl
       
  2098                          << "The QtMultimedia audio backend will not be built because required" << endl
       
  2099                          << "support for CMMFDevSound was not found in the SDK." << endl
       
  2100                          << "The SDK which was examined was located at the following path:" << endl
       
  2101                          << "    " << epocRoot << endl
       
  2102                          << "The following required files were missing from the SDK:" << endl;
       
  2103                     QString path;
       
  2104                     foreach (path, paths)
       
  2105                         cout << "    " << path << endl;
       
  2106                     cout << endl;
       
  2107                 }
       
  2108             } else {
       
  2109                 cout << endl
       
  2110                      << "The SDK root was determined to be '" << epocRoot << "'." << endl
       
  2111                      << "This directory was not found, so the SDK could not be checked for" << endl
       
  2112                      << "CMMFDevSound support.  The QtMultimedia audio backend will therefore" << endl
       
  2113                      << "not be built." << endl << endl;
       
  2114                 available = false;
       
  2115             }
       
  2116         }
  2060     }
  2117     }
  2061 
  2118 
  2062     return available;
  2119     return available;
  2063 }
  2120 }
  2064 
  2121 
  2143         dictionary["PHONON"] = checkAvailability("PHONON") ? "yes" : "no";
  2200         dictionary["PHONON"] = checkAvailability("PHONON") ? "yes" : "no";
  2144     if (dictionary["WEBKIT"] == "auto")
  2201     if (dictionary["WEBKIT"] == "auto")
  2145         dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no";
  2202         dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no";
  2146     if (dictionary["DECLARATIVE"] == "auto")
  2203     if (dictionary["DECLARATIVE"] == "auto")
  2147         dictionary["DECLARATIVE"] = checkAvailability("DECLARATIVE") ? "yes" : "no";
  2204         dictionary["DECLARATIVE"] = checkAvailability("DECLARATIVE") ? "yes" : "no";
       
  2205     if (dictionary["AUDIO_BACKEND"] == "auto")
       
  2206         dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no";
  2148 
  2207 
  2149     // Qt/WinCE remote test application
  2208     // Qt/WinCE remote test application
  2150     if (dictionary["CETEST"] == "auto")
  2209     if (dictionary["CETEST"] == "auto")
  2151         dictionary["CETEST"] = checkAvailability("CETEST") ? "yes" : "no";
  2210         dictionary["CETEST"] = checkAvailability("CETEST") ? "yes" : "no";
  2152 
  2211 
  2255     if (!dictionary["USER_BUILD_KEY"].isEmpty())
  2314     if (!dictionary["USER_BUILD_KEY"].isEmpty())
  2256         buildKey += dictionary["USER_BUILD_KEY"] + " ";
  2315         buildKey += dictionary["USER_BUILD_KEY"] + " ";
  2257 
  2316 
  2258     QString build32Key = buildKey + "Windows " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" ");
  2317     QString build32Key = buildKey + "Windows " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" ");
  2259     QString build64Key = buildKey + "Windows x64 " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" ");
  2318     QString build64Key = buildKey + "Windows x64 " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" ");
       
  2319     QString buildSymbianKey = buildKey + "Symbian " + build_options.join(" ") + " " + build_defines.join(" ");
  2260     build32Key = build32Key.simplified();
  2320     build32Key = build32Key.simplified();
  2261     build64Key = build64Key.simplified();
  2321     build64Key = build64Key.simplified();
  2262     build32Key.prepend("#  define ");
  2322     buildSymbianKey = buildSymbianKey.simplified();
  2263     build64Key.prepend("#  define ");
  2323     build32Key.prepend("#   define ");
  2264 
  2324     build64Key.prepend("#   define ");
  2265     QString buildkey = // Debug builds
  2325     buildSymbianKey.prepend("# define ");
  2266                        "#if (defined(_DEBUG) || defined(DEBUG))\n"
  2326 
  2267                        "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
  2327     QString buildkey = "#if defined(__SYMBIAN32__)\n"
       
  2328                        + buildSymbianKey + "\"\n"
       
  2329                        "#else\n"
       
  2330                        // Debug builds
       
  2331                        "# if (defined(_DEBUG) || defined(DEBUG))\n"
       
  2332                        "#  if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
  2268                        + build64Key.arg("debug") + "\"\n"
  2333                        + build64Key.arg("debug") + "\"\n"
       
  2334                        "#  else\n"
       
  2335                        + build32Key.arg("debug") + "\"\n"
       
  2336                        "#  endif\n"
  2269                        "# else\n"
  2337                        "# else\n"
  2270                        + build32Key.arg("debug") + "\"\n"
       
  2271                        "# endif\n"
       
  2272                        "#else\n"
       
  2273                        // Release builds
  2338                        // Release builds
  2274                        "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
  2339                        "#  if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
  2275                        + build64Key.arg("release") + "\"\n"
  2340                        + build64Key.arg("release") + "\"\n"
  2276                        "# else\n"
  2341                        "#  else\n"
  2277                        + build32Key.arg("release") + "\"\n"
  2342                        + build32Key.arg("release") + "\"\n"
       
  2343                        "#  endif\n"
  2278                        "# endif\n"
  2344                        "# endif\n"
  2279                        "#endif\n";
  2345                        "#endif\n";
  2280 
  2346 
  2281     dictionary["BUILD_KEY"] = buildkey;
  2347     dictionary["BUILD_KEY"] = buildkey;
  2282 }
  2348 }
  2527         qtConfig += "phonon";
  2593         qtConfig += "phonon";
  2528         if (dictionary["PHONON_BACKEND"] == "yes")
  2594         if (dictionary["PHONON_BACKEND"] == "yes")
  2529             qtConfig += "phonon-backend";
  2595             qtConfig += "phonon-backend";
  2530     }
  2596     }
  2531 
  2597 
  2532     if (dictionary["MULTIMEDIA"] == "yes")
  2598     if (dictionary["MULTIMEDIA"] == "yes") {
  2533         qtConfig += "multimedia";
  2599         qtConfig += "multimedia";
       
  2600         if (dictionary["AUDIO_BACKEND"] == "yes")
       
  2601             qtConfig += "audio-backend";
       
  2602     }
  2534 
  2603 
  2535     if (dictionary["WEBKIT"] == "yes")
  2604     if (dictionary["WEBKIT"] == "yes")
  2536         qtConfig += "webkit";
  2605         qtConfig += "webkit";
  2537 
  2606 
  2538     if (dictionary["DECLARATIVE"] == "yes")
  2607     if (dictionary["DECLARATIVE"] == "yes")
  2745         if ( dictionary["INCREDIBUILD_XGE"] == "yes" )
  2814         if ( dictionary["INCREDIBUILD_XGE"] == "yes" )
  2746             configStream << " incredibuild_xge";
  2815             configStream << " incredibuild_xge";
  2747         if ( dictionary["PLUGIN_MANIFESTS"] == "no" )
  2816         if ( dictionary["PLUGIN_MANIFESTS"] == "no" )
  2748             configStream << " no_plugin_manifest";
  2817             configStream << " no_plugin_manifest";
  2749 
  2818 
       
  2819         if ( dictionary.contains("SYMBIAN_DEFFILES") ) {
       
  2820             if(dictionary["SYMBIAN_DEFFILES"] == "yes" ) {
       
  2821                 configStream << " def_files";
       
  2822             } else if ( dictionary["SYMBIAN_DEFFILES"] == "no" ) {
       
  2823                 configStream << " def_files_disabled";
       
  2824             }
       
  2825         }
  2750         configStream << endl;
  2826         configStream << endl;
  2751         configStream << "QT_ARCH = " << dictionary[ "ARCHITECTURE" ] << endl;
  2827         configStream << "QT_ARCH = " << dictionary[ "ARCHITECTURE" ] << endl;
  2752         if (dictionary["QT_EDITION"].contains("OPENSOURCE"))
  2828         if (dictionary["QT_EDITION"].contains("OPENSOURCE"))
  2753             configStream << "QT_EDITION = " << QLatin1String("OpenSource") << endl;
  2829             configStream << "QT_EDITION = " << QLatin1String("OpenSource") << endl;
  2754         else
  2830         else
  2771             configStream << "QMAKE_RPATHDIR += " << dictionary["QMAKE_RPATHDIR"] << endl;
  2847             configStream << "QMAKE_RPATHDIR += " << dictionary["QMAKE_RPATHDIR"] << endl;
  2772 
  2848 
  2773         if (!dictionary["QT_LIBINFIX"].isEmpty())
  2849         if (!dictionary["QT_LIBINFIX"].isEmpty())
  2774             configStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl;
  2850             configStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl;
  2775 
  2851 
       
  2852         configStream << "#Qt for Symbian FPU settings" << endl;
  2776         if(!dictionary["ARM_FPU_TYPE"].isEmpty()) {
  2853         if(!dictionary["ARM_FPU_TYPE"].isEmpty()) {
  2777             configStream<<"QMAKE_CXXFLAGS.ARMCC += --fpu "<< dictionary["ARM_FPU_TYPE"];
  2854             configStream<<"MMP_RULES += \"ARMFPU "<< dictionary["ARM_FPU_TYPE"]<< "\"";
  2778         }
  2855         }
  2779 
  2856 
  2780         configStream.flush();
  2857         configStream.flush();
  2781         configFile.close();
  2858         configFile.close();
  2782     }
  2859     }
  3268 
  3345 
  3269     if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("symbian"))) {
  3346     if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("symbian"))) {
  3270         cout << "Support for S60............." << dictionary[ "S60" ] << endl;
  3347         cout << "Support for S60............." << dictionary[ "S60" ] << endl;
  3271     }
  3348     }
  3272 
  3349 
       
  3350     if (dictionary.contains("SYMBIAN_DEFFILES")) {
       
  3351         cout << "Symbian DEF files enabled..." << dictionary[ "SYMBIAN_DEFFILES" ] << endl;
       
  3352         if(dictionary["SYMBIAN_DEFFILES"] == "no") {
       
  3353             cout << "WARNING: Disabling DEF files will mean that Qt is NOT binary compatible with previous versions." << endl;
       
  3354             cout << "         This feature is only intended for use during development, NEVER for release builds." << endl;
       
  3355         }
       
  3356     }
       
  3357 
  3273     if(dictionary["ASSISTANT_WEBKIT"] == "yes")
  3358     if(dictionary["ASSISTANT_WEBKIT"] == "yes")
  3274         cout << "Using WebKit as html rendering engine in Qt Assistant." << endl;
  3359         cout << "Using WebKit as html rendering engine in Qt Assistant." << endl;
  3275 
  3360 
  3276     if(checkAvailability("INCREDIBUILD_XGE"))
  3361     if(checkAvailability("INCREDIBUILD_XGE"))
  3277         cout << "Using IncrediBuild XGE......" << dictionary["INCREDIBUILD_XGE"] << endl;
  3362         cout << "Using IncrediBuild XGE......" << dictionary["INCREDIBUILD_XGE"] << endl;