summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-11-04 13:49:20 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-04 14:37:20 +0100
commitf90080704beb4bde91d05c4eec2c417f604385cb (patch)
treed4cddc3d182521155a872facc4baf5960603cd91
parent1f38cc06cf30510a8eb551937738694f6f040aaf (diff)
windeployqt: Introduce constants and functions for shared library suffixes.
Change-Id: Ic0792d0935115ab8554288979adabd17ea8cf863 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r--src/windeployqt/main.cpp22
-rw-r--r--src/windeployqt/utils.cpp2
-rw-r--r--src/windeployqt/utils.h5
3 files changed, 21 insertions, 8 deletions
diff --git a/src/windeployqt/main.cpp b/src/windeployqt/main.cpp
index 614f0306d..d8d4f8bcf 100644
--- a/src/windeployqt/main.cpp
+++ b/src/windeployqt/main.cpp
@@ -444,7 +444,7 @@ static bool findDependentQtLibraries(const QString &qtBinDir, const QString &bin
class DllDirectoryFileEntryFunction {
public:
explicit DllDirectoryFileEntryFunction(bool debug, const QString &prefix = QLatin1String("*")) :
- m_nameFilter(QStringList(prefix + (debug ? QStringLiteral("d.dll") : QStringLiteral(".dll")))),
+ m_nameFilter(DllDirectoryFileEntryFunction::nameFilter(debug, prefix)),
m_dllDebug(debug) {}
QStringList operator()(const QDir &dir) const
@@ -467,6 +467,15 @@ public:
}
private:
+ static QStringList nameFilter(bool debug, const QString &prefix)
+ {
+ QString result = prefix;
+ if (debug)
+ result += QLatin1Char('d');
+ result += QLatin1String(windowsSharedLibrarySuffix);
+ return QStringList(result);
+ }
+
const NameFilterFileEntryFunction m_nameFilter;
const bool m_dllDebug;
};
@@ -543,9 +552,9 @@ QStringList findQtPlugins(unsigned usedQtModules,
} else {
filter = QLatin1String("*");
}
- const QStringList plugins = platform == Unix ?
- NameFilterFileEntryFunction(QStringList(filter + QStringLiteral(".so")))(subDir) :
- DllDirectoryFileEntryFunction(debug, filter)(subDir);
+ const QStringList plugins = (platform & WindowsBased) ?
+ DllDirectoryFileEntryFunction(debug, filter)(subDir) :
+ NameFilterFileEntryFunction(QStringList(filter + sharedLibrarySuffix(platform)))(subDir);
foreach (const QString &plugin, plugins) {
const QString pluginPath = subDir.absoluteFilePath(plugin);
if (isPlatformPlugin)
@@ -642,12 +651,11 @@ static QString libraryPath(const QString &libraryLocation, const char *name, Pla
result += QLatin1String(name);
if (debug)
result += QLatin1Char('d');
- result += QStringLiteral(".dll");
} else if (platform & UnixBased) {
result += QStringLiteral("lib");
result += QLatin1String(name);
- result += QStringLiteral(".so");
}
+ result += sharedLibrarySuffix(platform);
return result;
}
@@ -697,7 +705,7 @@ static DeployResult deploy(const Options &options,
const QString icuVersion = icuLibs.front().mid(index, numberExpression.matchedLength());
if (optVerboseLevel > 1)
std::printf("Adding ICU version %s\n", qPrintable(icuVersion));
- icuLibs.push_back(QStringLiteral("icudt") + icuVersion + QStringLiteral(".dll"));
+ icuLibs.push_back(QStringLiteral("icudt") + icuVersion + QLatin1String(windowsSharedLibrarySuffix));
}
foreach (const QString &icuLib, icuLibs) {
const QString icuPath = findInPath(icuLib);
diff --git a/src/windeployqt/utils.cpp b/src/windeployqt/utils.cpp
index aa187856e..c054fa7ff 100644
--- a/src/windeployqt/utils.cpp
+++ b/src/windeployqt/utils.cpp
@@ -762,7 +762,7 @@ bool readPeExecutable(const QString &peExecutableFileName, QString *errorMessage
QString findD3dCompiler(Platform platform, unsigned wordSize)
{
const QString prefix = QStringLiteral("D3Dcompiler_");
- const QString suffix = QStringLiteral(".dll");
+ const QString suffix = QLatin1String(windowsSharedLibrarySuffix);
// Get the DLL from Kit 8.0 onwards
const QString kitDir = QString::fromLocal8Bit(qgetenv("WindowsSdkDir"));
if (!kitDir.isEmpty()) {
diff --git a/src/windeployqt/utils.h b/src/windeployqt/utils.h
index 208216cdb..5f789c6d3 100644
--- a/src/windeployqt/utils.h
+++ b/src/windeployqt/utils.h
@@ -101,6 +101,11 @@ QString findSdkTool(const QString &tool);
inline QString normalizeFileName(const QString &name) { return name; }
#endif // !Q_OS_WIN
+static const char windowsSharedLibrarySuffix[] = ".dll";
+static const char unixSharedLibrarySuffix[] = ".so";
+
+inline QString sharedLibrarySuffix(Platform platform) { return QLatin1String((platform & WindowsBased) ? windowsSharedLibrarySuffix : unixSharedLibrarySuffix); }
+
bool createSymbolicLink(const QFileInfo &source, const QString &target, QString *errorMessage);
bool createDirectory(const QString &directory, QString *errorMessage);
QString findInPath(const QString &file);