diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-06-26 14:04:54 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-06-26 14:04:54 +0200 |
commit | 07333b7f1d7a6eb88534f3f309211468dab2002e (patch) | |
tree | a6659ef7c586c6f700a17fb93bb2a79a140a30ef | |
parent | 162334916bb87feaa6285f9916c87c541615da35 (diff) | |
parent | e1b97bb31a685b1d98d26046c4129f2bf6903af0 (diff) | |
download | qttools-07333b7f1d7a6eb88534f3f309211468dab2002e.tar.gz |
Merge remote-tracking branch 'origin/5.5.0' into 5.5
Change-Id: Idc7ad0119c9b37908fc432b31163a9b9e8f45734
8 files changed, 115 insertions, 52 deletions
diff --git a/src/assistant/3rdparty/clucene/src/CLucene/StdHeader.h b/src/assistant/3rdparty/clucene/src/CLucene/StdHeader.h index 439bc948a..97799142b 100644 --- a/src/assistant/3rdparty/clucene/src/CLucene/StdHeader.h +++ b/src/assistant/3rdparty/clucene/src/CLucene/StdHeader.h @@ -122,7 +122,10 @@ extern int _lucene_counter_break; //can set a watch on this #error "CLucene can't compile without the vector header" #endif -#if !defined(LUCENE_DISABLE_HASHING) && defined(_CL_HAVE_HASH_MAP) && defined(_CL_HAVE_HASH_SET) +#if !defined(LUCENE_DISABLE_HASHING) && defined(_CL_HAVE_STD_UNORDERED_MAP) && defined(_CL_HAVE_STD_UNORDERED_SET) + #include <unordered_map> + #include <unordered_set> +#elif !defined(LUCENE_DISABLE_HASHING) && defined(_CL_HAVE_HASH_MAP) && defined(_CL_HAVE_HASH_SET) //hashing is all or nothing! #include <hash_map> #include <hash_set> diff --git a/src/assistant/3rdparty/clucene/src/CLucene/config/CompilerGcc.h b/src/assistant/3rdparty/clucene/src/CLucene/config/CompilerGcc.h index 3bf91b369..6aac690e2 100644 --- a/src/assistant/3rdparty/clucene/src/CLucene/config/CompilerGcc.h +++ b/src/assistant/3rdparty/clucene/src/CLucene/config/CompilerGcc.h @@ -45,6 +45,8 @@ #define CL_NS_HASHING(func) __gnu_cxx::func #define LUCENE_DISABLE_HASHING //we could enable this, but so far test show that the hashing is slower :( +#define CL_HASH_MAP hash_map +#define CL_HASH_SET hash_set //define the file functions #define fileSeek lseek diff --git a/src/assistant/3rdparty/clucene/src/CLucene/config/CompilerMsvc.h b/src/assistant/3rdparty/clucene/src/CLucene/config/CompilerMsvc.h index 8578859f0..6b3f7683e 100644 --- a/src/assistant/3rdparty/clucene/src/CLucene/config/CompilerMsvc.h +++ b/src/assistant/3rdparty/clucene/src/CLucene/config/CompilerMsvc.h @@ -27,8 +27,22 @@ #if (_MSC_VER < 1310) || defined(_STLPORT_VERSION) #define CL_NS_HASHING(func) std::func //the namespace is different on VC 7.0 #else - #define CL_NS_HASHING(func) stdext::func + #if _MSC_VER >= 1900 + #undef _CL_HAVE_EXT_HASH_MAP + #undef _CL_HAVE_EXT_HASH_SET + + #define CL_HASH_MAP unordered_map + #define CL_HASH_SET unordered_set + #define _CL_HAVE_STD_UNORDERED_MAP 1 + #define _CL_HAVE_STD_UNORDERED_SET 1 + #define CL_NS_HASHING(func) std::func + #else + #define CL_HASH_MAP hash_map + #define CL_HASH_SET hash_set + #define CL_NS_HASHING(func) stdext::func + #endif #endif + #define LUCENE_STATIC_CONSTANT_SYNTAX 1 #if _MSC_FULL_VER >= 140050320 diff --git a/src/assistant/3rdparty/clucene/src/CLucene/debug/condition.cpp b/src/assistant/3rdparty/clucene/src/CLucene/debug/condition.cpp index 855419451..7fab8d71d 100644 --- a/src/assistant/3rdparty/clucene/src/CLucene/debug/condition.cpp +++ b/src/assistant/3rdparty/clucene/src/CLucene/debug/condition.cpp @@ -37,7 +37,7 @@ void _Cnd_OutDebug( const char* FormattedMsg, const char* StrTitle, const char* void __cnd_FormatDebug( const char* File, int32_t Line, int32_t Title, const char* Mes2, int32_t fatal ) { char M[512]; - char* StrTitle = NULL; + const char* StrTitle = NULL; if( Mes2 ) _snprintf(M,512,"file:%s line:%d\n%s",File,Line,Mes2); diff --git a/src/assistant/3rdparty/clucene/src/CLucene/util/VoidList.h b/src/assistant/3rdparty/clucene/src/CLucene/util/VoidList.h index b31baba8a..5deb69dae 100644 --- a/src/assistant/3rdparty/clucene/src/CLucene/util/VoidList.h +++ b/src/assistant/3rdparty/clucene/src/CLucene/util/VoidList.h @@ -139,11 +139,11 @@ public: template<typename _kt, typename _Comparator=CL_NS(util)::Compare::TChar, typename _valueDeletor=CL_NS(util)::Deletor::Dummy> -class CLHashList:public __CLList<_kt, CL_NS_HASHING(hash_set)<_kt,_Comparator> , _valueDeletor> +class CLHashList:public __CLList<_kt, CL_NS_HASHING(CL_HASH_SET)<_kt,_Comparator> , _valueDeletor> { public: CLHashList ( const bool deleteValue=true ): - __CLList<_kt, CL_NS_HASHING(hash_set)<_kt,_Comparator> , _valueDeletor>(deleteValue) + __CLList<_kt, CL_NS_HASHING(CL_HASH_SET)<_kt,_Comparator> , _valueDeletor>(deleteValue) { } }; diff --git a/src/assistant/3rdparty/clucene/src/CLucene/util/VoidMap.h b/src/assistant/3rdparty/clucene/src/CLucene/util/VoidMap.h index 1153a0160..223670204 100644 --- a/src/assistant/3rdparty/clucene/src/CLucene/util/VoidMap.h +++ b/src/assistant/3rdparty/clucene/src/CLucene/util/VoidMap.h @@ -153,16 +153,16 @@ public: //a CLSet with CLHashMap traits template<typename _kt, typename _vt, - typename _Compare, + typename CL_Compare, typename _EqualDummy, typename _KeyDeletor=CL_NS(util)::Deletor::Dummy, typename _ValueDeletor=CL_NS(util)::Deletor::Dummy> class CLHashMap:public __CLMap<_kt,_vt, - CL_NS_STD(map)<_kt,_vt, _Compare>, + CL_NS_STD(map)<_kt,_vt, CL_Compare>, _KeyDeletor,_ValueDeletor> { - typedef typename CL_NS_STD(map)<_kt,_vt,_Compare> _base; - typedef __CLMap<_kt, _vt, CL_NS_STD(map)<_kt,_vt, _Compare>, + typedef typename CL_NS_STD(map)<_kt,_vt,CL_Compare> _base; + typedef __CLMap<_kt, _vt, CL_NS_STD(map)<_kt,_vt, CL_Compare>, _KeyDeletor,_ValueDeletor> _this; public: CLHashMap ( const bool deleteKey=false, const bool deleteValue=false ) @@ -180,10 +180,10 @@ template<typename _kt, typename _vt, typename _KeyDeletor=CL_NS(util)::Deletor::Dummy, typename _ValueDeletor=CL_NS(util)::Deletor::Dummy> class CLHashMap:public __CLMap<_kt,_vt, - CL_NS_HASHING(hash_map)<_kt,_vt, _Hasher,_Equals>, + CL_NS_HASHING(CL_HASH_MAP)<_kt,_vt, _Hasher,_Equals>, _KeyDeletor,_ValueDeletor> { - typedef __CLMap<_kt,_vt, CL_NS_HASHING(hash_map)<_kt,_vt, _Hasher,_Equals>, + typedef __CLMap<_kt,_vt, CL_NS_HASHING(CL_HASH_MAP)<_kt,_vt, _Hasher,_Equals>, _KeyDeletor,_ValueDeletor> _this; public: CLHashMap ( const bool deleteKey=false, const bool deleteValue=false ) @@ -201,10 +201,10 @@ template<typename _kt, typename _vt, typename _KeyDeletor=CL_NS(util)::Deletor::Dummy, typename _ValueDeletor=CL_NS(util)::Deletor::Dummy> class CLHashMap:public __CLMap<_kt,_vt, - CL_NS_HASHING(hash_map)<_kt,_vt, _Hasher>, + CL_NS_HASHING(CL_HASH_MAP)<_kt,_vt, _Hasher>, _KeyDeletor,_ValueDeletor> { - typedef __CLMap<_kt,_vt, CL_NS_HASHING(hash_map)<_kt,_vt, _Hasher>, + typedef __CLMap<_kt,_vt, CL_NS_HASHING(CL_HASH_MAP)<_kt,_vt, _Hasher>, _KeyDeletor,_ValueDeletor> _this; public: CLHashMap ( const bool deleteKey=false, const bool deleteValue=false ) @@ -218,15 +218,15 @@ public: //A collection that contains no duplicates //does not guarantee that the order will remain constant over time template<typename _kt, typename _vt, - typename _Compare, + typename CL_Compare, typename _KeyDeletor=CL_NS(util)::Deletor::Dummy, typename _ValueDeletor=CL_NS(util)::Deletor::Dummy> class CLSet:public __CLMap<_kt,_vt, - CL_NS_STD(map)<_kt,_vt, _Compare>, + CL_NS_STD(map)<_kt,_vt, CL_Compare>, _KeyDeletor,_ValueDeletor> { - typedef typename CL_NS_STD(map)<_kt,_vt,_Compare> _base; - typedef __CLMap<_kt, _vt, CL_NS_STD(map)<_kt,_vt, _Compare>, + typedef typename CL_NS_STD(map)<_kt,_vt,CL_Compare> _base; + typedef __CLMap<_kt, _vt, CL_NS_STD(map)<_kt,_vt, CL_Compare>, _KeyDeletor,_ValueDeletor> _this; public: CLSet ( const bool deleteKey=false, const bool deleteValue=false ) diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index 1c9b319ad..e2c4a19bc 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -739,13 +739,17 @@ void changeInstallName(const QString &bundlePath, const FrameworkInfo &framework } } -void deployRPaths(const QSet<QString> &rpaths, const QString &binaryPath, bool useLoaderPath) +void deployRPaths(const QString &bundlePath, const QSet<QString> &rpaths, const QString &binaryPath, bool useLoaderPath) { + const QString absFrameworksPath = QFileInfo(bundlePath).absoluteFilePath() + + QLatin1String("/Contents/Frameworks"); + const QString relativeFrameworkPath = QFileInfo(binaryPath).absoluteDir().relativeFilePath(absFrameworksPath); + const QString loaderPathToFrameworks = QLatin1String("@loader_path/") + relativeFrameworkPath; bool rpathToFrameworksFound = false; QStringList args; foreach (const QString &rpath, getBinaryRPaths(binaryPath, false)) { if (rpath == "@executable_path/../Frameworks" || - rpath == "@loader_path/../Frameworks") { + rpath == loaderPathToFrameworks) { rpathToFrameworksFound = true; continue; } @@ -760,7 +764,7 @@ void deployRPaths(const QSet<QString> &rpaths, const QString &binaryPath, bool u if (!useLoaderPath) { args << "-add_rpath" << "@executable_path/../Frameworks"; } else { - args << "-add_rpath" << "@loader_path/../Frameworks"; + args << "-add_rpath" << loaderPathToFrameworks; } } LogDebug() << "Using install_name_tool:"; @@ -769,10 +773,10 @@ void deployRPaths(const QSet<QString> &rpaths, const QString &binaryPath, bool u runInstallNameTool(QStringList() << args << binaryPath); } -void deployRPaths(const QSet<QString> &rpaths, const QStringList &binaryPaths, bool useLoaderPath) +void deployRPaths(const QString &bundlePath, const QSet<QString> &rpaths, const QStringList &binaryPaths, bool useLoaderPath) { foreach (const QString &binary, binaryPaths) { - deployRPaths(rpaths, binary, useLoaderPath); + deployRPaths(bundlePath, rpaths, binary, useLoaderPath); } } @@ -873,7 +877,8 @@ DeploymentInfo deployQtFrameworks(QList<FrameworkInfo> frameworks, } } } - deployRPaths(rpathsUsed, binaryPaths, useLoaderPath); + deploymentInfo.deployedFrameworks = copiedFrameworks; + deployRPaths(bundlePath, rpathsUsed, binaryPaths, useLoaderPath); deploymentInfo.rpathsUsed += rpathsUsed; return deploymentInfo; } diff --git a/src/windeployqt/utils.cpp b/src/windeployqt/utils.cpp index 081c9c475..e7a755500 100644 --- a/src/windeployqt/utils.cpp +++ b/src/windeployqt/utils.cpp @@ -35,6 +35,8 @@ #include "elfreader.h" #include <QtCore/QString> +#include <QtCore/QDebug> +#include <QtCore/QDir> #include <QtCore/QFile> #include <QtCore/QFileInfo> #include <QtCore/QTemporaryFile> @@ -723,6 +725,52 @@ inline QStringList readImportSections(const ImageNtHeader *ntHeaders, const void return result; } +// Check for MSCV runtime (MSVCP90D.dll/MSVCP90.dll, MSVCP120D.dll/MSVCP120.dll +// or msvcp120d_app.dll/msvcp120_app.dll). +enum MsvcDebugRuntimeResult { MsvcDebugRuntime, MsvcReleaseRuntime, NoMsvcRuntime }; + +static inline MsvcDebugRuntimeResult checkMsvcDebugRuntime(const QStringList &dependentLibraries) +{ + foreach (const QString &lib, dependentLibraries) { + if (lib.startsWith(QLatin1String("MSVCR"), Qt::CaseInsensitive) + || lib.startsWith(QLatin1String("MSVCP"), Qt::CaseInsensitive)) { + int pos = 5; + if (lib.at(pos).isDigit()) { + for (++pos; lib.at(pos).isDigit(); ++pos) + ; + return lib.at(pos).toLower() == QLatin1Char('d') + ? MsvcDebugRuntime : MsvcReleaseRuntime; + } + } + } + return NoMsvcRuntime; +} + +template <class ImageNtHeader> +inline void determineDebugAndDependentLibs(const ImageNtHeader *nth, const void *fileMemory, + bool isMinGW, + QStringList *dependentLibrariesIn, + bool *isDebugIn, QString *errorMessage) +{ + const bool hasDebugEntry = nth->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size; + QStringList dependentLibraries; + if (dependentLibrariesIn || (isDebugIn && hasDebugEntry && !isMinGW)) + dependentLibraries = readImportSections(nth, fileMemory, errorMessage); + + if (dependentLibrariesIn) + *dependentLibrariesIn = dependentLibraries; + if (isDebugIn) { + if (isMinGW) { + // Use logic that's used e.g. in objdump / pfd library + *isDebugIn = !(nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED); + } else { + // When an MSVC debug entry is present, check whether the debug runtime + // is actually used to detect -release / -force-debug-info builds. + *isDebugIn = hasDebugEntry && checkMsvcDebugRuntime(dependentLibraries) != MsvcReleaseRuntime; + } + } +} + // Read a PE executable and determine dependent libraries, word size // and debug flags. bool readPeExecutable(const QString &peExecutableFileName, QString *errorMessage, @@ -769,40 +817,31 @@ bool readPeExecutable(const QString &peExecutableFileName, QString *errorMessage const unsigned wordSize = ntHeaderWordSize(ntHeaders); if (wordSizeIn) *wordSizeIn = wordSize; - bool debug = false; if (wordSize == 32) { - const IMAGE_NT_HEADERS32 *ntHeaders32 = reinterpret_cast<const IMAGE_NT_HEADERS32 *>(ntHeaders); - - if (!isMinGW) { - debug = ntHeaders32->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size; - } else { - // Use logic that's used e.g. in objdump / pfd library - debug = !(ntHeaders32->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED); - } - - if (dependentLibrariesIn) - *dependentLibrariesIn = readImportSections(ntHeaders32, fileMemory, errorMessage); - + determineDebugAndDependentLibs(reinterpret_cast<const IMAGE_NT_HEADERS32 *>(ntHeaders), + fileMemory, isMinGW, dependentLibrariesIn, isDebugIn, errorMessage); } else { - const IMAGE_NT_HEADERS64 *ntHeaders64 = reinterpret_cast<const IMAGE_NT_HEADERS64 *>(ntHeaders); - - if (!isMinGW) { - debug = ntHeaders64->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size; - } else { - // Use logic that's used e.g. in objdump / pfd library - debug = !(ntHeaders64->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED); - } - - if (dependentLibrariesIn) - *dependentLibrariesIn = readImportSections(ntHeaders64, fileMemory, errorMessage); + determineDebugAndDependentLibs(reinterpret_cast<const IMAGE_NT_HEADERS64 *>(ntHeaders), + fileMemory, isMinGW, dependentLibrariesIn, isDebugIn, errorMessage); } - if (isDebugIn) - *isDebugIn = debug; result = true; - if (optVerboseLevel > 1) - std::wcout << __FUNCTION__ << ": " << peExecutableFileName - << ' ' << wordSize << " bit, debug: " << debug << '\n'; + if (optVerboseLevel > 1) { + std::wcout << __FUNCTION__ << ": " << QDir::toNativeSeparators(peExecutableFileName) + << ' ' << wordSize << " bit"; + if (isMinGW) + std::wcout << ", MinGW"; + if (dependentLibrariesIn) { + std::wcout << ", dependent libraries: "; + if (optVerboseLevel > 2) + std::wcout << dependentLibrariesIn->join(QLatin1Char(' ')); + else + std::wcout << dependentLibrariesIn->size(); + } + if (isDebugIn) + std::wcout << (*isDebugIn ? ", debug" : ", release"); + std::wcout << '\n'; + } } while (false); if (fileMemory) |