BUILD 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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("@rules_python//python:defs.bzl", "py_library", "py_test")
  6. load(":carbon_bootstrapping.bzl", "gen_cc_toolchain_paths_with_stage")
  7. package(default_visibility = ["//visibility:public"])
  8. exports_files(["carbon_cc_toolchain_config.bzl"])
  9. # For use by defs.bzl.
  10. # Matches when asan is enabled on a macOS platform.
  11. selects.config_setting_group(
  12. name = "macos_asan",
  13. match_all = [
  14. ":is_macos",
  15. ":macos_asan_build_modes",
  16. ],
  17. )
  18. # For use by defs.bzl.
  19. # Matches macOS platforms.
  20. config_setting(
  21. name = "is_macos",
  22. constraint_values = ["@platforms//os:macos"],
  23. )
  24. # For use by defs.bzl.
  25. # Matches build modes where asan is enabled.
  26. selects.config_setting_group(
  27. name = "macos_asan_build_modes",
  28. match_any = [
  29. ":dbg",
  30. ":fastbuild",
  31. ],
  32. )
  33. # For use by defs.bzl.
  34. # Matches dbg.
  35. config_setting(
  36. name = "dbg",
  37. values = {"compilation_mode": "dbg"},
  38. )
  39. # For use by defs.bzl.
  40. # Matches fastbuild.
  41. config_setting(
  42. name = "fastbuild",
  43. values = {"compilation_mode": "fastbuild"},
  44. )
  45. filegroup(
  46. name = "installed_cc_toolchain_starlark",
  47. srcs = [
  48. "cc_toolchain_actions.bzl",
  49. "cc_toolchain_base_features.bzl",
  50. "cc_toolchain_config_features.bzl",
  51. "cc_toolchain_cpp_features.bzl",
  52. "cc_toolchain_debugging.bzl",
  53. "cc_toolchain_features.bzl",
  54. "cc_toolchain_linking.bzl",
  55. "cc_toolchain_modules.bzl",
  56. "cc_toolchain_optimization.bzl",
  57. "cc_toolchain_sanitizer_features.bzl",
  58. "cc_toolchain_tools.bzl",
  59. # TODO: Remove this once we can remove the use of it from Carbon
  60. # toolchain rules.
  61. "cc_toolchain_carbon_project_features.bzl",
  62. ],
  63. )
  64. gen_cc_toolchain_paths_with_stage(
  65. name = "gen_cc_tools_paths",
  66. stage = 0,
  67. )
  68. # Test that the default toolchain's Make variables expand correctly.
  69. py_test(
  70. name = "cc_tools_test",
  71. srcs = ["cc_tools_test.py"],
  72. args = ["$(location :gen_cc_tools_paths)"],
  73. data = [":gen_cc_tools_paths"],
  74. deps = [":cc_tools_test_lib"],
  75. )
  76. # Library containing the test logic, used by tests in other packages.
  77. py_library(
  78. name = "cc_tools_test_lib",
  79. srcs = ["cc_tools_test.py"],
  80. visibility = ["//visibility:public"],
  81. deps = ["@bazel_tools//tools/python/runfiles"],
  82. )