Hangyu Kuang | f047e7c | 2016-07-06 14:21:45 -0700 | [diff] [blame] | 1 | # Copyright 2014 The LibYuv Project Authors. All rights reserved. |
| 2 | # |
| 3 | # Use of this source code is governed by a BSD-style license |
| 4 | # that can be found in the LICENSE file in the root of the source |
| 5 | # tree. An additional intellectual property rights grant can be found |
| 6 | # in the file PATENTS. All contributing project authors may |
| 7 | # be found in the AUTHORS file in the root of the source tree. |
| 8 | |
| 9 | import("//build/config/arm.gni") |
| 10 | import("//build/config/sanitizers/sanitizers.gni") |
| 11 | |
| 12 | config("libyuv_config") { |
| 13 | include_dirs = [ |
| 14 | ".", |
| 15 | "include", |
| 16 | ] |
| 17 | } |
| 18 | |
| 19 | use_neon = current_cpu == "arm64" || (current_cpu == "arm" && (arm_use_neon || arm_optionally_use_neon)) |
| 20 | |
| 21 | source_set("libyuv") { |
| 22 | sources = [ |
| 23 | # Headers |
| 24 | "include/libyuv.h", |
| 25 | "include/libyuv/basic_types.h", |
| 26 | "include/libyuv/compare.h", |
| 27 | "include/libyuv/convert.h", |
| 28 | "include/libyuv/convert_argb.h", |
| 29 | "include/libyuv/convert_from.h", |
| 30 | "include/libyuv/convert_from_argb.h", |
| 31 | "include/libyuv/cpu_id.h", |
| 32 | "include/libyuv/mjpeg_decoder.h", |
| 33 | "include/libyuv/planar_functions.h", |
| 34 | "include/libyuv/rotate.h", |
| 35 | "include/libyuv/rotate_argb.h", |
| 36 | "include/libyuv/rotate_row.h", |
| 37 | "include/libyuv/row.h", |
| 38 | "include/libyuv/scale.h", |
| 39 | "include/libyuv/scale_argb.h", |
| 40 | "include/libyuv/scale_row.h", |
| 41 | "include/libyuv/version.h", |
| 42 | "include/libyuv/video_common.h", |
| 43 | |
| 44 | # Source Files |
| 45 | "source/compare.cc", |
| 46 | "source/compare_common.cc", |
| 47 | "source/compare_gcc.cc", |
| 48 | "source/compare_win.cc", |
| 49 | "source/convert.cc", |
| 50 | "source/convert_argb.cc", |
| 51 | "source/convert_from.cc", |
| 52 | "source/convert_from_argb.cc", |
| 53 | "source/convert_jpeg.cc", |
| 54 | "source/convert_to_argb.cc", |
| 55 | "source/convert_to_i420.cc", |
| 56 | "source/cpu_id.cc", |
| 57 | "source/mjpeg_decoder.cc", |
| 58 | "source/mjpeg_validate.cc", |
| 59 | "source/planar_functions.cc", |
| 60 | "source/rotate.cc", |
| 61 | "source/rotate_any.cc", |
| 62 | "source/rotate_argb.cc", |
| 63 | "source/rotate_common.cc", |
| 64 | "source/rotate_mips.cc", |
| 65 | "source/rotate_gcc.cc", |
| 66 | "source/rotate_win.cc", |
| 67 | "source/row_any.cc", |
| 68 | "source/row_common.cc", |
| 69 | "source/row_mips.cc", |
| 70 | "source/row_gcc.cc", |
| 71 | "source/row_win.cc", |
| 72 | "source/scale.cc", |
| 73 | "source/scale_any.cc", |
| 74 | "source/scale_argb.cc", |
| 75 | "source/scale_common.cc", |
| 76 | "source/scale_mips.cc", |
| 77 | "source/scale_gcc.cc", |
| 78 | "source/scale_win.cc", |
| 79 | "source/video_common.cc", |
| 80 | ] |
| 81 | |
| 82 | configs -= [ "//build/config/compiler:chromium_code" ] |
| 83 | configs += [ "//build/config/compiler:no_chromium_code" ] |
| 84 | |
| 85 | public_configs = [ ":libyuv_config" ] |
| 86 | |
| 87 | defines = [] |
| 88 | |
| 89 | if (!is_ios) { |
| 90 | defines += [ "HAVE_JPEG" ] |
| 91 | } |
| 92 | |
| 93 | if (is_msan) { |
| 94 | # MemorySanitizer does not support assembly code yet. |
| 95 | # http://crbug.com/344505 |
| 96 | defines += [ "LIBYUV_DISABLE_X86" ] |
| 97 | } |
| 98 | |
| 99 | deps = [ |
| 100 | "//third_party:jpeg", |
| 101 | ] |
| 102 | |
| 103 | if (use_neon) { |
| 104 | deps += [ ":libyuv_neon" ] |
| 105 | } |
| 106 | |
| 107 | if (is_nacl) { |
| 108 | # Always enable optimization under NaCl to workaround crbug.com/538243 . |
| 109 | configs -= [ "//build/config/compiler:default_optimization" ] |
| 110 | configs += [ "//build/config/compiler:optimize_max" ] |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | if (use_neon) { |
| 115 | static_library("libyuv_neon") { |
| 116 | sources = [ |
| 117 | # ARM Source Files |
| 118 | "source/compare_neon.cc", |
| 119 | "source/compare_neon64.cc", |
| 120 | "source/rotate_neon.cc", |
| 121 | "source/rotate_neon64.cc", |
| 122 | "source/row_neon.cc", |
| 123 | "source/row_neon64.cc", |
| 124 | "source/scale_neon.cc", |
| 125 | "source/scale_neon64.cc", |
| 126 | ] |
| 127 | |
| 128 | public_configs = [ ":libyuv_config" ] |
| 129 | |
| 130 | if (current_cpu != "arm64") { |
| 131 | configs -= [ "//build/config/compiler:compiler_arm_fpu" ] |
| 132 | cflags = [ "-mfpu=neon" ] |
| 133 | } |
| 134 | } |
| 135 | } |