aboutsummarylogtreecommitdiffstats
path: root/0019-Use-.dll.a-as-import-lib-extension.patch
blob: c4aab37c7b12ef78f50e8b5cb5f12766d6d3258b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From 0d4a731b11334260c28484e58b135dba1f716204 Mon Sep 17 00:00:00 2001
From: Martchus <martchus@gmx.net>
Date: Sun, 18 Sep 2016 18:26:18 +0200
Subject: [PATCH 19/33] Use *.dll.a as import lib extension

The variables used here are provided by
g++-win32.conf
---
 mkspecs/features/create_cmake.prf      |  5 +++--
 mkspecs/features/qt.prf                |  5 ++++-
 qmake/generators/win32/winmakefile.cpp | 15 +++++++++++----
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 6bc621ce27..226dc93c4d 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -245,8 +245,9 @@ mac {
             CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.prl
             CMAKE_PRL_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.prl
         } else {
-            CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.a
-            CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
+            isEmpty(QMAKE_EXTENSION_IMPORTLIB): QMAKE_EXTENSION_IMPORTLIB = a
+            CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.$${QMAKE_EXTENSION_IMPORTLIB}
+            CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.$${QMAKE_EXTENSION_IMPORTLIB}
         }
     } else {
         CMAKE_WINMAIN_FILE_LOCATION_DEBUG = qtmain$${QT_LIBINFIX}d.lib
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 3a71376029..d9a306772c 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -213,9 +213,12 @@ for(ever) {
                 LIBS$$var_sfx += -framework $$framework
             } else {
                 lib = $$MODULE_MODULE$$qtPlatformTargetSuffix()
-                win32|contains(MODULE_CONFIG, staticlib) {
+                contains(MODULE_CONFIG, staticlib) {
                     lib = $$MODULE_LIBS/$$QMAKE_PREFIX_STATICLIB$${lib}.$$QMAKE_EXTENSION_STATICLIB
                     PRE_TARGETDEPS += $$lib
+                } else:win32 {
+                    lib = $$MODULE_LIBS/$$QMAKE_PREFIX_STATICLIB$${lib}.$$QMAKE_EXTENSION_IMPORTLIB
+                    PRE_TARGETDEPS += $$lib
                 } else {
                     lib = $$MODULE_LIBS/$$QMAKE_PREFIX_SHLIB$${lib}.$$QMAKE_EXTENSION_SHLIB
                 }
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index d9887cd36d..4f1a4344df 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -80,9 +80,13 @@ Win32MakefileGenerator::parseLibFlag(const ProString &flag, ProString *arg)
 bool
 Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
 {
-    ProStringList impexts = project->values("QMAKE_LIB_EXTENSIONS");
-    if (impexts.isEmpty())
-        impexts = project->values("QMAKE_EXTENSION_STATICLIB");
+    ProStringList impexts;
+    if (project->isActiveConfig("staticlib")) {
+      impexts.append(project->values("QMAKE_EXTENSION_STATICLIB"));
+    } else {
+      impexts.append(project->values("QMAKE_EXTENSION_IMPORTLIB"));
+      impexts.append(project->values("QMAKE_EXTENSION_STATICLIB"));
+    }
     QList<QMakeLocalFileName> dirs;
     int libidx = 0;
     for (const ProString &dlib : project->values("QMAKE_DEFAULT_LIBDIRS"))
@@ -257,9 +261,12 @@ void Win32MakefileGenerator::fixTargetExt()
     if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
         project->values("TARGET_EXT").append(".exe");
     } else if (project->isActiveConfig("shared")) {
+        ProString impext = project->first("QMAKE_EXTENSION_IMPORTLIB");
+        if (impext.isEmpty())
+          impext = project->first("QMAKE_PREFIX_STATICLIB");
         project->values("LIB_TARGET").prepend(project->first("QMAKE_PREFIX_STATICLIB")
                                               + project->first("TARGET") + project->first("TARGET_VERSION_EXT")
-                                              + '.' + project->first("QMAKE_EXTENSION_STATICLIB"));
+                                              + '.' + impext);
         project->values("TARGET_EXT").append(project->first("TARGET_VERSION_EXT") + "."
                 + project->first("QMAKE_EXTENSION_SHLIB"));
         project->values("TARGET").first() = project->first("QMAKE_PREFIX_SHLIB") + project->first("TARGET");
-- 
2.22.0