| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/arm.gni") | 5 import("//build/config/arm.gni") |
| 6 import("//build/config/sanitizers/sanitizers.gni") | 6 import("//build/config/sanitizers/sanitizers.gni") |
| 7 | 7 |
| 8 config("libwebp_config") { | 8 config("libwebp_config") { |
| 9 include_dirs = [ "." ] | 9 include_dirs = [ "." ] |
| 10 } | 10 } |
| 11 | 11 |
| 12 set_opt_level = |
| 13 !is_debug && is_posix && (current_cpu == "arm" || current_cpu == "arm64") |
| 14 |
| 12 use_dsp_neon = | 15 use_dsp_neon = |
| 13 current_cpu == "arm64" || (current_cpu == "arm" && arm_version >= 7 && | 16 current_cpu == "arm64" || (current_cpu == "arm" && arm_version >= 7 && |
| 14 (arm_use_neon || arm_optionally_use_neon)) | 17 (arm_use_neon || arm_optionally_use_neon)) |
| 15 | 18 |
| 16 source_set("libwebp_dec") { | 19 source_set("libwebp_dec") { |
| 17 sources = [ | 20 sources = [ |
| 18 "dec/alpha.c", | 21 "dec/alpha.c", |
| 19 "dec/buffer.c", | 22 "dec/buffer.c", |
| 20 "dec/frame.c", | 23 "dec/frame.c", |
| 21 "dec/idec.c", | 24 "dec/idec.c", |
| 22 "dec/io.c", | 25 "dec/io.c", |
| 23 "dec/quant.c", | 26 "dec/quant.c", |
| 24 "dec/tree.c", | 27 "dec/tree.c", |
| 25 "dec/vp8.c", | 28 "dec/vp8.c", |
| 26 "dec/vp8l.c", | 29 "dec/vp8l.c", |
| 27 "dec/webp.c", | 30 "dec/webp.c", |
| 28 ] | 31 ] |
| 29 | 32 |
| 30 configs -= [ "//build/config/compiler:chromium_code" ] | 33 configs -= [ "//build/config/compiler:chromium_code" ] |
| 31 configs += [ "//build/config/compiler:no_chromium_code" ] | 34 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 35 if (set_opt_level) { |
| 36 configs -= [ "//build/config/compiler:default_optimization" ] |
| 37 configs += [ "//build/config/compiler:optimize_max" ] |
| 38 } |
| 32 | 39 |
| 33 deps = [ | 40 deps = [ |
| 34 ":libwebp_dsp", | 41 ":libwebp_dsp", |
| 35 ":libwebp_utils", | 42 ":libwebp_utils", |
| 36 ] | 43 ] |
| 37 all_dependent_configs = [ ":libwebp_config" ] | 44 all_dependent_configs = [ ":libwebp_config" ] |
| 38 if (use_dsp_neon) { | 45 if (use_dsp_neon) { |
| 39 deps += [ ":libwebp_dsp_neon" ] | 46 deps += [ ":libwebp_dsp_neon" ] |
| 40 } | 47 } |
| 41 } | 48 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 "dsp/rescaler_mips32.c", | 88 "dsp/rescaler_mips32.c", |
| 82 "dsp/rescaler_mips_dsp_r2.c", | 89 "dsp/rescaler_mips_dsp_r2.c", |
| 83 "dsp/upsampling.c", | 90 "dsp/upsampling.c", |
| 84 "dsp/upsampling_mips_dsp_r2.c", | 91 "dsp/upsampling_mips_dsp_r2.c", |
| 85 "dsp/yuv.c", | 92 "dsp/yuv.c", |
| 86 "dsp/yuv_mips32.c", | 93 "dsp/yuv_mips32.c", |
| 87 "dsp/yuv_mips_dsp_r2.c", | 94 "dsp/yuv_mips_dsp_r2.c", |
| 88 ] | 95 ] |
| 89 configs -= [ "//build/config/compiler:chromium_code" ] | 96 configs -= [ "//build/config/compiler:chromium_code" ] |
| 90 configs += [ "//build/config/compiler:no_chromium_code" ] | 97 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 98 if (set_opt_level) { |
| 99 configs -= [ "//build/config/compiler:default_optimization" ] |
| 100 configs += [ "//build/config/compiler:optimize_max" ] |
| 101 } |
| 91 | 102 |
| 92 all_dependent_configs = [ ":libwebp_config" ] | 103 all_dependent_configs = [ ":libwebp_config" ] |
| 93 deps = [ | 104 deps = [ |
| 94 ":libwebp_dsp_sse2", | 105 ":libwebp_dsp_sse2", |
| 95 ":libwebp_dsp_sse41", | 106 ":libwebp_dsp_sse41", |
| 96 ":libwebp_utils", | 107 ":libwebp_utils", |
| 97 ] | 108 ] |
| 98 if (is_android) { | 109 if (is_android) { |
| 99 deps += [ "//third_party/android_tools:cpu_features" ] | 110 deps += [ "//third_party/android_tools:cpu_features" ] |
| 100 | 111 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 111 | 122 |
| 112 source_set("libwebp_dsp_sse41") { | 123 source_set("libwebp_dsp_sse41") { |
| 113 sources = [ | 124 sources = [ |
| 114 "dsp/alpha_processing_sse41.c", | 125 "dsp/alpha_processing_sse41.c", |
| 115 "dsp/dec_sse41.c", | 126 "dsp/dec_sse41.c", |
| 116 "dsp/enc_sse41.c", | 127 "dsp/enc_sse41.c", |
| 117 "dsp/lossless_enc_sse41.c", | 128 "dsp/lossless_enc_sse41.c", |
| 118 ] | 129 ] |
| 119 configs -= [ "//build/config/compiler:chromium_code" ] | 130 configs -= [ "//build/config/compiler:chromium_code" ] |
| 120 configs += [ "//build/config/compiler:no_chromium_code" ] | 131 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 132 if (set_opt_level) { |
| 133 configs -= [ "//build/config/compiler:default_optimization" ] |
| 134 configs += [ "//build/config/compiler:optimize_max" ] |
| 135 } |
| 121 | 136 |
| 122 all_dependent_configs = [ ":libwebp_config" ] | 137 all_dependent_configs = [ ":libwebp_config" ] |
| 123 if (!is_msan) { | 138 if (!is_msan) { |
| 124 if ((current_cpu == "x86" || current_cpu == "x64") && | 139 if ((current_cpu == "x86" || current_cpu == "x64") && |
| 125 (!is_win || is_clang)) { | 140 (!is_win || is_clang)) { |
| 126 cflags = [ "-msse4.1" ] | 141 cflags = [ "-msse4.1" ] |
| 127 } | 142 } |
| 128 } | 143 } |
| 129 } | 144 } |
| 130 | 145 |
| 131 source_set("libwebp_dsp_sse2") { | 146 source_set("libwebp_dsp_sse2") { |
| 132 sources = [ | 147 sources = [ |
| 133 "dsp/alpha_processing_sse2.c", | 148 "dsp/alpha_processing_sse2.c", |
| 134 "dsp/argb_sse2.c", | 149 "dsp/argb_sse2.c", |
| 135 "dsp/cost_sse2.c", | 150 "dsp/cost_sse2.c", |
| 136 "dsp/dec_sse2.c", | 151 "dsp/dec_sse2.c", |
| 137 "dsp/enc_sse2.c", | 152 "dsp/enc_sse2.c", |
| 138 "dsp/filters_sse2.c", | 153 "dsp/filters_sse2.c", |
| 139 "dsp/lossless_enc_sse2.c", | 154 "dsp/lossless_enc_sse2.c", |
| 140 "dsp/lossless_sse2.c", | 155 "dsp/lossless_sse2.c", |
| 141 "dsp/rescaler_sse2.c", | 156 "dsp/rescaler_sse2.c", |
| 142 "dsp/upsampling_sse2.c", | 157 "dsp/upsampling_sse2.c", |
| 143 "dsp/yuv_sse2.c", | 158 "dsp/yuv_sse2.c", |
| 144 ] | 159 ] |
| 145 configs -= [ "//build/config/compiler:chromium_code" ] | 160 configs -= [ "//build/config/compiler:chromium_code" ] |
| 146 configs += [ "//build/config/compiler:no_chromium_code" ] | 161 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 162 if (set_opt_level) { |
| 163 configs -= [ "//build/config/compiler:default_optimization" ] |
| 164 configs += [ "//build/config/compiler:optimize_max" ] |
| 165 } |
| 147 | 166 |
| 148 all_dependent_configs = [ ":libwebp_config" ] | 167 all_dependent_configs = [ ":libwebp_config" ] |
| 149 if (!is_msan) { | 168 if (!is_msan) { |
| 150 if ((current_cpu == "x86" || current_cpu == "x64") && | 169 if ((current_cpu == "x86" || current_cpu == "x64") && |
| 151 (!is_win || is_clang)) { | 170 (!is_win || is_clang)) { |
| 152 cflags = [ "-msse2" ] | 171 cflags = [ "-msse2" ] |
| 153 } | 172 } |
| 154 } | 173 } |
| 155 } | 174 } |
| 156 | 175 |
| 157 if (use_dsp_neon) { | 176 if (use_dsp_neon) { |
| 158 source_set("libwebp_dsp_neon") { | 177 source_set("libwebp_dsp_neon") { |
| 159 sources = [ | 178 sources = [ |
| 160 "dsp/dec_neon.c", | 179 "dsp/dec_neon.c", |
| 161 "dsp/enc_neon.c", | 180 "dsp/enc_neon.c", |
| 162 "dsp/lossless_enc_neon.c", | 181 "dsp/lossless_enc_neon.c", |
| 163 "dsp/lossless_neon.c", | 182 "dsp/lossless_neon.c", |
| 164 "dsp/rescaler_neon.c", | 183 "dsp/rescaler_neon.c", |
| 165 "dsp/upsampling_neon.c", | 184 "dsp/upsampling_neon.c", |
| 166 ] | 185 ] |
| 167 | 186 |
| 168 include_dirs = [ "." ] | 187 include_dirs = [ "." ] |
| 169 | 188 |
| 189 if (set_opt_level) { |
| 190 configs -= [ "//build/config/compiler:default_optimization" ] |
| 191 configs += [ "//build/config/compiler:optimize_max" ] |
| 192 } |
| 193 |
| 170 if (current_cpu == "arm") { | 194 if (current_cpu == "arm") { |
| 171 # behavior similar to *.c.neon in an Android.mk | 195 # behavior similar to *.c.neon in an Android.mk |
| 172 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] | 196 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] |
| 173 cflags = [ "-mfpu=neon" ] | 197 cflags = [ "-mfpu=neon" ] |
| 174 } else if (current_cpu == "arm64") { | 198 } else if (current_cpu == "arm64") { |
| 175 # avoid an ICE with gcc-4.9: b/15574841 | 199 # avoid an ICE with gcc-4.9: b/15574841 |
| 176 cflags = [ "-frename-registers" ] | 200 cflags = [ "-frename-registers" ] |
| 177 } | 201 } |
| 178 | 202 |
| 179 if (is_android) { | 203 if (is_android) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 203 "enc/picture_tools.c", | 227 "enc/picture_tools.c", |
| 204 "enc/quant.c", | 228 "enc/quant.c", |
| 205 "enc/syntax.c", | 229 "enc/syntax.c", |
| 206 "enc/token.c", | 230 "enc/token.c", |
| 207 "enc/tree.c", | 231 "enc/tree.c", |
| 208 "enc/vp8l.c", | 232 "enc/vp8l.c", |
| 209 "enc/webpenc.c", | 233 "enc/webpenc.c", |
| 210 ] | 234 ] |
| 211 configs -= [ "//build/config/compiler:chromium_code" ] | 235 configs -= [ "//build/config/compiler:chromium_code" ] |
| 212 configs += [ "//build/config/compiler:no_chromium_code" ] | 236 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 237 if (set_opt_level) { |
| 238 configs -= [ "//build/config/compiler:default_optimization" ] |
| 239 configs += [ "//build/config/compiler:optimize_max" ] |
| 240 } |
| 213 | 241 |
| 214 all_dependent_configs = [ ":libwebp_config" ] | 242 all_dependent_configs = [ ":libwebp_config" ] |
| 215 | 243 |
| 216 deps = [ | 244 deps = [ |
| 217 ":libwebp_utils", | 245 ":libwebp_utils", |
| 218 ] | 246 ] |
| 219 } | 247 } |
| 220 | 248 |
| 221 config("libwebp_utils_warnings") { | 249 config("libwebp_utils_warnings") { |
| 222 if (is_clang) { | 250 if (is_clang) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 235 "utils/huffman_encode.c", | 263 "utils/huffman_encode.c", |
| 236 "utils/quant_levels.c", | 264 "utils/quant_levels.c", |
| 237 "utils/quant_levels_dec.c", | 265 "utils/quant_levels_dec.c", |
| 238 "utils/random.c", | 266 "utils/random.c", |
| 239 "utils/rescaler.c", | 267 "utils/rescaler.c", |
| 240 "utils/thread.c", | 268 "utils/thread.c", |
| 241 "utils/utils.c", | 269 "utils/utils.c", |
| 242 ] | 270 ] |
| 243 configs -= [ "//build/config/compiler:chromium_code" ] | 271 configs -= [ "//build/config/compiler:chromium_code" ] |
| 244 configs += [ "//build/config/compiler:no_chromium_code" ] | 272 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 273 if (set_opt_level) { |
| 274 configs -= [ "//build/config/compiler:default_optimization" ] |
| 275 configs += [ "//build/config/compiler:optimize_max" ] |
| 276 } |
| 245 | 277 |
| 246 all_dependent_configs = [ ":libwebp_config" ] | 278 all_dependent_configs = [ ":libwebp_config" ] |
| 247 | 279 |
| 248 public_configs = [ ":libwebp_utils_warnings" ] | 280 public_configs = [ ":libwebp_utils_warnings" ] |
| 249 } | 281 } |
| 250 | 282 |
| 251 group("libwebp") { | 283 group("libwebp") { |
| 252 deps = [ | 284 deps = [ |
| 253 ":libwebp_dec", | 285 ":libwebp_dec", |
| 254 ":libwebp_demux", | 286 ":libwebp_demux", |
| 255 ":libwebp_dsp", | 287 ":libwebp_dsp", |
| 256 ":libwebp_enc", | 288 ":libwebp_enc", |
| 257 ":libwebp_utils", | 289 ":libwebp_utils", |
| 258 ] | 290 ] |
| 259 public_configs = [ ":libwebp_config" ] | 291 public_configs = [ ":libwebp_config" ] |
| 260 if (use_dsp_neon) { | 292 if (use_dsp_neon) { |
| 261 deps += [ ":libwebp_dsp_neon" ] | 293 deps += [ ":libwebp_dsp_neon" ] |
| 262 } | 294 } |
| 263 } | 295 } |
| OLD | NEW |