blob: 08c8bd56c13f75e10eb76ce9f68fbef80c894b79 [file] [log] [blame]
Ryan Prichard263af7d2021-10-14 22:05:32 -07001# 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 fill_window_sse.c
28
29 # Common sources
30 adler32.c
31 compress.c
32 cpu_features.c
33 crc32.c
34 deflate.c
35 gzclose.c
36 gzlib.c
37 gzread.c
38 gzwrite.c
39 infback.c
40 inffast.c
41 inflate.c
42 inftrees.c
43 trees.c
44 uncompr.c
45 zutil.c
46)
47
48target_compile_definitions(libz PRIVATE
49 # Enable optimizations: cpu_features.c will enable them at runtime using __cpuid.
50 ADLER32_SIMD_SSSE3
51 CRC32_SIMD_SSE42_PCLMUL
52 INFLATE_CHUNK_READ_64LE
53
54 X86_WINDOWS
55 ZLIB_CONST
56)
57
58set(out ${CMAKE_CURRENT_BINARY_DIR})
59configure_file(zconf.h ${out}/dist/include/zconf.h COPYONLY)
60configure_file(zlib.h ${out}/dist/include/zlib.h COPYONLY)