abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 1 | # Copyright 2016 Google Inc. |
| 2 | # |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
mtklein | f037d48 | 2016-07-19 08:25:00 -0700 | [diff] [blame] | 6 | declare_args() { |
Mike Klein | e459afd | 2017-03-03 09:21:30 -0500 | [diff] [blame] | 7 | skia_use_system_zlib = is_official_build |
mtklein | f037d48 | 2016-07-19 08:25:00 -0700 | [diff] [blame] | 8 | } |
| 9 | |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 10 | import("../third_party.gni") |
| 11 | |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 12 | if (skia_use_system_zlib) { |
| 13 | system("zlib") { |
| 14 | libs = [ "z" ] |
| 15 | } |
| 16 | } else { |
| 17 | third_party("zlib") { |
| 18 | public_include_dirs = [ "../externals/zlib" ] |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 19 | |
Mike Klein | ec3bdbb | 2017-03-22 22:50:02 -0400 | [diff] [blame] | 20 | deps = [ |
| 21 | ":zlib_x86", |
| 22 | ] |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 23 | sources = [ |
| 24 | "../externals/zlib/adler32.c", |
| 25 | "../externals/zlib/compress.c", |
| 26 | "../externals/zlib/crc32.c", |
| 27 | "../externals/zlib/deflate.c", |
| 28 | "../externals/zlib/gzclose.c", |
| 29 | "../externals/zlib/gzlib.c", |
| 30 | "../externals/zlib/gzread.c", |
| 31 | "../externals/zlib/gzwrite.c", |
| 32 | "../externals/zlib/infback.c", |
| 33 | "../externals/zlib/inffast.c", |
| 34 | "../externals/zlib/inflate.c", |
| 35 | "../externals/zlib/inftrees.c", |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 36 | "../externals/zlib/trees.c", |
| 37 | "../externals/zlib/uncompr.c", |
| 38 | "../externals/zlib/zutil.c", |
| 39 | ] |
| 40 | } |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 41 | } |
Mike Klein | ec3bdbb | 2017-03-22 22:50:02 -0400 | [diff] [blame] | 42 | |
| 43 | third_party("zlib_x86") { |
| 44 | public_include_dirs = [] |
| 45 | if (target_cpu == "x86" || target_cpu == "x64") { |
| 46 | sources = [ |
| 47 | "../externals/zlib/crc_folding.c", |
| 48 | "../externals/zlib/fill_window_sse.c", |
| 49 | "../externals/zlib/x86.c", |
| 50 | ] |
| 51 | if (!is_win) { |
| 52 | cflags_c = [ |
| 53 | "-msse4.2", |
| 54 | "-mpclmul", |
| 55 | ] |
| 56 | } |
| 57 | } else { |
| 58 | sources = [ |
| 59 | "../externals/zlib/simd_stub.c", |
| 60 | ] |
| 61 | } |
| 62 | } |