BUILD.psm.bazel 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 the assembly coded included with `psm`"""
  16. # Note: `psm` supports more platforms and OS's than we configure for here.
  17. # They're omitted because we have no use for them.
  18. cc_library(
  19. name = "psm_s",
  20. srcs = select(
  21. {
  22. "@platforms//cpu:x86_64": ["src/arch/x86_64.s"],
  23. "@platforms//cpu:aarch64": ["src/arch/aarch_aapcs64.s"],
  24. },
  25. no_match_error = "The specified cpu is not supported.",
  26. ),
  27. hdrs = ["src/arch/psm.h"],
  28. # Always optimize `psm` since it's small and in some very hot code paths.
  29. copts = [
  30. "-xassembler-with-cpp",
  31. "-O3",
  32. ] + select(
  33. {
  34. "@platforms//os:linux": [
  35. "-DCFG_TARGET_OS_linux",
  36. "-DCFG_TARGET_ENV_gnu",
  37. ],
  38. "@platforms//os:macos": [
  39. "-DCFG_TARGET_OS_macos",
  40. "-DCFG_TARGET_ENV_",
  41. ],
  42. },
  43. no_match_error = "The specified OS is not supported.",
  44. ) + select(
  45. {
  46. "@platforms//cpu:x86_64": ["-DCFG_TARGET_ARCH_x86_64"],
  47. "@platforms//cpu:aarch64": ["-DCFG_TARGET_ARCH_aarch64"],
  48. },
  49. no_match_error = "The specified cpu is not supported.",
  50. ),
  51. visibility = ["//visibility:public"],
  52. )