• 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:msvc_compiler": ABSL_MSVC_FLAGS,
26    "//absl:clang-cl_compiler": ABSL_CLANG_CL_FLAGS,
27    "//absl:clang_compiler": ABSL_LLVM_FLAGS,
28    "//conditions:default": ABSL_GCC_FLAGS,
29})
30
31ABSL_TEST_COPTS = ABSL_DEFAULT_COPTS + select({
32    "//absl:msvc_compiler": ABSL_MSVC_TEST_FLAGS,
33    "//absl:clang-cl_compiler": ABSL_CLANG_CL_TEST_FLAGS,
34    "//absl:clang_compiler": ABSL_LLVM_TEST_FLAGS,
35    "//conditions:default": ABSL_GCC_TEST_FLAGS,
36})
37
38ABSL_DEFAULT_LINKOPTS = select({
39    "//absl:msvc_compiler": ABSL_MSVC_LINKOPTS,
40    "//conditions:default": [],
41})
42
43# ABSL_RANDOM_RANDEN_COPTS blaze copts flags which are required by each
44# environment to build an accelerated RandenHwAes library.
45ABSL_RANDOM_RANDEN_COPTS = select({
46    # APPLE
47    ":cpu_darwin_x86_64": ABSL_RANDOM_HWAES_X64_FLAGS,
48    ":cpu_darwin": ABSL_RANDOM_HWAES_X64_FLAGS,
49    ":cpu_x64_windows_msvc": ABSL_RANDOM_HWAES_MSVC_X64_FLAGS,
50    ":cpu_x64_windows": ABSL_RANDOM_HWAES_MSVC_X64_FLAGS,
51    ":cpu_k8": ABSL_RANDOM_HWAES_X64_FLAGS,
52    ":cpu_ppc": ["-mcrypto"],
53    ":cpu_aarch64": ABSL_RANDOM_HWAES_ARM64_FLAGS,
54
55    # Supported by default or unsupported.
56    "//conditions:default": [],
57})
58
59# absl_random_randen_copts_init:
60#  Initialize the config targets based on cpu, os, etc. used to select
61#  the required values for ABSL_RANDOM_RANDEN_COPTS
62def absl_random_randen_copts_init():
63    """Initialize the config_settings used by ABSL_RANDOM_RANDEN_COPTS."""
64
65    # CPU configs.
66    # These configs have consistent flags to enable HWAES intsructions.
67    cpu_configs = [
68        "ppc",
69        "k8",
70        "darwin_x86_64",
71        "darwin",
72        "x64_windows_msvc",
73        "x64_windows",
74        "aarch64",
75    ]
76    for cpu in cpu_configs:
77        native.config_setting(
78            name = "cpu_%s" % cpu,
79            values = {"cpu": cpu},
80        )
81