summaryrefslogtreecommitdiffstats
path: root/src/3rdparty
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2022-03-31 12:41:13 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-04-25 08:02:24 +0000
commit47b04ea254a43ea70a600b04a3f3410bb3d31363 (patch)
tree1845ba9525cd52b01e4632369fb911dd4160a889 /src/3rdparty
parent9295f31fee5ee5cef71853ef90235eea642122c5 (diff)
zlib as static library
Do build zlib as static 3rdparty library. This makes it easier to disable warnings. Change-Id: I1db331b671b64e68d81c56b0df337983c3bbe7fa Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 48561178e2488e6fe7763c2229d66072810afcb3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/CMakeLists.txt5
-rw-r--r--src/3rdparty/zlib/CMakeLists.txt44
-rw-r--r--src/3rdparty/zlib/qtpatches.diff27
-rw-r--r--src/3rdparty/zlib/src/gzguts.h15
-rw-r--r--src/3rdparty/zlib/src/zutil.h4
5 files changed, 57 insertions, 38 deletions
diff --git a/src/3rdparty/CMakeLists.txt b/src/3rdparty/CMakeLists.txt
index 68113d8bac..a02150e0f1 100644
--- a/src/3rdparty/CMakeLists.txt
+++ b/src/3rdparty/CMakeLists.txt
@@ -26,6 +26,11 @@ if(QT_FEATURE_regularexpression AND NOT QT_FEATURE_system_pcre2)
endif()
qt_install_3rdparty_library_wrap_config_extra_file(BundledPcre2)
+if(NOT QT_FEATURE_system_zlib)
+ add_subdirectory(zlib)
+endif()
+qt_install_3rdparty_library_wrap_config_extra_file(BundledZLIB)
+
if (ANDROID)
add_subdirectory(gradle)
endif()
diff --git a/src/3rdparty/zlib/CMakeLists.txt b/src/3rdparty/zlib/CMakeLists.txt
new file mode 100644
index 0000000000..74335d9ba6
--- /dev/null
+++ b/src/3rdparty/zlib/CMakeLists.txt
@@ -0,0 +1,44 @@
+qt_internal_add_3rdparty_library(BundledZLIB
+ STATIC
+ SOURCES
+ src/adler32.c
+ src/compress.c
+ src/crc32.c
+ src/crc32.h
+ src/deflate.c
+ src/deflate.h
+ src/gzclose.c
+ src/gzguts.h
+ src/gzlib.c
+ src/gzread.c
+ src/gzwrite.c
+ src/infback.c
+ src/inffast.c
+ src/inffast.h
+ src/inffixed.h
+ src/inflate.c
+ src/inflate.h
+ src/inftrees.c
+ src/inftrees.h
+ src/trees.c
+ src/trees.h
+ src/uncompr.c
+ src/zconf.h
+ src/zlib.h
+ src/zutil.c
+ src/zutil.h
+ DEFINES
+ QT_BUILD_CORE_LIB
+ INCLUDE_DIRECTORIES
+ $<TARGET_PROPERTY:Core,INCLUDE_DIRECTORIES>
+)
+
+qt_disable_warnings(BundledZLIB)
+
+qt_set_symbol_visibility_hidden(BundledZLIB)
+
+qt_internal_add_3rdparty_header_module(ZlibPrivate
+ EXTERNAL_HEADERS
+ src/zlib.h
+ src/zconf.h
+)
diff --git a/src/3rdparty/zlib/qtpatches.diff b/src/3rdparty/zlib/qtpatches.diff
index 0666fc2201..07018605a2 100644
--- a/src/3rdparty/zlib/qtpatches.diff
+++ b/src/3rdparty/zlib/qtpatches.diff
@@ -15,24 +15,11 @@ diff -ruN orig/ChangeLog src/ChangeLog
diff -ruN orig/gzguts.h src/gzguts.h
--- orig/gzguts.h
+++ src/gzguts.h
-@@ -3,6 +3,25 @@
+@@ -3,6 +3,12 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-+#ifdef _MSC_VER
-+# ifndef _CRT_SECURE_NO_DEPRECATE
-+# define _CRT_SECURE_NO_DEPRECATE
-+# endif
-+# ifndef _CRT_NONSTDC_NO_DEPRECATE
-+# define _CRT_NONSTDC_NO_DEPRECATE
-+# endif
-+// disable warnings like '=': conversion from 'size_t' to 'unsigned int', possible loss of data
-+# pragma warning(disable: 4267; disable: 4244)
-+#endif
-+
-+#ifndef QT_BOOTSTRAPPED
-+# include <qconfig.h>
-+#endif
++#include <qconfig.h>
+
+#ifdef QT_VISIBILITY_AVAILABLE
+#define HAVE_HIDDEN
@@ -107,13 +94,11 @@ diff -ruN orig/zlib.h src/zlib.h
diff -ruN orig/zutil.h src/zutil.h
--- orig/zutil.h
+++ src/zutil.h
-@@ -13,6 +13,14 @@
+@@ -13,6 +13,12 @@
#ifndef ZUTIL_H
#define ZUTIL_H
-+#ifndef QT_BOOTSTRAPPED
-+# include <qconfig.h>
-+#endif
++#include <qconfig.h>
+
+#ifdef QT_VISIBILITY_AVAILABLE
+#define HAVE_HIDDEN
@@ -122,7 +107,7 @@ diff -ruN orig/zutil.h src/zutil.h
#ifdef HAVE_HIDDEN
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
-@@ -143,6 +151,11 @@
+@@ -143,6 +149,11 @@
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
# include <unix.h> /* for fdopen */
# else
@@ -134,7 +119,7 @@ diff -ruN orig/zutil.h src/zutil.h
# ifndef fdopen
# define fdopen(fd,mode) NULL /* No fdopen() */
# endif
-@@ -166,7 +179,7 @@
+@@ -166,7 +177,7 @@
# define OS_CODE 18
#endif
diff --git a/src/3rdparty/zlib/src/gzguts.h b/src/3rdparty/zlib/src/gzguts.h
index 3ec32af25f..26d2ac9bd0 100644
--- a/src/3rdparty/zlib/src/gzguts.h
+++ b/src/3rdparty/zlib/src/gzguts.h
@@ -3,20 +3,7 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-#ifdef _MSC_VER
-# ifndef _CRT_SECURE_NO_DEPRECATE
-# define _CRT_SECURE_NO_DEPRECATE
-# endif
-# ifndef _CRT_NONSTDC_NO_DEPRECATE
-# define _CRT_NONSTDC_NO_DEPRECATE
-# endif
-// disable warnings like '=': conversion from 'size_t' to 'unsigned int', possible loss of data
-# pragma warning(disable: 4267; disable: 4244)
-#endif
-
-#ifndef QT_BOOTSTRAPPED
-# include <qconfig.h>
-#endif
+#include <qconfig.h>
#ifdef QT_VISIBILITY_AVAILABLE
#define HAVE_HIDDEN
diff --git a/src/3rdparty/zlib/src/zutil.h b/src/3rdparty/zlib/src/zutil.h
index 0d78483358..c535e57eb6 100644
--- a/src/3rdparty/zlib/src/zutil.h
+++ b/src/3rdparty/zlib/src/zutil.h
@@ -13,9 +13,7 @@
#ifndef ZUTIL_H
#define ZUTIL_H
-#ifndef QT_BOOTSTRAPPED
-# include <qconfig.h>
-#endif
+#include <qconfig.h>
#ifdef QT_VISIBILITY_AVAILABLE
#define HAVE_HIDDEN