BUILD.gn 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. import("//build/config/arm.gni")
  9. import("//build/config/sanitizers/sanitizers.gni")
  10. config("libyuv_config") {
  11. include_dirs = [
  12. ".",
  13. "include",
  14. ]
  15. }
  16. use_neon = current_cpu == "arm64" || (current_cpu == "arm" && (arm_use_neon || arm_optionally_use_neon))
  17. source_set("libyuv") {
  18. sources = [
  19. # Headers
  20. "include/libyuv.h",
  21. "include/libyuv/basic_types.h",
  22. "include/libyuv/compare.h",
  23. "include/libyuv/convert.h",
  24. "include/libyuv/convert_argb.h",
  25. "include/libyuv/convert_from.h",
  26. "include/libyuv/convert_from_argb.h",
  27. "include/libyuv/cpu_id.h",
  28. "include/libyuv/mjpeg_decoder.h",
  29. "include/libyuv/planar_functions.h",
  30. "include/libyuv/rotate.h",
  31. "include/libyuv/rotate_argb.h",
  32. "include/libyuv/rotate_row.h",
  33. "include/libyuv/row.h",
  34. "include/libyuv/scale.h",
  35. "include/libyuv/scale_argb.h",
  36. "include/libyuv/scale_row.h",
  37. "include/libyuv/version.h",
  38. "include/libyuv/video_common.h",
  39. # Source Files
  40. "source/compare.cc",
  41. "source/compare_common.cc",
  42. "source/compare_gcc.cc",
  43. "source/compare_win.cc",
  44. "source/convert.cc",
  45. "source/convert_argb.cc",
  46. "source/convert_from.cc",
  47. "source/convert_from_argb.cc",
  48. "source/convert_jpeg.cc",
  49. "source/convert_to_argb.cc",
  50. "source/convert_to_i420.cc",
  51. "source/cpu_id.cc",
  52. "source/mjpeg_decoder.cc",
  53. "source/mjpeg_validate.cc",
  54. "source/planar_functions.cc",
  55. "source/rotate.cc",
  56. "source/rotate_any.cc",
  57. "source/rotate_argb.cc",
  58. "source/rotate_common.cc",
  59. "source/rotate_mips.cc",
  60. "source/rotate_gcc.cc",
  61. "source/rotate_win.cc",
  62. "source/row_any.cc",
  63. "source/row_common.cc",
  64. "source/row_mips.cc",
  65. "source/row_gcc.cc",
  66. "source/row_win.cc",
  67. "source/scale.cc",
  68. "source/scale_any.cc",
  69. "source/scale_argb.cc",
  70. "source/scale_common.cc",
  71. "source/scale_mips.cc",
  72. "source/scale_gcc.cc",
  73. "source/scale_win.cc",
  74. "source/video_common.cc",
  75. ]
  76. configs -= [ "//build/config/compiler:chromium_code" ]
  77. configs += [ "//build/config/compiler:no_chromium_code" ]
  78. public_configs = [ ":libyuv_config" ]
  79. defines = []
  80. if (!is_ios) {
  81. defines += [ "HAVE_JPEG" ]
  82. }
  83. if (is_msan) {
  84. # MemorySanitizer does not support assembly code yet.
  85. # http://crbug.com/344505
  86. defines += [ "LIBYUV_DISABLE_X86" ]
  87. }
  88. deps = [
  89. "//third_party:jpeg",
  90. ]
  91. if (use_neon) {
  92. deps += [ ":libyuv_neon" ]
  93. }
  94. if (is_nacl) {
  95. # Always enable optimization under NaCl to workaround crbug.com/538243 .
  96. configs -= [ "//build/config/compiler:default_optimization" ]
  97. configs += [ "//build/config/compiler:optimize_max" ]
  98. }
  99. }
  100. if (use_neon) {
  101. static_library("libyuv_neon") {
  102. sources = [
  103. # ARM Source Files
  104. "source/compare_neon.cc",
  105. "source/compare_neon64.cc",
  106. "source/rotate_neon.cc",
  107. "source/rotate_neon64.cc",
  108. "source/row_neon.cc",
  109. "source/row_neon64.cc",
  110. "source/scale_neon.cc",
  111. "source/scale_neon64.cc",
  112. ]
  113. public_configs = [ ":libyuv_config" ]
  114. if (current_cpu != "arm64") {
  115. configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
  116. cflags = [ "-mfpu=neon" ]
  117. }
  118. }
  119. }