• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""absl specific copts.
2
3This file simply selects the correct options from the generated files.  To
4change Abseil copts, edit absl/copts/copts.py
5"""
6
7load(
8    "//absl:copts/GENERATED_copts.bzl",
9    "ABSL_CLANG_CL_FLAGS",
10    "ABSL_CLANG_CL_TEST_FLAGS",
11    "ABSL_GCC_FLAGS",
12    "ABSL_GCC_TEST_FLAGS",
13    "ABSL_LLVM_FLAGS",
14    "ABSL_LLVM_TEST_FLAGS",
15    "ABSL_MSVC_FLAGS",
16    "ABSL_MSVC_LINKOPTS",
17    "ABSL_MSVC_TEST_FLAGS",
18    "ABSL_RANDOM_HWAES_ARM32_FLAGS",
19    "ABSL_RANDOM_HWAES_ARM64_FLAGS",
20    "ABSL_RANDOM_HWAES_MSVC_X64_FLAGS",
21    "ABSL_RANDOM_HWAES_X64_FLAGS",
22)
23
24ABSL_DEFAULT_COPTS = select({
25    "//absl:windows": ABSL_MSVC_FLAGS,
26    "//absl:clang_compiler": ABSL_LLVM_FLAGS,
27    "//conditions:default": ABSL_GCC_FLAGS,
28})
29
30ABSL_TEST_COPTS = ABSL_DEFAULT_COPTS + select({
31    "//absl:windows": ABSL_MSVC_TEST_FLAGS,
32    "//absl:clang_compiler": ABSL_LLVM_TEST_FLAGS,
33    "//conditions:default": ABSL_GCC_TEST_FLAGS,
34})
35
36ABSL_DEFAULT_LINKOPTS = select({
37    "//absl:windows": ABSL_MSVC_LINKOPTS,
38    "//conditions:default": [],
39})
40
41# ABSL_RANDOM_RANDEN_COPTS blaze copts flags which are required by each
42# environment to build an accelerated RandenHwAes library.
43ABSL_RANDOM_RANDEN_COPTS = select({
44    # APPLE
45    ":cpu_darwin_x86_64": ABSL_RANDOM_HWAES_X64_FLAGS,
46    ":cpu_darwin": ABSL_RANDOM_HWAES_X64_FLAGS,
47    ":cpu_x64_windows_msvc": ABSL_RANDOM_HWAES_MSVC_X64_FLAGS,
48    ":cpu_x64_windows": ABSL_RANDOM_HWAES_MSVC_X64_FLAGS,
49    ":cpu_k8": ABSL_RANDOM_HWAES_X64_FLAGS,
50    ":cpu_ppc": ["-mcrypto"],
51
52    # Supported by default or unsupported.
53    "//conditions:default": [],
54})
55
56# absl_random_randen_copts_init:
57#  Initialize the config targets based on cpu, os, etc. used to select
58#  the required values for ABSL_RANDOM_RANDEN_COPTS
59def absl_random_randen_copts_init():
60    """Initialize the config_settings used by ABSL_RANDOM_RANDEN_COPTS."""
61
62    # CPU configs.
63    # These configs have consistent flags to enable HWAES intsructions.
64    cpu_configs = [
65        "ppc",
66        "k8",
67        "darwin_x86_64",
68        "darwin",
69        "x64_windows_msvc",
70        "x64_windows",
71    ]
72    for cpu in cpu_configs:
73        native.config_setting(
74            name = "cpu_%s" % cpu,
75            values = {"cpu": cpu},
76        )
77