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 6declare_args() { 7 skia_use_system_libwebp = is_official_build 8} 9 10import("../third_party.gni") 11 12if (skia_use_system_libwebp) { 13 system("libwebp") { 14 libs = [ 15 "webp", 16 "webpdemux", 17 "webpmux", 18 ] 19 } 20} else { 21 config("libwebp_defines") { 22 defines = [ 23 # WebP naturally decodes to RGB_565, and we work with BGR_565. 24 # This makes WebP decode to BGR_565 when we ask for RGB_565. 25 # (It also swaps the color order for 4444, but we don't care today.) 26 # TODO: swizzle ourself in SkWebpCodec instead of requiring this non-standard libwebp. 27 "WEBP_SWAP_16BIT_CSP", 28 ] 29 } 30 31 third_party("libwebp_sse41") { 32 public_include_dirs = [ "../externals/libwebp/src" ] 33 configs += [ ":libwebp_defines" ] 34 sources = [ 35 "../externals/libwebp/src/dsp/alpha_processing_sse41.c", 36 "../externals/libwebp/src/dsp/dec_sse41.c", 37 "../externals/libwebp/src/dsp/enc_sse41.c", 38 "../externals/libwebp/src/dsp/lossless_enc_sse41.c", 39 ] 40 if ((current_cpu == "x86" || current_cpu == "x64") && 41 (!is_win || is_clang)) { 42 cflags_c = [ "-msse4.1" ] 43 } 44 } 45 46 third_party("libwebp_avx2") { 47 public_include_dirs = [ "../externals/libwebp/src" ] 48 configs += [ ":libwebp_defines" ] 49 sources = [ 50 "../externals/libwebp/src/dsp/enc_avx2.c", 51 ] 52 if ((current_cpu == "x86" || current_cpu == "x64") && 53 (!is_win || is_clang)) { 54 cflags_c = [ "-mavx2" ] 55 } 56 } 57 58 third_party("libwebp") { 59 public_include_dirs = [ "../externals/libwebp/src" ] 60 61 deps = [ 62 ":libwebp_avx2", 63 ":libwebp_sse41", 64 ] 65 if (is_android) { 66 deps += [ "//third_party/cpu-features" ] 67 } 68 69 configs += [ ":libwebp_defines" ] 70 sources = [ 71 "../externals/libwebp/src/dec/alpha_dec.c", 72 "../externals/libwebp/src/dec/buffer_dec.c", 73 "../externals/libwebp/src/dec/frame_dec.c", 74 "../externals/libwebp/src/dec/idec_dec.c", 75 "../externals/libwebp/src/dec/io_dec.c", 76 "../externals/libwebp/src/dec/quant_dec.c", 77 "../externals/libwebp/src/dec/tree_dec.c", 78 "../externals/libwebp/src/dec/vp8_dec.c", 79 "../externals/libwebp/src/dec/vp8l_dec.c", 80 "../externals/libwebp/src/dec/webp_dec.c", 81 "../externals/libwebp/src/demux/demux.c", 82 "../externals/libwebp/src/dsp/alpha_processing.c", 83 "../externals/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c", 84 "../externals/libwebp/src/dsp/alpha_processing_neon.c", 85 "../externals/libwebp/src/dsp/alpha_processing_sse2.c", 86 "../externals/libwebp/src/dsp/argb.c", 87 "../externals/libwebp/src/dsp/argb_mips_dsp_r2.c", 88 "../externals/libwebp/src/dsp/argb_sse2.c", 89 "../externals/libwebp/src/dsp/cost.c", 90 "../externals/libwebp/src/dsp/cost_mips32.c", 91 "../externals/libwebp/src/dsp/cost_mips_dsp_r2.c", 92 "../externals/libwebp/src/dsp/cost_sse2.c", 93 "../externals/libwebp/src/dsp/cpu.c", 94 "../externals/libwebp/src/dsp/dec.c", 95 "../externals/libwebp/src/dsp/dec_clip_tables.c", 96 "../externals/libwebp/src/dsp/dec_mips32.c", 97 "../externals/libwebp/src/dsp/dec_mips_dsp_r2.c", 98 "../externals/libwebp/src/dsp/dec_neon.c", 99 "../externals/libwebp/src/dsp/dec_sse2.c", 100 "../externals/libwebp/src/dsp/enc.c", 101 "../externals/libwebp/src/dsp/enc_mips32.c", 102 "../externals/libwebp/src/dsp/enc_mips_dsp_r2.c", 103 "../externals/libwebp/src/dsp/enc_msa.c", 104 "../externals/libwebp/src/dsp/enc_neon.c", 105 "../externals/libwebp/src/dsp/enc_sse2.c", 106 "../externals/libwebp/src/dsp/filters.c", 107 "../externals/libwebp/src/dsp/filters_mips_dsp_r2.c", 108 "../externals/libwebp/src/dsp/filters_msa.c", 109 "../externals/libwebp/src/dsp/filters_neon.c", 110 "../externals/libwebp/src/dsp/filters_sse2.c", 111 "../externals/libwebp/src/dsp/lossless.c", 112 "../externals/libwebp/src/dsp/lossless_enc.c", 113 "../externals/libwebp/src/dsp/lossless_enc_mips32.c", 114 "../externals/libwebp/src/dsp/lossless_enc_mips_dsp_r2.c", 115 "../externals/libwebp/src/dsp/lossless_enc_msa.c", 116 "../externals/libwebp/src/dsp/lossless_enc_neon.c", 117 "../externals/libwebp/src/dsp/lossless_enc_sse2.c", 118 "../externals/libwebp/src/dsp/lossless_mips_dsp_r2.c", 119 "../externals/libwebp/src/dsp/lossless_msa.c", 120 "../externals/libwebp/src/dsp/lossless_neon.c", 121 "../externals/libwebp/src/dsp/lossless_sse2.c", 122 "../externals/libwebp/src/dsp/rescaler.c", 123 "../externals/libwebp/src/dsp/rescaler_mips32.c", 124 "../externals/libwebp/src/dsp/rescaler_mips_dsp_r2.c", 125 "../externals/libwebp/src/dsp/rescaler_msa.c", 126 "../externals/libwebp/src/dsp/rescaler_neon.c", 127 "../externals/libwebp/src/dsp/rescaler_sse2.c", 128 "../externals/libwebp/src/dsp/upsampling.c", 129 "../externals/libwebp/src/dsp/upsampling_mips_dsp_r2.c", 130 "../externals/libwebp/src/dsp/upsampling_msa.c", 131 "../externals/libwebp/src/dsp/upsampling_neon.c", 132 "../externals/libwebp/src/dsp/upsampling_sse2.c", 133 "../externals/libwebp/src/dsp/yuv.c", 134 "../externals/libwebp/src/dsp/yuv_mips32.c", 135 "../externals/libwebp/src/dsp/yuv_mips_dsp_r2.c", 136 "../externals/libwebp/src/dsp/yuv_sse2.c", 137 "../externals/libwebp/src/enc/alpha_enc.c", 138 "../externals/libwebp/src/enc/analysis_enc.c", 139 "../externals/libwebp/src/enc/backward_references_enc.c", 140 "../externals/libwebp/src/enc/config_enc.c", 141 "../externals/libwebp/src/enc/cost_enc.c", 142 "../externals/libwebp/src/enc/filter_enc.c", 143 "../externals/libwebp/src/enc/frame_enc.c", 144 "../externals/libwebp/src/enc/histogram_enc.c", 145 "../externals/libwebp/src/enc/iterator_enc.c", 146 "../externals/libwebp/src/enc/near_lossless_enc.c", 147 "../externals/libwebp/src/enc/picture_csp_enc.c", 148 "../externals/libwebp/src/enc/picture_enc.c", 149 "../externals/libwebp/src/enc/picture_psnr_enc.c", 150 "../externals/libwebp/src/enc/picture_rescale_enc.c", 151 "../externals/libwebp/src/enc/picture_tools_enc.c", 152 "../externals/libwebp/src/enc/predictor_enc.c", 153 "../externals/libwebp/src/enc/quant_enc.c", 154 "../externals/libwebp/src/enc/syntax_enc.c", 155 "../externals/libwebp/src/enc/token_enc.c", 156 "../externals/libwebp/src/enc/tree_enc.c", 157 "../externals/libwebp/src/enc/vp8l_enc.c", 158 "../externals/libwebp/src/enc/webp_enc.c", 159 "../externals/libwebp/src/mux/anim_encode.c", 160 "../externals/libwebp/src/mux/muxedit.c", 161 "../externals/libwebp/src/mux/muxinternal.c", 162 "../externals/libwebp/src/mux/muxread.c", 163 "../externals/libwebp/src/utils/bit_reader_utils.c", 164 "../externals/libwebp/src/utils/bit_writer_utils.c", 165 "../externals/libwebp/src/utils/color_cache_utils.c", 166 "../externals/libwebp/src/utils/filters_utils.c", 167 "../externals/libwebp/src/utils/huffman_encode_utils.c", 168 "../externals/libwebp/src/utils/huffman_utils.c", 169 "../externals/libwebp/src/utils/quant_levels_dec_utils.c", 170 "../externals/libwebp/src/utils/quant_levels_utils.c", 171 "../externals/libwebp/src/utils/random_utils.c", 172 "../externals/libwebp/src/utils/rescaler_utils.c", 173 "../externals/libwebp/src/utils/thread_utils.c", 174 "../externals/libwebp/src/utils/utils.c", 175 ] 176 } 177} 178