Changeset 846 for trunk/tools/configure/environment.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/tools/configure/environment.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 61 61 #endif 62 62 63 #include <symbian/epocroot .h> // from tools/shared64 #include <windows/registry .h> // from tools/shared63 #include <symbian/epocroot.h> // from tools/shared 64 #include <windows/registry.h> // from tools/shared 65 65 66 66 QT_BEGIN_NAMESPACE … … 74 74 // The compilers here are sorted in a reversed-preferred order 75 75 {CC_BORLAND, "Borland C++", 0, "bcc32.exe"}, 76 {CC_MINGW, "MinGW (Minimalist GNU for Windows)", 0, " mingw32-gcc.exe"},76 {CC_MINGW, "MinGW (Minimalist GNU for Windows)", 0, ".exe"}, 77 77 {CC_INTEL, "Intel(R) C++ Compiler for 32-bit applications", 0, "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe 78 78 {CC_MSVC6, "Microsoft (R) 32-bit C/C++ Optimizing Compiler (6.x)", "Software\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++\\ProductDir", "cl.exe"}, // link.exe, lib.exe … … 81 81 {CC_NET2005, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2005 (8.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\8.0", "cl.exe"}, // link.exe, lib.exe 82 82 {CC_NET2008, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2008 (9.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\9.0", "cl.exe"}, // link.exe, lib.exe 83 83 84 {CC_UNKNOWN, "Unknown", 0, 0}, 84 85 }; … … 106 107 QString spec; 107 108 switch (detectCompiler()) { 109 110 111 108 112 case CC_NET2008: 109 113 spec = "win32-msvc2008"; … … 160 164 QStringList pathlist = paths.toLower().split(";"); 161 165 for(int i = 0; compiler_info[i].compiler; ++i) { 162 QString productPath = readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey).toLower();166 QString productPath = readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey).toLower(); 163 167 if (productPath.length()) { 164 168 QStringList::iterator it; … … 278 282 } 279 283 // add the user environment 280 for (QStringList::ConstIterator it = environment.begin(); it != environment.end(); it++ ) { 281 QString tmp = *it; 284 foreach (const QString &tmp, environment) { 282 285 uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1); 283 286 envlist.resize(envlist.size() + tmpSize); … … 358 361 QByteArray envlist = qt_create_environment(fullEnv); 359 362 360 DWORD exitCode = -1;363 DWORD exitCode = ; 361 364 PROCESS_INFORMATION procInfo; 362 365 memset(&procInfo, 0, sizeof(procInfo)); … … 379 382 380 383 381 if (exitCode == -1) {384 if (exitCode == ) { 382 385 switch(GetLastError()) { 383 386 case E2BIG: 384 387 cerr << "execute: Argument list exceeds 1024 bytes" << endl; 385 foreach (QStringarg, arguments)388 foreacharg, arguments) 386 389 cerr << " (" << arg.toLocal8Bit().constData() << ")" << endl; 387 390 break; … … 397 400 default: 398 401 cerr << "execute: Unknown error" << endl; 399 foreach (QStringarg, arguments)402 foreacharg, arguments) 400 403 cerr << " (" << arg.toLocal8Bit().constData() << ")" << endl; 401 404 break; … … 405 408 } 406 409 407 bool Environment::cpdir(const QString &srcDir, const QString &destDir) 410 /*! 411 Copies the \a srcDir contents into \a destDir. 412 413 If \a includeSrcDir is not empty, any files with 'h', 'prf', or 'conf' suffixes 414 will not be copied over from \a srcDir. Instead a new file will be created 415 in \a destDir with the same name and that file will include a file with the 416 same name from the \a includeSrcDir using relative path and appropriate 417 syntax for the file type. 418 419 Returns true if copying was successful. 420 */ 421 bool Environment::cpdir(const QString &srcDir, 422 const QString &destDir, 423 const QString &includeSrcDir) 408 424 { 409 425 QString cleanSrcName = QDir::cleanPath(srcDir); 410 426 QString cleanDstName = QDir::cleanPath(destDir); 427 428 411 429 #ifdef CONFIGURE_DEBUG_CP_DIR 412 430 qDebug() << "Attempt to cpdir " << cleanSrcName << "->" << cleanDstName; … … 419 437 bool result = true; 420 438 QDir dir = QDir(cleanSrcName); 439 421 440 QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot); 422 441 for (int i = 0; result && (i < allEntries.count()); ++i) { … … 424 443 bool intermediate = true; 425 444 if (entry.isDir()) { 445 446 447 448 426 449 intermediate = cpdir(QString("%1/%2").arg(cleanSrcName).arg(entry.fileName()), 427 QString("%1/%2").arg(cleanDstName).arg(entry.fileName())); 450 QString("%1/%2").arg(cleanDstName).arg(entry.fileName()), 451 newIncSrcDir); 428 452 } else { 429 453 QString destFile = QString("%1/%2").arg(cleanDstName).arg(entry.fileName()); … … 432 456 #endif 433 457 QFile::remove(destFile); 434 intermediate = QFile::copy(entry.absoluteFilePath(), destFile); 435 SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL); 458 QString suffix = entry.suffix(); 459 if (!includeSrcDir.isEmpty() && (suffix == "prf" || suffix == "conf" || suffix == "h")) { 460 QString relativeIncludeFilePath = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName()); 461 relativeIncludeFilePath = destinationDir.relativeFilePath(relativeIncludeFilePath); 462 #ifdef CONFIGURE_DEBUG_CP_DIR 463 qDebug() << "...instead generate relative include to" << relativeIncludeFilePath; 464 #endif 465 QFile currentFile(destFile); 466 if (currentFile.open(QFile::WriteOnly | QFile::Text)) { 467 QTextStream fileStream; 468 fileStream.setDevice(¤tFile); 469 470 if (suffix == "prf" || suffix == "conf") { 471 if (entry.fileName() == "qmake.conf") { 472 // While QMAKESPEC_ORIGINAL being relative or absolute doesn't matter for the 473 // primary use of this variable by qmake to identify the original mkspec, the 474 // variable is also used for few special cases where the absolute path is required. 475 // Conversely, the include of the original qmake.conf must be done using relative path, 476 // as some Qt binary deployments are done in a manner that doesn't allow for patching 477 // the paths at the installation time. 478 fileStream << "QMAKESPEC_ORIGINAL=" << cleanSrcName << endl << endl; 479 } 480 fileStream << "include(" << relativeIncludeFilePath << ")" << endl << endl; 481 } else if (suffix == "h") { 482 fileStream << "#include \"" << relativeIncludeFilePath << "\"" << endl << endl; 483 } 484 485 fileStream.flush(); 486 currentFile.close(); 487 } 488 } else { 489 intermediate = QFile::copy(entry.absoluteFilePath(), destFile); 490 SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL); 491 } 436 492 } 437 493 if(!intermediate) { … … 464 520 QString Environment::symbianEpocRoot() 465 521 { 466 // Call function defined in tools/shared/symbian/epocroot .h467 return :: epocRoot();522 // Call function defined in tools/shared/symbian/epocroot.h 523 return ::epocRoot(); 468 524 } 469 525
Note:
See TracChangeset
for help on using the changeset viewer.