mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-28 01:49:33 -06:00
replace zlib with zlib-ng
since the benefits are so high, don't link with shared zlib
This commit is contained in:
14
Externals/zlib-ng/CMakeLists.txt
vendored
Normal file
14
Externals/zlib-ng/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
set(ZLIB_ENABLE_TESTS OFF)
|
||||
set(ZLIB_COMPAT ON)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared library" OFF)
|
||||
|
||||
add_subdirectory(zlib-ng)
|
||||
|
||||
# Set ZLIB variables for find_package used by other projects
|
||||
set(ZLIB_INCLUDE_DIR ${CMAKE_BINARY_DIR}/zlib-ng CACHE STRING "Path to zlib include directory")
|
||||
set(ZLIB_LIBRARY ZLIB::ZLIB CACHE STRING "Path to zlib library")
|
||||
|
||||
# Setup zlib alias project so FindZLIB doesn't recreate it
|
||||
add_library(ZLIB::ZLIB ALIAS zlib)
|
||||
dolphin_disable_warnings_msvc(zlib)
|
195
Externals/zlib-ng/zconf.h
vendored
Normal file
195
Externals/zlib-ng/zconf.h
vendored
Normal file
@ -0,0 +1,195 @@
|
||||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#ifndef ZCONF_H
|
||||
#define ZCONF_H
|
||||
|
||||
#include "zlib_name_mangling.h"
|
||||
|
||||
#if !defined(_WIN32) && defined(__WIN32__)
|
||||
# define _WIN32
|
||||
#endif
|
||||
|
||||
/* Clang macro for detecting declspec support
|
||||
* https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute
|
||||
*/
|
||||
#ifndef __has_declspec_attribute
|
||||
# define __has_declspec_attribute(x) 0
|
||||
#endif
|
||||
|
||||
#if defined(ZLIB_CONST) && !defined(z_const)
|
||||
# define z_const const
|
||||
#else
|
||||
# define z_const
|
||||
#endif
|
||||
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
#ifndef MAX_MEM_LEVEL
|
||||
# define MAX_MEM_LEVEL 9
|
||||
#endif
|
||||
|
||||
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
|
||||
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
|
||||
* created by gzip. (Files created by minigzip can still be extracted by
|
||||
* gzip.)
|
||||
*/
|
||||
#ifndef MAX_WBITS
|
||||
# define MAX_WBITS 15 /* 32K LZ77 window */
|
||||
#endif
|
||||
|
||||
/* The memory requirements for deflate are (in bytes):
|
||||
(1 << (windowBits+2)) + (1 << (memLevel+9))
|
||||
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
|
||||
plus a few kilobytes for small objects. For example, if you want to reduce
|
||||
the default memory requirements from 256K to 128K, compile with
|
||||
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
|
||||
Of course this will generally degrade compression (there's no free lunch).
|
||||
|
||||
The memory requirements for inflate are (in bytes) 1 << windowBits
|
||||
that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
|
||||
for small objects.
|
||||
*/
|
||||
|
||||
/* Type declarations */
|
||||
|
||||
|
||||
#ifndef OF /* function prototypes */
|
||||
# define OF(args) args
|
||||
#endif
|
||||
|
||||
#ifdef ZLIB_INTERNAL
|
||||
# define Z_INTERNAL ZLIB_INTERNAL
|
||||
#endif
|
||||
|
||||
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||
* This is not mandatory, but it offers a little performance increase.
|
||||
*/
|
||||
#if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport)))
|
||||
# ifdef Z_INTERNAL
|
||||
# define Z_EXTERN extern __declspec(dllexport)
|
||||
# else
|
||||
# define Z_EXTERN extern __declspec(dllimport)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||
* define ZLIB_WINAPI.
|
||||
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||
*/
|
||||
#if defined(ZLIB_WINAPI) && defined(_WIN32)
|
||||
# include <windows.h>
|
||||
/* No need for _export, use ZLIB.DEF instead. */
|
||||
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||
# define Z_EXPORT WINAPI
|
||||
# define Z_EXPORTVA WINAPIV
|
||||
#endif
|
||||
|
||||
#ifndef Z_EXTERN
|
||||
# define Z_EXTERN extern
|
||||
#endif
|
||||
#ifndef Z_EXPORT
|
||||
# define Z_EXPORT
|
||||
#endif
|
||||
#ifndef Z_EXPORTVA
|
||||
# define Z_EXPORTVA
|
||||
#endif
|
||||
|
||||
/* Conditional exports */
|
||||
#define ZNG_CONDEXPORT Z_INTERNAL
|
||||
|
||||
/* For backwards compatibility */
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN Z_EXTERN
|
||||
#endif
|
||||
#ifndef ZEXPORT
|
||||
# define ZEXPORT Z_EXPORT
|
||||
#endif
|
||||
#ifndef ZEXPORTVA
|
||||
# define ZEXPORTVA Z_EXPORTVA
|
||||
#endif
|
||||
|
||||
/* Fallback for something that includes us. */
|
||||
typedef unsigned char Byte;
|
||||
typedef Byte Bytef;
|
||||
|
||||
typedef unsigned int uInt; /* 16 bits or more */
|
||||
typedef unsigned long uLong; /* 32 bits or more */
|
||||
|
||||
typedef char charf;
|
||||
typedef int intf;
|
||||
typedef uInt uIntf;
|
||||
typedef uLong uLongf;
|
||||
|
||||
typedef void const *voidpc;
|
||||
typedef void *voidpf;
|
||||
typedef void *voidp;
|
||||
|
||||
typedef uint32_t z_crc_t;
|
||||
|
||||
#if 0 /* was set to #if 0 by configure/cmake/etc */
|
||||
# define Z_HAVE_UNISTD_H
|
||||
#endif
|
||||
|
||||
#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */
|
||||
typedef PTRDIFF_TYPE ptrdiff_t;
|
||||
#endif
|
||||
|
||||
#include <sys/types.h> /* for off_t */
|
||||
|
||||
#include <stddef.h> /* for wchar_t and NULL */
|
||||
|
||||
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
|
||||
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
|
||||
* though the former does not conform to the LFS document), but considering
|
||||
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
|
||||
* equivalently requesting no 64-bit operations
|
||||
*/
|
||||
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
|
||||
# undef _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
|
||||
#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
|
||||
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
|
||||
# ifndef z_off_t
|
||||
# define z_off_t off_t
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
|
||||
# define Z_LFS64
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
|
||||
# define Z_LARGE64
|
||||
#endif
|
||||
|
||||
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
|
||||
# define Z_WANT64
|
||||
#endif
|
||||
|
||||
#if !defined(SEEK_SET)
|
||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||
# define SEEK_CUR 1 /* Seek from current position. */
|
||||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||
#endif
|
||||
|
||||
#ifndef z_off_t
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) && defined(Z_LARGE64)
|
||||
# define z_off64_t off64_t
|
||||
#else
|
||||
# if defined(__MSYS__)
|
||||
# define z_off64_t _off64_t
|
||||
# elif defined(_WIN32) && !defined(__GNUC__)
|
||||
# define z_off64_t __int64
|
||||
# else
|
||||
# define z_off64_t z_off_t
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* ZCONF_H */
|
140
Externals/zlib-ng/zlib-ng.vcxproj
vendored
Normal file
140
Externals/zlib-ng/zlib-ng.vcxproj
vendored
Normal file
@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<Import Project="..\..\Source\VSProps\Base.Macros.props" />
|
||||
<Import Project="$(VSPropsDir)Base.Targets.props" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{F6EA7144-8D64-4EBB-A13E-76DFBD911EAE}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VSPropsDir)Configuration.StaticLibrary.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VSPropsDir)Base.props" />
|
||||
<Import Project="$(VSPropsDir)ClDisableAllWarnings.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<!--For config files added by Dolphin-->
|
||||
<AdditionalIncludeDirectories>.;zlib-ng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>ZLIB_COMPAT;WITH_GZFILEOP;NO_FSEEKO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">X86_FEATURES;X86_AVX2;X86_AVX2_ADLER32;X86_AVX_CHUNKSET;X86_AVX512;X86_AVX512_ADLER32;X86_MASK_INTRIN;X86_AVX512VNNI;X86_AVX512VNNI_ADLER32;X86_SSE41;X86_SSE42_CRC_HASH;X86_SSE42_ADLER32;X86_SSE42_CRC_INTRIN;X86_SSE2;X86_SSE2_CHUNKSET;X86_SSE2_SLIDEHASH;X86_SSSE3;X86_SSSE3_ADLER32;X86_PCLMULQDQ_CRC;X86_VPCLMULQDQ_CRC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<!--zlib-ng currently doesn't have proper detection of CRC32 on win/arm64, so use ARM_NOCHECK_ACLE-->
|
||||
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM64'">ARM_FEATURES;ARM_NOCHECK_ACLE;ARM_ACLE_CRC_HASH;ARM_NEON;ARM_NEON_ADLER32;ARM_NEON_CHUNKSET;ARM_NEON_SLIDEHASH;__ARM_NEON__;ARM_NEON_HASLD4;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup Condition="'$(Platform)'=='x64'">
|
||||
<ClCompile Include="zlib-ng\arch\x86\adler32_avx2.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\adler32_avx512.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\adler32_avx512_vnni.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\adler32_sse42.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\adler32_ssse3.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\chunkset_avx.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\chunkset_sse2.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\chunkset_sse41.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\compare256_avx2.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\compare256_sse2.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\crc32_fold_pclmulqdq.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\crc32_fold_vpclmulqdq.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\insert_string_sse42.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\slide_hash_avx2.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\slide_hash_sse2.c" />
|
||||
<ClCompile Include="zlib-ng\arch\x86\x86_features.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Platform)'=='ARM64'">
|
||||
<ClCompile Include="zlib-ng\arch\arm\adler32_neon.c" />
|
||||
<ClCompile Include="zlib-ng\arch\arm\arm_features.c" />
|
||||
<ClCompile Include="zlib-ng\arch\arm\chunkset_neon.c" />
|
||||
<ClCompile Include="zlib-ng\arch\arm\compare256_neon.c" />
|
||||
<ClCompile Include="zlib-ng\arch\arm\crc32_acle.c" />
|
||||
<ClCompile Include="zlib-ng\arch\arm\insert_string_acle.c" />
|
||||
<ClCompile Include="zlib-ng\arch\arm\slide_hash_neon.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="zlib-ng\adler32.c" />
|
||||
<ClCompile Include="zlib-ng\adler32_fold.c" />
|
||||
<ClCompile Include="zlib-ng\chunkset.c" />
|
||||
<ClCompile Include="zlib-ng\compare256.c" />
|
||||
<ClCompile Include="zlib-ng\compress.c" />
|
||||
<ClCompile Include="zlib-ng\cpu_features.c" />
|
||||
<ClCompile Include="zlib-ng\crc32_braid.c" />
|
||||
<ClCompile Include="zlib-ng\crc32_braid_comb.c" />
|
||||
<ClCompile Include="zlib-ng\crc32_fold.c" />
|
||||
<ClCompile Include="zlib-ng\deflate.c" />
|
||||
<ClCompile Include="zlib-ng\deflate_fast.c" />
|
||||
<ClCompile Include="zlib-ng\deflate_huff.c" />
|
||||
<ClCompile Include="zlib-ng\deflate_medium.c" />
|
||||
<ClCompile Include="zlib-ng\deflate_quick.c" />
|
||||
<ClCompile Include="zlib-ng\deflate_rle.c" />
|
||||
<ClCompile Include="zlib-ng\deflate_slow.c" />
|
||||
<ClCompile Include="zlib-ng\deflate_stored.c" />
|
||||
<ClCompile Include="zlib-ng\functable.c" />
|
||||
<ClCompile Include="zlib-ng\gzlib.c" />
|
||||
<ClCompile Include="zlib-ng\gzwrite.c" />
|
||||
<ClCompile Include="zlib-ng\infback.c" />
|
||||
<ClCompile Include="zlib-ng\inffast.c" />
|
||||
<ClCompile Include="zlib-ng\inflate.c" />
|
||||
<ClCompile Include="zlib-ng\inftrees.c" />
|
||||
<ClCompile Include="zlib-ng\insert_string.c" />
|
||||
<ClCompile Include="zlib-ng\insert_string_roll.c" />
|
||||
<ClCompile Include="zlib-ng\slide_hash.c" />
|
||||
<ClCompile Include="zlib-ng\trees.c" />
|
||||
<ClCompile Include="zlib-ng\uncompr.c" />
|
||||
<ClCompile Include="zlib-ng\zutil.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="zlib-ng\CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Platform)'=='x64'">
|
||||
<ClInclude Include="zlib-ng\arch\x86\adler32_avx2_p.h" />
|
||||
<ClInclude Include="zlib-ng\arch\x86\adler32_avx2_tpl.h" />
|
||||
<ClInclude Include="zlib-ng\arch\x86\adler32_avx512_p.h" />
|
||||
<ClInclude Include="zlib-ng\arch\x86\adler32_avx512_tpl.h" />
|
||||
<ClInclude Include="zlib-ng\arch\x86\adler32_ssse3_p.h" />
|
||||
<ClInclude Include="zlib-ng\arch\x86\crc32_fold_pclmulqdq_tpl.h" />
|
||||
<ClInclude Include="zlib-ng\arch\x86\crc32_fold_vpclmulqdq_tpl.h" />
|
||||
<ClInclude Include="zlib-ng\arch\x86\x86_features.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Platform)'=='ARM64'">
|
||||
<ClInclude Include="zlib-ng\arch\arm\arm_features.h" />
|
||||
<ClInclude Include="zlib-ng\arch\arm\ctzl.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="zlib-ng\adler32_fold.h" />
|
||||
<ClInclude Include="zlib-ng\adler32_p.h" />
|
||||
<ClInclude Include="zlib-ng\chunkset_tpl.h" />
|
||||
<ClInclude Include="zlib-ng\cpu_features.h" />
|
||||
<ClInclude Include="zlib-ng\crc32_braid_comb_p.h" />
|
||||
<ClInclude Include="zlib-ng\crc32_braid_p.h" />
|
||||
<ClInclude Include="zlib-ng\crc32_braid_tbl.h" />
|
||||
<ClInclude Include="zlib-ng\crc32_fold.h" />
|
||||
<ClInclude Include="zlib-ng\deflate.h" />
|
||||
<ClInclude Include="zlib-ng\deflate_p.h" />
|
||||
<ClInclude Include="zlib-ng\fallback_builtins.h" />
|
||||
<ClInclude Include="zlib-ng\functable.h" />
|
||||
<ClInclude Include="zlib-ng\gzguts.h" />
|
||||
<ClInclude Include="zlib-ng\inffast.h" />
|
||||
<ClInclude Include="zlib-ng\inffixed_tbl.h" />
|
||||
<ClInclude Include="zlib-ng\inflate.h" />
|
||||
<ClInclude Include="zlib-ng\inflate_p.h" />
|
||||
<ClInclude Include="zlib-ng\inftrees.h" />
|
||||
<ClInclude Include="zlib-ng\insert_string_tpl.h" />
|
||||
<ClInclude Include="zlib-ng\match_tpl.h" />
|
||||
<ClInclude Include="zlib-ng\trees.h" />
|
||||
<ClInclude Include="zlib-ng\trees_emit.h" />
|
||||
<ClInclude Include="zlib-ng\trees_tbl.h" />
|
||||
<ClInclude Include="zlib-ng\zbuild.h" />
|
||||
<ClInclude Include="zlib-ng\zendian.h" />
|
||||
<ClInclude Include="zlib-ng\zutil.h" />
|
||||
<ClInclude Include="zlib-ng\zutil_p.h" />
|
||||
<!--Added by Dolphin (copied from cmake output)-->
|
||||
<ClInclude Include="zconf.h" />
|
||||
<ClInclude Include="zlib_name_mangling.h" />
|
||||
<ClInclude Include="zlib.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
1855
Externals/zlib-ng/zlib.h
vendored
Normal file
1855
Externals/zlib-ng/zlib.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
Externals/zlib-ng/zlib_name_mangling.h
vendored
Normal file
8
Externals/zlib-ng/zlib_name_mangling.h
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/* zlib_name_mangling.h has been automatically generated from
|
||||
* zlib_name_mangling.h.empty because ZLIB_SYMBOL_PREFIX was NOT set.
|
||||
*/
|
||||
|
||||
#ifndef ZLIB_NAME_MANGLING_H
|
||||
#define ZLIB_NAME_MANGLING_H
|
||||
|
||||
#endif /* ZLIB_NAME_MANGLING_H */
|
Reference in New Issue
Block a user