github.com/GoogleCloudPlatform/testgrid@v0.0.174/cc/BUILD (about) 1 # Copyright 2016 The Bazel Authors. 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 at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 # This becomes the BUILD file for @local_config_cc// under non-BSD unixes. 16 17 load(":cc_toolchain_config.bzl", "cc_toolchain_config") 18 load(":armeabi_cc_toolchain_config.bzl", "armeabi_cc_toolchain_config") 19 load("@rules_cc//cc:defs.bzl", "cc_toolchain", "cc_toolchain_suite") 20 21 package(default_visibility = ["//visibility:public"]) 22 23 licenses(["notice"]) # Apache 2.0 24 25 cc_library( 26 name = "malloc", 27 ) 28 29 filegroup( 30 name = "empty", 31 srcs = [], 32 ) 33 34 filegroup( 35 name = "cc_wrapper", 36 srcs = ["cc_wrapper.sh"], 37 ) 38 39 filegroup( 40 name = "compiler_deps", 41 srcs = glob( 42 ["extra_tools/**"], 43 allow_empty = True, 44 ) + [":builtin_include_directory_paths"], 45 ) 46 47 # This is the entry point for --crosstool_top. Toolchains are found 48 # by lopping off the name of --crosstool_top and searching for 49 # the "${CPU}" entry in the toolchains attribute. 50 cc_toolchain_suite( 51 name = "toolchain", 52 toolchains = { 53 "k8|clang": ":cc-compiler-k8", 54 "k8": ":cc-compiler-k8", 55 "armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a", 56 "armeabi-v7a": ":cc-compiler-armeabi-v7a", 57 }, 58 ) 59 60 cc_toolchain( 61 name = "cc-compiler-k8", 62 all_files = ":compiler_deps", 63 ar_files = ":compiler_deps", 64 as_files = ":compiler_deps", 65 compiler_files = ":compiler_deps", 66 dwp_files = ":empty", 67 linker_files = ":compiler_deps", 68 module_map = ":module.modulemap", 69 objcopy_files = ":empty", 70 strip_files = ":empty", 71 supports_param_files = 1, 72 toolchain_config = ":linux_gnu_x86", 73 toolchain_identifier = "linux_gnu_x86", 74 ) 75 76 cc_toolchain_config( 77 name = "linux_gnu_x86", 78 abi_libc_version = "glibc_2.19", 79 abi_version = "clang", 80 compile_flags = [ 81 "-fstack-protector", 82 "-Wall", 83 "-Wthread-safety", 84 "-Wself-assign", 85 "-fcolor-diagnostics", 86 "-fno-omit-frame-pointer", 87 ], 88 compiler = "clang", 89 coverage_compile_flags = ["--coverage"], 90 coverage_link_flags = ["--coverage"], 91 cpu = "k8", 92 cxx_builtin_include_directories = [ 93 "/usr/local/include", 94 "/usr/local/lib/clang/12.0.0/include", 95 "/usr/include/x86_64-linux-gnu", 96 "/usr/include", 97 "/usr/local/lib/clang/12.0.0/share", 98 "/usr/include/c++/7.5.0", 99 "/usr/include/x86_64-linux-gnu/c++/7.5.0", 100 "/usr/include/c++/7.5.0/backward", 101 "/usr/local/include/c++/v1", 102 ], 103 cxx_flags = ["-std=c++0x"], 104 dbg_compile_flags = ["-g"], 105 host_system_name = "i686-unknown-linux-gnu", 106 link_flags = [ 107 "-fuse-ld=/usr/bin/ld.gold", 108 "-Wl,-no-as-needed", 109 "-Wl,-z,relro,-z,now", 110 "-B/usr/local/bin", 111 ], 112 link_libs = [ 113 "-lstdc++", 114 "-lm", 115 ], 116 opt_compile_flags = [ 117 "-g0", 118 "-O2", 119 "-D_FORTIFY_SOURCE=1", 120 "-DNDEBUG", 121 "-ffunction-sections", 122 "-fdata-sections", 123 ], 124 opt_link_flags = ["-Wl,--gc-sections"], 125 supports_start_end_lib = True, 126 target_libc = "glibc_2.19", 127 target_system_name = "x86_64-unknown-linux-gnu", 128 tool_paths = { 129 "ar": "/usr/bin/ar", 130 "ld": "/usr/bin/ld", 131 "llvm-cov": "/usr/local/bin/llvm-cov", 132 "cpp": "/usr/bin/cpp", 133 "gcc": "/usr/local/bin/clang-12", 134 "dwp": "/usr/bin/dwp", 135 "gcov": "/dev/null", 136 "nm": "/usr/bin/nm", 137 "objcopy": "/usr/bin/objcopy", 138 "objdump": "/usr/bin/objdump", 139 "strip": "/usr/bin/strip", 140 }, 141 toolchain_identifier = "linux_gnu_x86", 142 unfiltered_compile_flags = [ 143 "-no-canonical-prefixes", 144 "-Wno-builtin-macro-redefined", 145 "-D__DATE__=\"redacted\"", 146 "-D__TIMESTAMP__=\"redacted\"", 147 "-D__TIME__=\"redacted\"", 148 ], 149 ) 150 151 # Android tooling requires a default toolchain for the armeabi-v7a cpu. 152 cc_toolchain( 153 name = "cc-compiler-armeabi-v7a", 154 all_files = ":empty", 155 ar_files = ":empty", 156 as_files = ":empty", 157 compiler_files = ":empty", 158 dwp_files = ":empty", 159 linker_files = ":empty", 160 objcopy_files = ":empty", 161 strip_files = ":empty", 162 supports_param_files = 1, 163 toolchain_config = ":stub_armeabi-v7a", 164 toolchain_identifier = "stub_armeabi-v7a", 165 ) 166 167 armeabi_cc_toolchain_config(name = "stub_armeabi-v7a") 168 169 filegroup( 170 name = "package-srcs", 171 srcs = glob(["**"]), 172 tags = ["automanaged"], 173 visibility = ["//visibility:private"], 174 ) 175 176 filegroup( 177 name = "all-srcs", 178 srcs = [":package-srcs"], 179 tags = ["automanaged"], 180 visibility = ["//visibility:public"], 181 )