BUILD.gn 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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
  3. # found in the LICENSE file.
  4. import("//build/config/arm.gni")
  5. # TODO(richard.townsend@arm.com): Optimizations temporarily disabled for
  6. # Windows on Arm MSVC builds, see http://crbug.com/v8/10012.
  7. use_arm_neon_optimizations = (target_cpu == "arm" || target_cpu == "arm64") &&
  8. arm_use_neon && !(is_win && !is_clang)
  9. config("lzma_sdk_config") {
  10. include_dirs = [
  11. ".",
  12. "./C",
  13. ]
  14. }
  15. # Must be in a config for -Wno-self-assign because of how GN orders flags
  16. # (otherwise -Wall will appear after this, and turn it back on).
  17. config("lzma_build_config") {
  18. defines = [
  19. "_7ZIP_ST",
  20. "_7Z_NO_METHODS_FILTERS",
  21. "_LZMA_PROB32",
  22. ]
  23. cflags = []
  24. if (is_clang) {
  25. # Upstream uses self-assignment to avoid warnings.
  26. cflags += [ "-Wno-self-assign" ]
  27. }
  28. if (use_arm_neon_optimizations) {
  29. if (is_fuchsia) {
  30. defines += [ "ARMV8_OS_FUCHSIA" ]
  31. }
  32. if (target_cpu == "arm" && arm_version >= 8) {
  33. if (is_clang) {
  34. cflags += [
  35. "-march=armv8-a",
  36. "-Xclang",
  37. "-target-feature",
  38. "-Xclang",
  39. "+crc",
  40. "-Xclang",
  41. "-target-feature",
  42. "-Xclang",
  43. "+crypto",
  44. ]
  45. } else {
  46. cflags += [ "-march=armv8-a+crc+crypto" ]
  47. }
  48. }
  49. }
  50. }
  51. static_library("lzma_sdk") {
  52. sources = [
  53. "C/7z.h",
  54. "C/7zAlloc.c",
  55. "C/7zAlloc.h",
  56. "C/7zArcIn.c",
  57. "C/7zBuf.c",
  58. "C/7zBuf.h",
  59. "C/7zCrc.c",
  60. "C/7zCrc.h",
  61. "C/7zCrcOpt.c",
  62. "C/7zDec.c",
  63. "C/7zFile.c",
  64. "C/7zFile.h",
  65. "C/7zStream.c",
  66. "C/7zTypes.h",
  67. "C/Alloc.c",
  68. "C/Alloc.h",
  69. "C/Bcj2.c",
  70. "C/Bcj2.h",
  71. "C/Bra.c",
  72. "C/Bra.h",
  73. "C/Bra86.c",
  74. "C/Compiler.h",
  75. "C/CpuArch.c",
  76. "C/CpuArch.h",
  77. "C/Delta.c",
  78. "C/Delta.h",
  79. "C/DllSecur.c",
  80. "C/DllSecur.h",
  81. "C/LzFind.c",
  82. "C/LzFind.h",
  83. "C/LzHash.h",
  84. "C/Lzma2Dec.c",
  85. "C/Lzma2Dec.h",
  86. "C/LzmaDec.c",
  87. "C/LzmaDec.h",
  88. "C/LzmaEnc.c",
  89. "C/LzmaEnc.h",
  90. "C/LzmaLib.c",
  91. "C/LzmaLib.h",
  92. "C/Precomp.h",
  93. ]
  94. configs -= [ "//build/config/compiler:chromium_code" ]
  95. configs += [
  96. "//build/config/compiler:no_chromium_code",
  97. # Must be after no_chromium_code for warning flags to be ordered correctly.
  98. ":lzma_build_config",
  99. ]
  100. public_configs = [ ":lzma_sdk_config" ]
  101. }
  102. static_library("lzma_sdk_xz") {
  103. sources = [
  104. "C/BraIA64.c",
  105. "C/RotateDefs.h",
  106. "C/Sha256.c",
  107. "C/Sha256.h",
  108. "C/Xz.c",
  109. "C/Xz.h",
  110. "C/XzCrc64.c",
  111. "C/XzCrc64.h",
  112. "C/XzCrc64Opt.c",
  113. "C/XzDec.c",
  114. ]
  115. # TODO(crbug.com/1338627): Enable ARM optimizations
  116. if (target_cpu == "x86" || target_cpu == "x64") {
  117. sources += [ "C/Sha256Opt.c" ]
  118. }
  119. deps = [ ":lzma_sdk" ]
  120. configs -= [ "//build/config/compiler:chromium_code" ]
  121. configs += [
  122. "//build/config/compiler:no_chromium_code",
  123. # Must be after no_chromium_code for warning flags to be ordered correctly.
  124. ":lzma_build_config",
  125. ]
  126. public_configs = [ ":lzma_sdk_config" ]
  127. }