BUILD.decnumber.bazel 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. """Additive BUILD file for the decimal-sys Rust crate."""
  10. cc_library(
  11. name = "decnumber",
  12. srcs = [
  13. "decnumber/decContext.c",
  14. "decnumber/decDouble.c",
  15. "decnumber/decNumber.c",
  16. "decnumber/decPacked.c",
  17. "decnumber/decQuad.c",
  18. "decnumber/decSingle.c",
  19. "decnumber/decimal128.c",
  20. "decnumber/decimal32.c",
  21. "decnumber/decimal64.c",
  22. ],
  23. hdrs = [
  24. "decnumber/decContext.h",
  25. "decnumber/decDPD.h",
  26. "decnumber/decDouble.h",
  27. "decnumber/decNumber.h",
  28. "decnumber/decNumberLocal.h",
  29. "decnumber/decPacked.h",
  30. "decnumber/decQuad.h",
  31. "decnumber/decSingle.h",
  32. "decnumber/decimal128.h",
  33. "decnumber/decimal32.h",
  34. "decnumber/decimal64.h",
  35. ],
  36. # libdecimal strongly recommends always enabling optimizations.
  37. #
  38. # See: <https://github.com/MaterializeInc/rust-dec/blob/8f2670e74773e97f2f62f1f0d06b52442047883e/decnumber-sys/decnumber/readme.txt#L57-L58>
  39. copts = ["-O3"] + select({
  40. "//conditions:default": ["-Wno-unused-but-set-variable"],
  41. }),
  42. defines = ["DECLITEND=1"],
  43. target_compatible_with = select({
  44. "@//misc/bazel/platforms:linux_arm": [],
  45. "@//misc/bazel/platforms:linux_x86_64": [],
  46. "@//misc/bazel/platforms:macos_arm": [],
  47. "@//misc/bazel/platforms:macos_x86_64": [],
  48. # We can support more platforms but we'll need to take care to
  49. # correctly define `DECLITEND`.
  50. "//conditions:default": ["@platforms//:incompatible"],
  51. }),
  52. textual_hdrs = [
  53. # The ordering of these is important.
  54. "decnumber/decCommon.c",
  55. "decnumber/decBasic.c",
  56. ],
  57. visibility = ["//visibility:public"],
  58. )