BUILD 916 B

12345678910111213141516171819202122232425262728293031323334
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. load("@bazel_skylib//lib:selects.bzl", "selects")
  5. load("//bazel/cc_rules:defs.bzl", "cc_library")
  6. config_setting(
  7. name = "is_linux",
  8. constraint_values = ["@platforms//os:linux"],
  9. )
  10. config_setting(
  11. name = "opt",
  12. values = {"compilation_mode": "opt"},
  13. )
  14. selects.config_setting_group(
  15. name = "linux_opt",
  16. match_all = [
  17. ":is_linux",
  18. ":opt",
  19. ],
  20. )
  21. # A library that enables TCMalloc for optimized builds on Linux. On other
  22. # platforms and configurations, this falls back on the system malloc.
  23. cc_library(
  24. name = "tcmalloc_if_linux_opt",
  25. deps = select({
  26. ":linux_opt": ["@tcmalloc//tcmalloc"],
  27. "//conditions:default": ["@bazel_tools//tools/cpp:malloc"],
  28. }),
  29. )