BUILD.zstd.bazel 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License in the LICENSE file at the
  6. # root of this repository, or online at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. """Builds zstd."""
  16. filegroup(
  17. name = "common_sources",
  18. srcs = glob([
  19. "lib/common/*.c",
  20. "lib/common/*.h",
  21. ]),
  22. )
  23. filegroup(
  24. name = "compress_sources",
  25. srcs = glob([
  26. "lib/compress/*.c",
  27. "lib/compress/*.h",
  28. ]),
  29. )
  30. filegroup(
  31. name = "decompress_sources",
  32. srcs = glob([
  33. "lib/decompress/*.c",
  34. "lib/decompress/*.h",
  35. # Decompress includes an optimized assembly implementation.
  36. "lib/decompress/*.S",
  37. ]),
  38. )
  39. filegroup(
  40. name = "dict_builder_sources",
  41. srcs = glob([
  42. "lib/dictBuilder/*.c",
  43. "lib/dictBuilder/*.h",
  44. ]),
  45. )
  46. filegroup(
  47. name = "legacy_sources",
  48. srcs = glob([
  49. "lib/legacy/*.c",
  50. "lib/legacy/*.h",
  51. ]),
  52. )
  53. cc_library(
  54. name = "zstd",
  55. srcs = [
  56. ":common_sources",
  57. ":compress_sources",
  58. ":decompress_sources",
  59. ":dict_builder_sources",
  60. ":legacy_sources",
  61. ],
  62. hdrs = [
  63. "lib/zdict.h",
  64. "lib/zstd.h",
  65. "lib/zstd_errors.h",
  66. ],
  67. copts = ["-pthread"],
  68. includes = ["lib"],
  69. linkstatic = True,
  70. local_defines = [
  71. "ZSTD_LIB_COMPRESSION=1",
  72. "ZSTD_LIB_DECOMPRESSION=1",
  73. "ZSTD_LIB_DICTBUILDER=1",
  74. "ZSTD_LIB_DEPRECATED=0",
  75. "ZSTD_MULTITHREAD",
  76. "ZSTD_BUILD_SHARED=off",
  77. "ZSTD_BUILD_STATIC=on",
  78. "ZSTD_LEGACY_SUPPORT=1",
  79. ],
  80. visibility = ["//visibility:public"],
  81. )