• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2009 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5{
6  'variables': {
7    'ZLIB_ROOT': '.',
8    'use_system_zlib%': 0,
9    'arm_fpu%': '',
10    'llvm_version%': '0.0',
11  },
12  'conditions': [
13    ['use_system_zlib==0', {
14      'targets': [
15        {
16          'target_name': 'zlib_adler32_simd',
17          'type': 'static_library',
18          'conditions': [
19            ['target_arch in "ia32 x64" and OS!="ios"', {
20              'defines': [ 'ADLER32_SIMD_SSSE3' ],
21              'conditions': [
22                ['OS=="win"', {
23                  'defines': [ 'X86_WINDOWS' ],
24                },{
25                  'defines': [ 'X86_NOT_WINDOWS' ],
26                }],
27                ['OS!="win" or llvm_version!="0.0"', {
28                  'cflags': [ '-mssse3' ],
29                  'xcode_settings': {
30                    'OTHER_CFLAGS': [ '-mssse3' ],
31                  },
32                }],
33              ],
34            }],
35            ['arm_fpu=="neon"', {
36              'defines': [ 'ADLER32_SIMD_NEON' ],
37            }],
38          ],
39          'include_dirs': [ '<(ZLIB_ROOT)' ],
40          'direct_dependent_settings': {
41            'conditions': [
42              ['target_arch in "ia32 x64" and OS!="ios"', {
43                'defines': [ 'ADLER32_SIMD_SSSE3' ],
44                'conditions': [
45                  ['OS=="win"', {
46                    'defines': [ 'X86_WINDOWS' ],
47                  },{
48                    'defines': [ 'X86_NOT_WINDOWS' ],
49                  }],
50                ],
51              }],
52              ['arm_fpu=="neon"', {
53                'defines': [ 'ADLER32_SIMD_NEON' ],
54              }],
55            ],
56            'include_dirs': [ '<(ZLIB_ROOT)' ],
57          },
58          'sources': [
59            '<!@pymod_do_main(GN-scraper "<(ZLIB_ROOT)/BUILD.gn" "\\"zlib_adler32_simd\\".*?sources = ")',
60          ],
61        }, # zlib_adler32_simd
62        {
63          'target_name': 'zlib_arm_crc32',
64          'type': 'static_library',
65          'conditions': [
66            ['OS!="ios"', {
67              'conditions': [
68                ['OS!="win" and llvm_version=="0.0"', {
69                  'cflags': [ '-march=armv8-a+aes+crc' ],
70                }],
71                ['OS=="android"', {
72                  'defines': [ 'ARMV8_OS_ANDROID' ],
73                }],
74                ['OS=="linux"', {
75                  'defines': [ 'ARMV8_OS_LINUX' ],
76                }],
77                ['OS=="mac"', {
78                  'defines': [ 'ARMV8_OS_MACOS' ],
79                }],
80                ['OS=="win"', {
81                  'defines': [ 'ARMV8_OS_WINDOWS' ],
82                }],
83              ],
84              'defines': [ 'CRC32_ARMV8_CRC32' ],
85              'include_dirs': [ '<(ZLIB_ROOT)' ],
86              'direct_dependent_settings': {
87                'defines': [ 'CRC32_ARMV8_CRC32' ],
88                'conditions': [
89                  ['OS=="android"', {
90                    'defines': [ 'ARMV8_OS_ANDROID' ],
91                  }],
92                  ['OS=="linux"', {
93                    'defines': [ 'ARMV8_OS_LINUX' ],
94                  }],
95                  ['OS=="mac"', {
96                    'defines': [ 'ARMV8_OS_MACOS' ],
97                  }],
98                  ['OS=="win"', {
99                    'defines': [ 'ARMV8_OS_WINDOWS' ],
100                  }],
101                ],
102                'include_dirs': [ '<(ZLIB_ROOT)' ],
103              },
104              'sources': [
105                '<!@pymod_do_main(GN-scraper "<(ZLIB_ROOT)/BUILD.gn" "\\"zlib_arm_crc32\\".*?sources = ")',
106              ],
107            }],
108          ],
109        }, # zlib_arm_crc32
110        {
111          'target_name': 'zlib_crc32_simd',
112          'type': 'static_library',
113          'conditions': [
114            ['OS!="win" or llvm_version!="0.0"', {
115              'cflags': [
116                '-msse4.2',
117                '-mpclmul',
118              ],
119              'xcode_settings': {
120                'OTHER_CFLAGS': [
121                  '-msse4.2',
122                  '-mpclmul',
123                ],
124              },
125            }]
126          ],
127          'defines': [ 'CRC32_SIMD_SSE42_PCLMUL' ],
128          'include_dirs': [ '<(ZLIB_ROOT)' ],
129          'direct_dependent_settings': {
130            'defines': [ 'CRC32_SIMD_SSE42_PCLMUL' ],
131            'include_dirs': [ '<(ZLIB_ROOT)' ],
132          },
133          'sources': [
134            '<!@pymod_do_main(GN-scraper "<(ZLIB_ROOT)/BUILD.gn" "\\"zlib_crc32_simd\\".*?sources = ")',
135          ],
136        }, # zlib_crc32_simd
137        {
138          'target_name': 'zlib_inflate_chunk_simd',
139          'type': 'static_library',
140          'conditions': [
141            ['target_arch in "ia32 x64" and OS!="ios"', {
142              'defines': [ 'INFLATE_CHUNK_SIMD_SSE2' ],
143              'conditions': [
144                ['target_arch=="x64"', {
145                  'defines': [ 'INFLATE_CHUNK_READ_64LE' ],
146                }],
147              ],
148            }],
149            ['arm_fpu=="neon"', {
150              'defines': [ 'INFLATE_CHUNK_SIMD_NEON' ],
151              'conditions': [
152                ['target_arch=="arm64"', {
153                  'defines': [ 'INFLATE_CHUNK_READ_64LE' ],
154                }],
155              ],
156            }],
157          ],
158          'include_dirs': [ '<(ZLIB_ROOT)' ],
159          'direct_dependent_settings': {
160            'conditions': [
161              ['target_arch in "ia32 x64" and OS!="ios"', {
162                'defines': [ 'INFLATE_CHUNK_SIMD_SSE2' ],
163              }],
164              ['arm_fpu=="neon"', {
165                'defines': [ 'INFLATE_CHUNK_SIMD_NEON' ],
166              }],
167            ],
168            'include_dirs': [ '<(ZLIB_ROOT)' ],
169          },
170          'sources': [
171            '<!@pymod_do_main(GN-scraper "<(ZLIB_ROOT)/BUILD.gn" "\\"zlib_inflate_chunk_simd\\".*?sources = ")',
172          ],
173        }, # zlib_inflate_chunk_simd
174        {
175          'target_name': 'zlib',
176          'type': 'static_library',
177          'sources': [
178            '<!@pymod_do_main(GN-scraper "<(ZLIB_ROOT)/BUILD.gn" "\\"zlib\\".*?sources = ")',
179          ],
180          'include_dirs': [ '<(ZLIB_ROOT)' ],
181          'direct_dependent_settings': {
182            'include_dirs': [ '<(ZLIB_ROOT)' ],
183          },
184          'conditions': [
185            ['OS!="win"', {
186              'cflags!': [ '-ansi' ],
187              'cflags': [ '-Wno-implicit-fallthrough' ],
188              'defines': [ 'HAVE_HIDDEN' ],
189            }, {
190              'defines': [ 'ZLIB_DLL' ]
191            }],
192            ['OS=="mac" or OS=="ios" or OS=="freebsd" or OS=="android"', {
193              # Mac, Android and the BSDs don't have fopen64, ftello64, or
194              # fseeko64. We use fopen, ftell, and fseek instead on these
195              # systems.
196              'defines': [
197                'USE_FILE32API'
198              ],
199            }],
200            # Incorporate optimizations where possible.
201            ['(target_arch in "ia32 x64" and OS!="ios") or arm_fpu=="neon"', {
202              'dependencies': [ 'zlib_inflate_chunk_simd' ],
203              'sources': [ '<(ZLIB_ROOT)/slide_hash_simd.h' ]
204            }, {
205              'defines': [ 'CPU_NO_SIMD' ],
206              'sources': [ '<(ZLIB_ROOT)/inflate.c' ],
207            }],
208            ['target_arch in "ia32 x64" and OS!="ios"', {
209              'dependencies': [
210                'zlib_adler32_simd',
211                'zlib_crc32_simd',
212              ],
213              'defines': [ 'DEFLATE_SLIDE_HASH_SSE2' ],
214              'conditions': [
215                ['target_arch=="x64"', {
216                  'defines': [ 'INFLATE_CHUNK_READ_64LE' ],
217                }],
218              ],
219            }],
220            ['arm_fpu=="neon"', {
221              'defines': [
222                '__ARM_NEON__',
223                'DEFLATE_SLIDE_HASH_NEON',
224              ],
225              'conditions': [
226                ['OS=="win"', {
227                  'defines': [ 'ARMV8_OS_WINDOWS' ],
228                }, {
229                  'conditions': [
230                    ['OS!="ios"', {
231                      'dependencies': [
232                        'zlib_adler32_simd',
233                        'zlib_arm_crc32',
234                      ],
235                    }],
236                  ],
237                }],
238                ['target_arch=="arm64"', {
239                  'defines': [ 'INFLATE_CHUNK_READ_64LE' ],
240                }],
241              ],
242            }],
243          ],
244        },
245      ],
246    }, {
247      'targets': [
248        {
249          'target_name': 'zlib',
250          'type': 'static_library',
251          'direct_dependent_settings': {
252            'defines': [
253              'USE_SYSTEM_ZLIB',
254            ],
255          },
256          'defines': [
257            'USE_SYSTEM_ZLIB',
258          ],
259          'link_settings': {
260            'libraries': [
261              '-lz',
262            ],
263          },
264        },
265      ],
266    }],
267  ],
268}
269