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 = [ 33 "../externals/libwebp/src", 34 "../externals/libwebp", 35 ] 36 configs += [ ":libwebp_defines" ] 37 sources = [ 38 "../externals/libwebp/src/dsp/alpha_processing_sse41.c", 39 "../externals/libwebp/src/dsp/dec_sse41.c", 40 "../externals/libwebp/src/dsp/enc_sse41.c", 41 "../externals/libwebp/src/dsp/lossless_enc_sse41.c", 42 "../externals/libwebp/src/dsp/upsampling_sse41.c", 43 "../externals/libwebp/src/dsp/yuv_sse41.c", 44 ] 45 if ((current_cpu == "x86" || current_cpu == "x64") && 46 (!is_win || is_clang)) { 47 cflags_c = [ "-msse4.1" ] 48 } 49 } 50 51 third_party("libwebp") { 52 public_include_dirs = [ 53 "../externals/libwebp/src", 54 "../externals/libwebp", 55 ] 56 57 deps = [ 58 ":libwebp_sse41", 59 ] 60 if (is_android) { 61 deps += [ "//third_party/cpu-features" ] 62 } 63 64 configs += [ ":libwebp_defines" ] 65 sources = [ 66 "../externals/libwebp/src/dec/alpha_dec.c", 67 "../externals/libwebp/src/dec/buffer_dec.c", 68 "../externals/libwebp/src/dec/frame_dec.c", 69 "../externals/libwebp/src/dec/idec_dec.c", 70 "../externals/libwebp/src/dec/io_dec.c", 71 "../externals/libwebp/src/dec/quant_dec.c", 72 "../externals/libwebp/src/dec/tree_dec.c", 73 "../externals/libwebp/src/dec/vp8_dec.c", 74 "../externals/libwebp/src/dec/vp8l_dec.c", 75 "../externals/libwebp/src/dec/webp_dec.c", 76 "../externals/libwebp/src/demux/anim_decode.c", 77 "../externals/libwebp/src/demux/demux.c", 78 "../externals/libwebp/src/dsp/alpha_processing.c", 79 "../externals/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c", 80 "../externals/libwebp/src/dsp/alpha_processing_neon.c", 81 "../externals/libwebp/src/dsp/alpha_processing_sse2.c", 82 "../externals/libwebp/src/dsp/cost.c", 83 "../externals/libwebp/src/dsp/cost_mips32.c", 84 "../externals/libwebp/src/dsp/cost_mips_dsp_r2.c", 85 "../externals/libwebp/src/dsp/cost_neon.c", 86 "../externals/libwebp/src/dsp/cost_sse2.c", 87 "../externals/libwebp/src/dsp/cpu.c", 88 "../externals/libwebp/src/dsp/dec.c", 89 "../externals/libwebp/src/dsp/dec_clip_tables.c", 90 "../externals/libwebp/src/dsp/dec_mips32.c", 91 "../externals/libwebp/src/dsp/dec_mips_dsp_r2.c", 92 "../externals/libwebp/src/dsp/dec_msa.c", 93 "../externals/libwebp/src/dsp/dec_neon.c", 94 "../externals/libwebp/src/dsp/dec_sse2.c", 95 "../externals/libwebp/src/dsp/enc.c", 96 "../externals/libwebp/src/dsp/enc_mips32.c", 97 "../externals/libwebp/src/dsp/enc_mips_dsp_r2.c", 98 "../externals/libwebp/src/dsp/enc_msa.c", 99 "../externals/libwebp/src/dsp/enc_neon.c", 100 "../externals/libwebp/src/dsp/enc_sse2.c", 101 "../externals/libwebp/src/dsp/filters.c", 102 "../externals/libwebp/src/dsp/filters_mips_dsp_r2.c", 103 "../externals/libwebp/src/dsp/filters_msa.c", 104 "../externals/libwebp/src/dsp/filters_neon.c", 105 "../externals/libwebp/src/dsp/filters_sse2.c", 106 "../externals/libwebp/src/dsp/lossless.c", 107 "../externals/libwebp/src/dsp/lossless_enc.c", 108 "../externals/libwebp/src/dsp/lossless_enc_mips32.c", 109 "../externals/libwebp/src/dsp/lossless_enc_mips_dsp_r2.c", 110 "../externals/libwebp/src/dsp/lossless_enc_msa.c", 111 "../externals/libwebp/src/dsp/lossless_enc_neon.c", 112 "../externals/libwebp/src/dsp/lossless_enc_sse2.c", 113 "../externals/libwebp/src/dsp/lossless_mips_dsp_r2.c", 114 "../externals/libwebp/src/dsp/lossless_msa.c", 115 "../externals/libwebp/src/dsp/lossless_neon.c", 116 "../externals/libwebp/src/dsp/lossless_sse2.c", 117 "../externals/libwebp/src/dsp/rescaler.c", 118 "../externals/libwebp/src/dsp/rescaler_mips32.c", 119 "../externals/libwebp/src/dsp/rescaler_mips_dsp_r2.c", 120 "../externals/libwebp/src/dsp/rescaler_msa.c", 121 "../externals/libwebp/src/dsp/rescaler_neon.c", 122 "../externals/libwebp/src/dsp/rescaler_sse2.c", 123 "../externals/libwebp/src/dsp/ssim.c", 124 "../externals/libwebp/src/dsp/ssim_sse2.c", 125 "../externals/libwebp/src/dsp/upsampling.c", 126 "../externals/libwebp/src/dsp/upsampling_mips_dsp_r2.c", 127 "../externals/libwebp/src/dsp/upsampling_msa.c", 128 "../externals/libwebp/src/dsp/upsampling_neon.c", 129 "../externals/libwebp/src/dsp/upsampling_sse2.c", 130 "../externals/libwebp/src/dsp/yuv.c", 131 "../externals/libwebp/src/dsp/yuv_mips32.c", 132 "../externals/libwebp/src/dsp/yuv_mips_dsp_r2.c", 133 "../externals/libwebp/src/dsp/yuv_neon.c", 134 "../externals/libwebp/src/dsp/yuv_sse2.c", 135 "../externals/libwebp/src/enc/alpha_enc.c", 136 "../externals/libwebp/src/enc/analysis_enc.c", 137 "../externals/libwebp/src/enc/backward_references_cost_enc.c", 138 "../externals/libwebp/src/enc/backward_references_enc.c", 139 "../externals/libwebp/src/enc/config_enc.c", 140 "../externals/libwebp/src/enc/cost_enc.c", 141 "../externals/libwebp/src/enc/filter_enc.c", 142 "../externals/libwebp/src/enc/frame_enc.c", 143 "../externals/libwebp/src/enc/histogram_enc.c", 144 "../externals/libwebp/src/enc/iterator_enc.c", 145 "../externals/libwebp/src/enc/near_lossless_enc.c", 146 "../externals/libwebp/src/enc/picture_csp_enc.c", 147 "../externals/libwebp/src/enc/picture_enc.c", 148 "../externals/libwebp/src/enc/picture_psnr_enc.c", 149 "../externals/libwebp/src/enc/picture_rescale_enc.c", 150 "../externals/libwebp/src/enc/picture_tools_enc.c", 151 "../externals/libwebp/src/enc/predictor_enc.c", 152 "../externals/libwebp/src/enc/quant_enc.c", 153 "../externals/libwebp/src/enc/syntax_enc.c", 154 "../externals/libwebp/src/enc/token_enc.c", 155 "../externals/libwebp/src/enc/tree_enc.c", 156 "../externals/libwebp/src/enc/vp8l_enc.c", 157 "../externals/libwebp/src/enc/webp_enc.c", 158 "../externals/libwebp/src/mux/anim_encode.c", 159 "../externals/libwebp/src/mux/muxedit.c", 160 "../externals/libwebp/src/mux/muxinternal.c", 161 "../externals/libwebp/src/mux/muxread.c", 162 "../externals/libwebp/src/utils/bit_reader_utils.c", 163 "../externals/libwebp/src/utils/bit_writer_utils.c", 164 "../externals/libwebp/src/utils/color_cache_utils.c", 165 "../externals/libwebp/src/utils/filters_utils.c", 166 "../externals/libwebp/src/utils/huffman_encode_utils.c", 167 "../externals/libwebp/src/utils/huffman_utils.c", 168 "../externals/libwebp/src/utils/quant_levels_dec_utils.c", 169 "../externals/libwebp/src/utils/quant_levels_utils.c", 170 "../externals/libwebp/src/utils/random_utils.c", 171 "../externals/libwebp/src/utils/rescaler_utils.c", 172 "../externals/libwebp/src/utils/thread_utils.c", 173 "../externals/libwebp/src/utils/utils.c", 174 ] 175 } 176} 177