• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15#
16# Build zlib for Windows x86_64 using MSVC.
17#
18
19project(libz LANGUAGES C)
20cmake_minimum_required(VERSION 3.18.1)
21
22add_library(libz STATIC
23  # Optimizations for x86-64
24  adler32_simd.c
25  crc32_simd.c
26  crc_folding.c
27
28  # Common sources
29  adler32.c
30  compress.c
31  cpu_features.c
32  crc32.c
33  deflate.c
34  gzclose.c
35  gzlib.c
36  gzread.c
37  gzwrite.c
38  infback.c
39  inffast.c
40  inflate.c
41  inftrees.c
42  trees.c
43  uncompr.c
44  zutil.c
45)
46
47target_compile_definitions(libz PRIVATE
48  # Enable optimizations: cpu_features.c will enable them at runtime using __cpuid.
49  ADLER32_SIMD_SSSE3
50  CRC32_SIMD_SSE42_PCLMUL
51  INFLATE_CHUNK_READ_64LE
52
53  X86_WINDOWS
54  ZLIB_CONST
55)
56
57set(out ${CMAKE_CURRENT_BINARY_DIR})
58configure_file(zconf.h  ${out}/dist/include/zconf.h   COPYONLY)
59configure_file(zlib.h   ${out}/dist/include/zlib.h    COPYONLY)
60