1 |
From b4a1e98a83598072ea6d720ae4d56d380bee5a75 Mon Sep 17 00:00:00 2001 |
2 |
From: Petr Vanek <petr@yarpen.cz> |
3 |
Date: Sun, 15 Nov 2020 19:15:59 +0100 |
4 |
Subject: [PATCH] fixed #569 Build fails with quazip 1.0 (#576) |
5 |
|
6 |
--- |
7 |
ImageLounge/cmake/Unix.cmake | 28 +++++++++++++++------ |
8 |
ImageLounge/src/DkCore/DkBasicLoader.cpp | 4 +++ |
9 |
ImageLounge/src/DkCore/DkImageContainer.cpp | 4 +++ |
10 |
ImageLounge/src/DkCore/DkImageLoader.cpp | 6 ++++- |
11 |
ImageLounge/src/DkGui/DkDialog.cpp | 4 +++ |
12 |
5 files changed, 37 insertions(+), 9 deletions(-) |
13 |
|
14 |
diff --git a/ImageLounge/cmake/Unix.cmake b/ImageLounge/cmake/Unix.cmake |
15 |
index 5567084b..c90ba320 100644 |
16 |
--- a/ImageLounge/cmake/Unix.cmake |
17 |
+++ b/ImageLounge/cmake/Unix.cmake |
18 |
@@ -102,14 +102,26 @@ unset(QT_ROOT CACHE) |
19 |
|
20 |
if(ENABLE_QUAZIP) |
21 |
if(USE_SYSTEM_QUAZIP) |
22 |
- SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
23 |
- |
24 |
- find_package(QuaZip5 QUIET) |
25 |
- if(NOT QUAZIP_FOUND) |
26 |
- message(FATAL_ERROR "QUAZIP not found. It's mandatory when used with ENABLE_QUAZIP enabled, you can also disable USE_SYSTEM_QUAZIP") |
27 |
- else() |
28 |
- add_definitions(-DWITH_QUAZIP) |
29 |
- endif() |
30 |
+ # Let's try QuaZip1 first (it's the bright future) |
31 |
+ find_package(QuaZip-Qt5 QUIET) |
32 |
+ if (QuaZip-Qt5_FOUND) |
33 |
+ message(STATUS "QUAZIP: QuaZip-1 for Qt5 found") |
34 |
+ set(QUAZIP_LIBRARIES QuaZip::QuaZip) |
35 |
+ add_definitions(-DWITH_QUAZIP1) |
36 |
+ else () |
37 |
+ message(WARNING "QUAZIP: 1.x not found. Trying to find 0.x") |
38 |
+ # QuaZip < 1.0. This leg can be removed (including cmake/FindQuaZip5.cmake) |
39 |
+ # ater the final migration to 1.x in Linux distros |
40 |
+ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
41 |
+ |
42 |
+ find_package(QuaZip5 QUIET) |
43 |
+ if(NOT QUAZIP_FOUND) |
44 |
+ message(FATAL_ERROR "QUAZIP: even 0.x not found. It's mandatory when used with ENABLE_QUAZIP enabled, you can also disable USE_SYSTEM_QUAZIP") |
45 |
+ endif() |
46 |
+ |
47 |
+ endif (QuaZip-Qt5_FOUND) |
48 |
+ # we have any QuaZip after all |
49 |
+ add_definitions(-DWITH_QUAZIP) |
50 |
else() |
51 |
find_package(ZLIB REQUIRED) |
52 |
set(QUAZIP_INCLUDE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/quazip-0.7/quazip ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/quazip-0.7/) |
53 |
diff --git a/ImageLounge/src/DkCore/DkBasicLoader.cpp b/ImageLounge/src/DkCore/DkBasicLoader.cpp |
54 |
index 7f9e889c..b7edfd43 100644 |
55 |
--- a/ImageLounge/src/DkCore/DkBasicLoader.cpp |
56 |
+++ b/ImageLounge/src/DkCore/DkBasicLoader.cpp |
57 |
@@ -54,8 +54,12 @@ |
58 |
|
59 |
// quazip |
60 |
#ifdef WITH_QUAZIP |
61 |
+#ifdef WITH_QUAZIP1 |
62 |
+#include <quazip/JlCompress.h> |
63 |
+#else |
64 |
#include <quazip5/JlCompress.h> |
65 |
#endif |
66 |
+#endif |
67 |
|
68 |
// opencv |
69 |
#ifdef WITH_OPENCV |
70 |
diff --git a/ImageLounge/src/DkCore/DkImageContainer.cpp b/ImageLounge/src/DkCore/DkImageContainer.cpp |
71 |
index 810994d3..150da9c2 100644 |
72 |
--- a/ImageLounge/src/DkCore/DkImageContainer.cpp |
73 |
+++ b/ImageLounge/src/DkCore/DkImageContainer.cpp |
74 |
@@ -41,8 +41,12 @@ |
75 |
|
76 |
// quazip |
77 |
#ifdef WITH_QUAZIP |
78 |
+#ifdef WITH_QUAZIP1 |
79 |
+#include <quazip/JlCompress.h> |
80 |
+#else |
81 |
#include <quazip5/JlCompress.h> |
82 |
#endif |
83 |
+#endif |
84 |
#pragma warning(pop) // no warnings from includes - end |
85 |
|
86 |
#pragma warning(disable: 4251) // TODO: remove |
87 |
diff --git a/ImageLounge/src/DkCore/DkImageLoader.cpp b/ImageLounge/src/DkCore/DkImageLoader.cpp |
88 |
index 09d25d23..e4186f2b 100644 |
89 |
--- a/ImageLounge/src/DkCore/DkImageLoader.cpp |
90 |
+++ b/ImageLounge/src/DkCore/DkImageLoader.cpp |
91 |
@@ -79,8 +79,12 @@ |
92 |
|
93 |
// quazip |
94 |
#ifdef WITH_QUAZIP |
95 |
+#ifdef WITH_QUAZIP1 |
96 |
+#include <quazip/JlCompress.h> |
97 |
+#else |
98 |
#include <quazip5/JlCompress.h> |
99 |
#endif |
100 |
+#endif |
101 |
|
102 |
// opencv |
103 |
#ifdef WITH_OPENCV |
104 |
@@ -2212,4 +2216,4 @@ QString DkImageLoader::fileName() const { |
105 |
return mCurrentImage->fileName(); |
106 |
} |
107 |
|
108 |
-} |
109 |
\ No newline at end of file |
110 |
+} |
111 |
diff --git a/ImageLounge/src/DkGui/DkDialog.cpp b/ImageLounge/src/DkGui/DkDialog.cpp |
112 |
index 008c9a3b..85842eca 100644 |
113 |
--- a/ImageLounge/src/DkGui/DkDialog.cpp |
114 |
+++ b/ImageLounge/src/DkGui/DkDialog.cpp |
115 |
@@ -97,8 +97,12 @@ |
116 |
|
117 |
// quazip |
118 |
#ifdef WITH_QUAZIP |
119 |
+#ifdef WITH_QUAZIP1 |
120 |
+#include <quazip/JlCompress.h> |
121 |
+#else |
122 |
#include <quazip5/JlCompress.h> |
123 |
#endif |
124 |
+#endif |
125 |
|
126 |
#pragma warning(pop) // no warnings from includes - end |
127 |
|