BUILD.gn 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # Copyright 2019 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. import("//build/config/arm.gni")
  5. import("//third_party/libgav1/libgav1_srcs.gni")
  6. import("//third_party/libgav1/options.gni")
  7. config("public_libgav1_config") {
  8. include_dirs = [
  9. "src",
  10. "src/src",
  11. ]
  12. defines = [
  13. "LIBGAV1_MAX_BITDEPTH=10",
  14. "LIBGAV1_THREADPOOL_USE_STD_MUTEX", # to avoid abseil dependency.
  15. "LIBGAV1_ENABLE_LOGGING=0", # to avoid debug log of libgav1 in chromium
  16. # debug build.
  17. # Don't let libgav1 export any symbols. Otherwise the verify_order step on
  18. # macOS can fail since these exports end up in the final Chromium binary.
  19. "LIBGAV1_PUBLIC=",
  20. ]
  21. }
  22. config("private_libgav1_config") {
  23. configs = []
  24. # dsp intrinsics will generate much better code when optimized for speed
  25. # rather than size.
  26. if (!is_debug) {
  27. configs += [ "//build/config/compiler:optimize_max" ]
  28. }
  29. if (current_cpu == "arm64" ||
  30. (current_cpu == "arm" && arm_version >= 7 && arm_use_neon)) {
  31. # The default thumb mode will impact performance of dsp intrinsics.
  32. configs += [ "//build/config/compiler:compiler_arm" ]
  33. }
  34. }
  35. if (enable_libgav1_decoder || use_libgav1_parser) {
  36. # Separate from libgav1 because utils/constants.cc and dsp/constants.cc
  37. # generate the same object file, constants.o.
  38. source_set("libgav1_utils") {
  39. configs -= [ "//build/config/compiler:chromium_code" ]
  40. configs += [ "//build/config/compiler:no_chromium_code" ]
  41. configs += [ ":private_libgav1_config" ]
  42. public_configs = [ ":public_libgav1_config" ]
  43. sources = gav1_utils_sources
  44. }
  45. # Separate from libgav1 because film_grain.cc and dsp/film_grain.cc
  46. # generate the same object file, film_grain.o.
  47. source_set("libgav1_dsp") {
  48. configs -= [ "//build/config/compiler:chromium_code" ]
  49. configs += [ "//build/config/compiler:no_chromium_code" ]
  50. configs += [ ":private_libgav1_config" ]
  51. deps = [
  52. ":libgav1_dsp_sse4",
  53. ":libgav1_utils",
  54. ]
  55. public_configs = [ ":public_libgav1_config" ]
  56. sources = gav1_dsp_sources + gav1_dsp_headers_sources
  57. sources += gav1_dsp_avx2_sources + gav1_dsp_avx2_headers_sources
  58. }
  59. # SSE4 sources are split to their own target as Chrome is currently built
  60. # with -msse3.
  61. source_set("libgav1_dsp_sse4") {
  62. configs -= [ "//build/config/compiler:chromium_code" ]
  63. configs += [ "//build/config/compiler:no_chromium_code" ]
  64. configs += [ ":private_libgav1_config" ]
  65. deps = [ ":libgav1_utils" ]
  66. public_configs = [ ":public_libgav1_config" ]
  67. if (current_cpu == "x86" || current_cpu == "x64") {
  68. cflags = [ "-msse4.1" ]
  69. }
  70. sources = gav1_dsp_sse4_sources + gav1_dsp_sse4_headers_sources +
  71. gav1_dsp_headers_sources + gav1_dsp_avx2_headers_sources
  72. }
  73. static_library("libgav1") {
  74. configs -= [ "//build/config/compiler:chromium_code" ]
  75. configs += [ "//build/config/compiler:no_chromium_code" ]
  76. configs += [ ":private_libgav1_config" ]
  77. public_configs = [ ":public_libgav1_config" ]
  78. public_deps = [
  79. ":libgav1_dsp",
  80. ":libgav1_utils",
  81. ]
  82. sources = gav1_common_sources
  83. sources += gav1_gav1_sources
  84. sources += gav1_post_filter_sources
  85. sources += gav1_tile_sources
  86. }
  87. }