diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 68745591d2c..ecb0b8e2f3e 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -561,6 +561,11 @@ qt_internal_extend_target(Core CONDITION QT_FEATURE_thread AND WIN32 synchronization ) +qt_internal_extend_target(Core CONDITION CYGWIN + SOURCES + global/qt_windows.h +) + qt_internal_extend_target(Core CONDITION WIN32 SOURCES global/qoperatingsystemversion_win.cpp global/qoperatingsystemversion_win_p.h @@ -1187,6 +1192,10 @@ qt_internal_extend_target(Core CONDITION QT_FEATURE_library SOURCES plugin/qlibrary.cpp plugin/qlibrary.h plugin/qlibrary_p.h ) +qt_internal_extend_target(Core CONDITION QT_FEATURE_library AND CYGWIN + SOURCES + plugin/qcoffpeparser.cpp plugin/qcoffpeparser_p.h +) qt_internal_extend_target(Core CONDITION QT_FEATURE_library AND WIN32 SOURCES plugin/qcoffpeparser.cpp plugin/qcoffpeparser_p.h diff --git a/src/corelib/plugin/qcoffpeparser.cpp b/src/corelib/plugin/qcoffpeparser.cpp index 64c29035840..8fef53a41a5 100644 --- a/src/corelib/plugin/qcoffpeparser.cpp +++ b/src/corelib/plugin/qcoffpeparser.cpp @@ -9,6 +9,9 @@ #include +// Include minimal set of headers +#define WIN32_LEAN_AND_MEAN +#define NOGDI #include QT_BEGIN_NAMESPACE diff --git a/src/corelib/plugin/qcoffpeparser_p.h b/src/corelib/plugin/qcoffpeparser_p.h index 19c650fee06..4a28827a5ef 100644 --- a/src/corelib/plugin/qcoffpeparser_p.h +++ b/src/corelib/plugin/qcoffpeparser_p.h @@ -18,7 +18,7 @@ #include "qlibrary_p.h" -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) QT_BEGIN_NAMESPACE @@ -29,6 +29,6 @@ struct QCoffPeParser QT_END_NAMESPACE -#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU) +#endif // Q_OS_WIN || Q_OS_CYGWIN #endif // QCOFFPEPARSER_H diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 1c6ebdaea39..daf68c5d18a 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -304,7 +304,7 @@ inline void QFactoryLoaderPrivate::updateSinglePath(const QString &path) qCDebug(lcFactoryLoader) << "checking directory path" << path << "..."; QDirListing plugins(path, -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) QStringList(QStringLiteral("*.dll")), #elif defined(Q_OS_ANDROID) QStringList("libplugins_%1_*.so"_L1.arg(suffix)), diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index cc935251421..854d375c72f 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -177,7 +177,7 @@ static QLibraryScanResult qt_find_pattern(const char *s, qsizetype s_len, QStrin return QElfParser::parse({s, s_len}, errMsg); #elif defined(Q_OF_MACH_O) return QMachOParser::parse(s, s_len, errMsg); -#elif defined(Q_OS_WIN) +#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) return QCoffPeParser::parse({s, s_len}, errMsg); #else # warning "Qt does not know how to efficiently parse your platform's binary format; using slow fall-back." @@ -615,7 +615,7 @@ QtPluginInstanceFunction QLibraryPrivate::loadPlugin() */ bool QLibrary::isLibrary(const QString &fileName) { -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) return fileName.endsWith(".dll"_L1, Qt::CaseInsensitive); #else // Generic Unix # if defined(Q_OS_DARWIN) diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h index ebc7c91d26e..f582e20ffed 100644 --- a/src/corelib/plugin/qlibrary_p.h +++ b/src/corelib/plugin/qlibrary_p.h @@ -83,6 +83,8 @@ public: { #ifdef Q_OS_WIN return {}; +#elif defined(Q_OS_CYGWIN) + return u"cyg"; #else return u"lib"; #endif diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index d05a5fa0ac8..e629e2b1f12 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -53,6 +53,12 @@ QStringList QLibraryPrivate::suffixes_sys(const QString &fullVersion) } else { suffixes << ".sl"_L1; } +#elif defined(Q_OS_CYGWIN) + if (!fullVersion.isEmpty()) { + suffixes << "-%1.dll"_L1.arg(fullVersion); + } else { + suffixes << QStringLiteral(".dll"); + } #elif defined(Q_OS_AIX) suffixes << ".a";