rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1 | # Copyright 2019 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. |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 14 | """A C++ toolchain configuration rule for macOS.""" |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 15 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 16 | load( |
| 17 | "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 18 | "action_config", |
| 19 | "env_entry", |
| 20 | "env_set", |
| 21 | "feature", |
| 22 | "feature_set", |
| 23 | "flag_group", |
| 24 | "flag_set", |
| 25 | "make_variable", |
| 26 | "tool", |
| 27 | "tool_path", |
| 28 | "variable_with_value", |
| 29 | "with_feature_set", |
| 30 | ) |
| 31 | load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES") |
| 32 | |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 33 | # The Xcode version from which that has support for deterministic mode |
| 34 | _SUPPORTS_DETERMINISTIC_MODE = "10.2" |
| 35 | |
| 36 | def _compare_versions(dv1, v2): |
| 37 | """Return value is <0, 0, >0 depending on DottedVersion dv1 comparison to string v2.""" |
| 38 | return dv1.compare_to(apple_common.dotted_version(v2)) |
| 39 | |
| 40 | def _can_use_deterministic_libtool(ctx): |
| 41 | """Returns `True` if the current version of `libtool` has support for |
| 42 | deterministic mode, and `False` otherwise.""" |
| 43 | xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig] |
| 44 | xcode_version = xcode_config.xcode_version() |
| 45 | if _compare_versions(xcode_version, _SUPPORTS_DETERMINISTIC_MODE) >= 0: |
| 46 | return True |
| 47 | else: |
| 48 | return False |
| 49 | |
| 50 | def _deterministic_libtool_flags(ctx): |
| 51 | """Returns additional `libtool` flags to enable deterministic mode, if they |
| 52 | are available.""" |
| 53 | if _can_use_deterministic_libtool(ctx): |
| 54 | return ["-D"] |
| 55 | return [] |
| 56 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 57 | def _impl(ctx): |
| 58 | if (ctx.attr.cpu == "darwin_x86_64"): |
| 59 | toolchain_identifier = "darwin_x86_64" |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 60 | elif (ctx.attr.cpu == "darwin_arm64"): |
| 61 | toolchain_identifier = "darwin_arm64" |
| 62 | elif (ctx.attr.cpu == "darwin_arm64e"): |
| 63 | toolchain_identifier = "darwin_arm64e" |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 64 | elif (ctx.attr.cpu == "ios_arm64"): |
| 65 | toolchain_identifier = "ios_arm64" |
| 66 | elif (ctx.attr.cpu == "ios_arm64e"): |
| 67 | toolchain_identifier = "ios_arm64e" |
| 68 | elif (ctx.attr.cpu == "ios_armv7"): |
| 69 | toolchain_identifier = "ios_armv7" |
| 70 | elif (ctx.attr.cpu == "ios_i386"): |
| 71 | toolchain_identifier = "ios_i386" |
| 72 | elif (ctx.attr.cpu == "ios_x86_64"): |
| 73 | toolchain_identifier = "ios_x86_64" |
| 74 | elif (ctx.attr.cpu == "armeabi-v7a"): |
| 75 | toolchain_identifier = "stub_armeabi-v7a" |
| 76 | elif (ctx.attr.cpu == "tvos_arm64"): |
| 77 | toolchain_identifier = "tvos_arm64" |
| 78 | elif (ctx.attr.cpu == "tvos_x86_64"): |
| 79 | toolchain_identifier = "tvos_x86_64" |
| 80 | elif (ctx.attr.cpu == "watchos_arm64_32"): |
| 81 | toolchain_identifier = "watchos_arm64_32" |
| 82 | elif (ctx.attr.cpu == "watchos_armv7k"): |
| 83 | toolchain_identifier = "watchos_armv7k" |
| 84 | elif (ctx.attr.cpu == "watchos_i386"): |
| 85 | toolchain_identifier = "watchos_i386" |
| 86 | elif (ctx.attr.cpu == "watchos_x86_64"): |
| 87 | toolchain_identifier = "watchos_x86_64" |
| 88 | else: |
| 89 | fail("Unreachable") |
| 90 | |
| 91 | if (ctx.attr.cpu == "armeabi-v7a"): |
| 92 | host_system_name = "armeabi-v7a" |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 93 | elif (ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 94 | ctx.attr.cpu == "darwin_arm64" or |
| 95 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 96 | ctx.attr.cpu == "ios_arm64" or |
| 97 | ctx.attr.cpu == "ios_arm64e" or |
| 98 | ctx.attr.cpu == "ios_armv7" or |
| 99 | ctx.attr.cpu == "ios_i386" or |
| 100 | ctx.attr.cpu == "ios_x86_64" or |
| 101 | ctx.attr.cpu == "tvos_arm64" or |
| 102 | ctx.attr.cpu == "tvos_x86_64" or |
| 103 | ctx.attr.cpu == "watchos_arm64_32" or |
| 104 | ctx.attr.cpu == "watchos_armv7k" or |
| 105 | ctx.attr.cpu == "watchos_i386" or |
| 106 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 107 | host_system_name = "x86_64-apple-macosx" |
| 108 | else: |
| 109 | fail("Unreachable") |
| 110 | |
| 111 | if (ctx.attr.cpu == "ios_arm64"): |
| 112 | target_system_name = "arm64-apple-ios" |
| 113 | elif (ctx.attr.cpu == "tvos_arm64"): |
| 114 | target_system_name = "arm64-apple-tvos" |
| 115 | elif (ctx.attr.cpu == "watchos_arm64_32"): |
| 116 | target_system_name = "arm64_32-apple-watchos" |
| 117 | elif (ctx.attr.cpu == "ios_arm64e"): |
| 118 | target_system_name = "arm64e-apple-ios" |
| 119 | elif (ctx.attr.cpu == "armeabi-v7a"): |
| 120 | target_system_name = "armeabi-v7a" |
| 121 | elif (ctx.attr.cpu == "ios_armv7"): |
| 122 | target_system_name = "armv7-apple-ios" |
| 123 | elif (ctx.attr.cpu == "watchos_armv7k"): |
| 124 | target_system_name = "armv7-apple-watchos" |
| 125 | elif (ctx.attr.cpu == "ios_i386"): |
| 126 | target_system_name = "i386-apple-ios" |
| 127 | elif (ctx.attr.cpu == "watchos_i386"): |
| 128 | target_system_name = "i386-apple-watchos" |
| 129 | elif (ctx.attr.cpu == "ios_x86_64"): |
| 130 | target_system_name = "x86_64-apple-ios" |
| 131 | elif (ctx.attr.cpu == "darwin_x86_64"): |
| 132 | target_system_name = "x86_64-apple-macosx" |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 133 | elif (ctx.attr.cpu == "darwin_arm64"): |
| 134 | target_system_name = "arm64-apple-macosx" |
| 135 | elif (ctx.attr.cpu == "darwin_arm64e"): |
| 136 | target_system_name = "arm64e-apple-macosx" |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 137 | elif (ctx.attr.cpu == "tvos_x86_64"): |
| 138 | target_system_name = "x86_64-apple-tvos" |
| 139 | elif (ctx.attr.cpu == "watchos_x86_64"): |
| 140 | target_system_name = "x86_64-apple-watchos" |
| 141 | else: |
| 142 | fail("Unreachable") |
| 143 | |
| 144 | if (ctx.attr.cpu == "armeabi-v7a"): |
| 145 | target_cpu = "armeabi-v7a" |
| 146 | elif (ctx.attr.cpu == "darwin_x86_64"): |
| 147 | target_cpu = "darwin_x86_64" |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 148 | elif (ctx.attr.cpu == "darwin_arm64"): |
| 149 | target_cpu = "darwin_arm64" |
| 150 | elif (ctx.attr.cpu == "darwin_arm64e"): |
| 151 | target_cpu = "darwin_arm64e" |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 152 | elif (ctx.attr.cpu == "ios_arm64"): |
| 153 | target_cpu = "ios_arm64" |
| 154 | elif (ctx.attr.cpu == "ios_arm64e"): |
| 155 | target_cpu = "ios_arm64e" |
| 156 | elif (ctx.attr.cpu == "ios_armv7"): |
| 157 | target_cpu = "ios_armv7" |
| 158 | elif (ctx.attr.cpu == "ios_i386"): |
| 159 | target_cpu = "ios_i386" |
| 160 | elif (ctx.attr.cpu == "ios_x86_64"): |
| 161 | target_cpu = "ios_x86_64" |
| 162 | elif (ctx.attr.cpu == "tvos_arm64"): |
| 163 | target_cpu = "tvos_arm64" |
| 164 | elif (ctx.attr.cpu == "tvos_x86_64"): |
| 165 | target_cpu = "tvos_x86_64" |
| 166 | elif (ctx.attr.cpu == "watchos_arm64_32"): |
| 167 | target_cpu = "watchos_arm64_32" |
| 168 | elif (ctx.attr.cpu == "watchos_armv7k"): |
| 169 | target_cpu = "watchos_armv7k" |
| 170 | elif (ctx.attr.cpu == "watchos_i386"): |
| 171 | target_cpu = "watchos_i386" |
| 172 | elif (ctx.attr.cpu == "watchos_x86_64"): |
| 173 | target_cpu = "watchos_x86_64" |
| 174 | else: |
| 175 | fail("Unreachable") |
| 176 | |
| 177 | if (ctx.attr.cpu == "armeabi-v7a"): |
| 178 | target_libc = "armeabi-v7a" |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 179 | elif (ctx.attr.cpu == "ios_arm64" or |
| 180 | ctx.attr.cpu == "ios_arm64e" or |
| 181 | ctx.attr.cpu == "ios_armv7" or |
| 182 | ctx.attr.cpu == "ios_i386" or |
| 183 | ctx.attr.cpu == "ios_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 184 | target_libc = "ios" |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 185 | elif (ctx.attr.cpu == "darwin_x86_64" or |
| 186 | ctx.attr.cpu == "darwin_arm64" or |
| 187 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 188 | target_libc = "macosx" |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 189 | elif (ctx.attr.cpu == "tvos_arm64" or |
| 190 | ctx.attr.cpu == "tvos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 191 | target_libc = "tvos" |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 192 | elif (ctx.attr.cpu == "watchos_arm64_32" or |
| 193 | ctx.attr.cpu == "watchos_armv7k" or |
| 194 | ctx.attr.cpu == "watchos_i386" or |
| 195 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 196 | target_libc = "watchos" |
| 197 | else: |
| 198 | fail("Unreachable") |
| 199 | |
| 200 | compiler = "compiler" |
| 201 | |
| 202 | if (ctx.attr.cpu == "armeabi-v7a"): |
| 203 | abi_version = "armeabi-v7a" |
| 204 | elif (ctx.attr.cpu == "darwin_x86_64"): |
| 205 | abi_version = "darwin_x86_64" |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 206 | elif (ctx.attr.cpu == "darwin_arm64" or |
| 207 | ctx.attr.cpu == "darwin_arm64e" or |
| 208 | ctx.attr.cpu == "ios_arm64" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 209 | ctx.attr.cpu == "ios_arm64e" or |
| 210 | ctx.attr.cpu == "ios_armv7" or |
| 211 | ctx.attr.cpu == "ios_i386" or |
| 212 | ctx.attr.cpu == "ios_x86_64" or |
| 213 | ctx.attr.cpu == "tvos_arm64" or |
| 214 | ctx.attr.cpu == "tvos_x86_64" or |
| 215 | ctx.attr.cpu == "watchos_arm64_32" or |
| 216 | ctx.attr.cpu == "watchos_armv7k" or |
| 217 | ctx.attr.cpu == "watchos_i386" or |
| 218 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 219 | abi_version = "local" |
| 220 | else: |
| 221 | fail("Unreachable") |
| 222 | |
| 223 | if (ctx.attr.cpu == "armeabi-v7a"): |
| 224 | abi_libc_version = "armeabi-v7a" |
| 225 | elif (ctx.attr.cpu == "darwin_x86_64"): |
| 226 | abi_libc_version = "darwin_x86_64" |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 227 | elif (ctx.attr.cpu == "darwin_arm64" or |
| 228 | ctx.attr.cpu == "darwin_arm64e" or |
| 229 | ctx.attr.cpu == "ios_arm64" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 230 | ctx.attr.cpu == "ios_arm64e" or |
| 231 | ctx.attr.cpu == "ios_armv7" or |
| 232 | ctx.attr.cpu == "ios_i386" or |
| 233 | ctx.attr.cpu == "ios_x86_64" or |
| 234 | ctx.attr.cpu == "tvos_arm64" or |
| 235 | ctx.attr.cpu == "tvos_x86_64" or |
| 236 | ctx.attr.cpu == "watchos_arm64_32" or |
| 237 | ctx.attr.cpu == "watchos_armv7k" or |
| 238 | ctx.attr.cpu == "watchos_i386" or |
| 239 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 240 | abi_libc_version = "local" |
| 241 | else: |
| 242 | fail("Unreachable") |
| 243 | |
| 244 | cc_target_os = "apple" |
| 245 | |
| 246 | builtin_sysroot = None |
| 247 | |
| 248 | all_compile_actions = [ |
| 249 | ACTION_NAMES.c_compile, |
| 250 | ACTION_NAMES.cpp_compile, |
| 251 | ACTION_NAMES.linkstamp_compile, |
| 252 | ACTION_NAMES.assemble, |
| 253 | ACTION_NAMES.preprocess_assemble, |
| 254 | ACTION_NAMES.cpp_header_parsing, |
| 255 | ACTION_NAMES.cpp_module_compile, |
| 256 | ACTION_NAMES.cpp_module_codegen, |
| 257 | ACTION_NAMES.clif_match, |
| 258 | ACTION_NAMES.lto_backend, |
| 259 | ] |
| 260 | |
| 261 | all_cpp_compile_actions = [ |
| 262 | ACTION_NAMES.cpp_compile, |
| 263 | ACTION_NAMES.linkstamp_compile, |
| 264 | ACTION_NAMES.cpp_header_parsing, |
| 265 | ACTION_NAMES.cpp_module_compile, |
| 266 | ACTION_NAMES.cpp_module_codegen, |
| 267 | ACTION_NAMES.clif_match, |
| 268 | ] |
| 269 | |
| 270 | preprocessor_compile_actions = [ |
| 271 | ACTION_NAMES.c_compile, |
| 272 | ACTION_NAMES.cpp_compile, |
| 273 | ACTION_NAMES.linkstamp_compile, |
| 274 | ACTION_NAMES.preprocess_assemble, |
| 275 | ACTION_NAMES.cpp_header_parsing, |
| 276 | ACTION_NAMES.cpp_module_compile, |
| 277 | ACTION_NAMES.clif_match, |
| 278 | ] |
| 279 | |
| 280 | codegen_compile_actions = [ |
| 281 | ACTION_NAMES.c_compile, |
| 282 | ACTION_NAMES.cpp_compile, |
| 283 | ACTION_NAMES.linkstamp_compile, |
| 284 | ACTION_NAMES.assemble, |
| 285 | ACTION_NAMES.preprocess_assemble, |
| 286 | ACTION_NAMES.cpp_module_codegen, |
| 287 | ACTION_NAMES.lto_backend, |
| 288 | ] |
| 289 | |
| 290 | all_link_actions = [ |
| 291 | ACTION_NAMES.cpp_link_executable, |
| 292 | ACTION_NAMES.cpp_link_dynamic_library, |
| 293 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 294 | ] |
| 295 | |
| 296 | strip_action = action_config( |
| 297 | action_name = ACTION_NAMES.strip, |
| 298 | flag_sets = [ |
| 299 | flag_set( |
| 300 | flag_groups = [ |
| 301 | flag_group(flags = ["-S", "-o", "%{output_file}"]), |
| 302 | flag_group( |
| 303 | flags = ["%{stripopts}"], |
| 304 | iterate_over = "stripopts", |
| 305 | ), |
| 306 | flag_group(flags = ["%{input_file}"]), |
| 307 | ], |
| 308 | ), |
| 309 | ], |
| 310 | tools = [tool(path = "/usr/bin/strip")], |
| 311 | ) |
| 312 | |
steinman | 33b5680 | 2020-01-03 15:25:11 -0800 | [diff] [blame] | 313 | xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig] |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 314 | xcode_execution_requirements = xcode_config.execution_info().keys() |
steinman | 33b5680 | 2020-01-03 15:25:11 -0800 | [diff] [blame] | 315 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 316 | if (ctx.attr.cpu == "tvos_arm64" or |
| 317 | ctx.attr.cpu == "tvos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 318 | cpp_header_parsing_action = action_config( |
| 319 | action_name = ACTION_NAMES.cpp_header_parsing, |
| 320 | implies = [ |
| 321 | "preprocessor_defines", |
| 322 | "include_system_dirs", |
| 323 | "version_min", |
| 324 | "objc_arc", |
| 325 | "no_objc_arc", |
| 326 | "apple_env", |
| 327 | "user_compile_flags", |
| 328 | "sysroot", |
| 329 | "unfiltered_compile_flags", |
| 330 | "compiler_input_flags", |
| 331 | "compiler_output_flags", |
| 332 | "unfiltered_cxx_flags", |
| 333 | ], |
| 334 | tools = [ |
| 335 | tool( |
| 336 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 337 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 338 | ), |
| 339 | ], |
| 340 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 341 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 342 | ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 343 | ctx.attr.cpu == "darwin_arm64" or |
| 344 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 345 | ctx.attr.cpu == "ios_arm64" or |
| 346 | ctx.attr.cpu == "ios_arm64e" or |
| 347 | ctx.attr.cpu == "ios_armv7" or |
| 348 | ctx.attr.cpu == "ios_i386" or |
| 349 | ctx.attr.cpu == "ios_x86_64" or |
| 350 | ctx.attr.cpu == "watchos_arm64_32" or |
| 351 | ctx.attr.cpu == "watchos_armv7k" or |
| 352 | ctx.attr.cpu == "watchos_i386" or |
| 353 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 354 | cpp_header_parsing_action = action_config( |
| 355 | action_name = ACTION_NAMES.cpp_header_parsing, |
| 356 | implies = [ |
| 357 | "preprocessor_defines", |
| 358 | "include_system_dirs", |
| 359 | "version_min", |
| 360 | "objc_arc", |
| 361 | "no_objc_arc", |
| 362 | "apple_env", |
| 363 | "user_compile_flags", |
| 364 | "sysroot", |
| 365 | "unfiltered_compile_flags", |
| 366 | "compiler_input_flags", |
| 367 | "compiler_output_flags", |
| 368 | ], |
| 369 | tools = [ |
| 370 | tool( |
| 371 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 372 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 373 | ), |
| 374 | ], |
| 375 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 376 | else: |
| 377 | cpp_header_parsing_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 378 | |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 379 | if (ctx.attr.cpu == "armeabi-v7a"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 380 | objc_compile_action = action_config( |
| 381 | action_name = ACTION_NAMES.objc_compile, |
| 382 | flag_sets = [ |
| 383 | flag_set( |
| 384 | flag_groups = [flag_group(flags = ["-arch", "<architecture>"])], |
| 385 | ), |
| 386 | ], |
| 387 | implies = [ |
| 388 | "compiler_input_flags", |
| 389 | "compiler_output_flags", |
| 390 | "objc_actions", |
| 391 | "apply_default_compiler_flags", |
| 392 | "apply_default_warnings", |
| 393 | "framework_paths", |
| 394 | "preprocessor_defines", |
| 395 | "include_system_dirs", |
| 396 | "version_min", |
| 397 | "objc_arc", |
| 398 | "no_objc_arc", |
| 399 | "apple_env", |
| 400 | "user_compile_flags", |
| 401 | "sysroot", |
| 402 | "unfiltered_compile_flags", |
| 403 | ], |
| 404 | tools = [ |
| 405 | tool( |
| 406 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 407 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 408 | ), |
| 409 | ], |
| 410 | ) |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 411 | elif (ctx.attr.cpu == "watchos_arm64_32"): |
| 412 | objc_compile_action = action_config( |
| 413 | action_name = ACTION_NAMES.objc_compile, |
| 414 | flag_sets = [ |
| 415 | flag_set( |
| 416 | flag_groups = [flag_group(flags = ["-arch", "arm64_32"])], |
| 417 | ), |
| 418 | ], |
| 419 | implies = [ |
| 420 | "compiler_input_flags", |
| 421 | "compiler_output_flags", |
| 422 | "objc_actions", |
| 423 | "apply_default_compiler_flags", |
| 424 | "apply_default_warnings", |
| 425 | "framework_paths", |
| 426 | "preprocessor_defines", |
| 427 | "include_system_dirs", |
| 428 | "version_min", |
| 429 | "objc_arc", |
| 430 | "no_objc_arc", |
| 431 | "apple_env", |
| 432 | "user_compile_flags", |
| 433 | "sysroot", |
| 434 | "unfiltered_compile_flags", |
| 435 | ], |
| 436 | tools = [ |
| 437 | tool( |
| 438 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 439 | execution_requirements = xcode_execution_requirements, |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 440 | ), |
| 441 | ], |
| 442 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 443 | elif (ctx.attr.cpu == "ios_arm64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 444 | ctx.attr.cpu == "tvos_arm64" or |
| 445 | ctx.attr.cpu == "darwin_arm64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 446 | objc_compile_action = action_config( |
| 447 | action_name = ACTION_NAMES.objc_compile, |
| 448 | flag_sets = [ |
| 449 | flag_set( |
| 450 | flag_groups = [flag_group(flags = ["-arch", "arm64"])], |
| 451 | ), |
| 452 | ], |
| 453 | implies = [ |
| 454 | "compiler_input_flags", |
| 455 | "compiler_output_flags", |
| 456 | "objc_actions", |
| 457 | "apply_default_compiler_flags", |
| 458 | "apply_default_warnings", |
| 459 | "framework_paths", |
| 460 | "preprocessor_defines", |
| 461 | "include_system_dirs", |
| 462 | "version_min", |
| 463 | "objc_arc", |
| 464 | "no_objc_arc", |
| 465 | "apple_env", |
| 466 | "user_compile_flags", |
| 467 | "sysroot", |
| 468 | "unfiltered_compile_flags", |
| 469 | ], |
| 470 | tools = [ |
| 471 | tool( |
| 472 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 473 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 474 | ), |
| 475 | ], |
| 476 | ) |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 477 | elif (ctx.attr.cpu == "ios_arm64e" or |
| 478 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 479 | objc_compile_action = action_config( |
| 480 | action_name = ACTION_NAMES.objc_compile, |
| 481 | flag_sets = [ |
| 482 | flag_set( |
| 483 | flag_groups = [flag_group(flags = ["-arch", "arm64e"])], |
| 484 | ), |
| 485 | ], |
| 486 | implies = [ |
| 487 | "compiler_input_flags", |
| 488 | "compiler_output_flags", |
| 489 | "objc_actions", |
| 490 | "apply_default_compiler_flags", |
| 491 | "apply_default_warnings", |
| 492 | "framework_paths", |
| 493 | "preprocessor_defines", |
| 494 | "include_system_dirs", |
| 495 | "version_min", |
| 496 | "objc_arc", |
| 497 | "no_objc_arc", |
| 498 | "apple_env", |
| 499 | "user_compile_flags", |
| 500 | "sysroot", |
| 501 | "unfiltered_compile_flags", |
| 502 | ], |
| 503 | tools = [ |
| 504 | tool( |
| 505 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 506 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 507 | ), |
| 508 | ], |
| 509 | ) |
| 510 | elif (ctx.attr.cpu == "ios_armv7"): |
| 511 | objc_compile_action = action_config( |
| 512 | action_name = ACTION_NAMES.objc_compile, |
| 513 | flag_sets = [ |
| 514 | flag_set( |
| 515 | flag_groups = [flag_group(flags = ["-arch", "armv7"])], |
| 516 | ), |
| 517 | ], |
| 518 | implies = [ |
| 519 | "compiler_input_flags", |
| 520 | "compiler_output_flags", |
| 521 | "objc_actions", |
| 522 | "apply_default_compiler_flags", |
| 523 | "apply_default_warnings", |
| 524 | "framework_paths", |
| 525 | "preprocessor_defines", |
| 526 | "include_system_dirs", |
| 527 | "version_min", |
| 528 | "objc_arc", |
| 529 | "no_objc_arc", |
| 530 | "apple_env", |
| 531 | "user_compile_flags", |
| 532 | "sysroot", |
| 533 | "unfiltered_compile_flags", |
| 534 | ], |
| 535 | tools = [ |
| 536 | tool( |
| 537 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 538 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 539 | ), |
| 540 | ], |
| 541 | ) |
| 542 | elif (ctx.attr.cpu == "watchos_armv7k"): |
| 543 | objc_compile_action = action_config( |
| 544 | action_name = ACTION_NAMES.objc_compile, |
| 545 | flag_sets = [ |
| 546 | flag_set( |
| 547 | flag_groups = [flag_group(flags = ["-arch", "armv7k"])], |
| 548 | ), |
| 549 | ], |
| 550 | implies = [ |
| 551 | "compiler_input_flags", |
| 552 | "compiler_output_flags", |
| 553 | "objc_actions", |
| 554 | "apply_default_compiler_flags", |
| 555 | "apply_default_warnings", |
| 556 | "framework_paths", |
| 557 | "preprocessor_defines", |
| 558 | "include_system_dirs", |
| 559 | "version_min", |
| 560 | "objc_arc", |
| 561 | "no_objc_arc", |
| 562 | "apple_env", |
| 563 | "user_compile_flags", |
| 564 | "sysroot", |
| 565 | "unfiltered_compile_flags", |
| 566 | ], |
| 567 | tools = [ |
| 568 | tool( |
| 569 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 570 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 571 | ), |
| 572 | ], |
| 573 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 574 | elif (ctx.attr.cpu == "ios_i386" or |
| 575 | ctx.attr.cpu == "watchos_i386"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 576 | objc_compile_action = action_config( |
| 577 | action_name = ACTION_NAMES.objc_compile, |
| 578 | flag_sets = [ |
| 579 | flag_set( |
| 580 | flag_groups = [flag_group(flags = ["-arch", "i386"])], |
| 581 | ), |
| 582 | ], |
| 583 | implies = [ |
| 584 | "compiler_input_flags", |
| 585 | "compiler_output_flags", |
| 586 | "objc_actions", |
| 587 | "apply_default_compiler_flags", |
| 588 | "apply_default_warnings", |
| 589 | "framework_paths", |
| 590 | "preprocessor_defines", |
| 591 | "include_system_dirs", |
| 592 | "version_min", |
| 593 | "objc_arc", |
| 594 | "no_objc_arc", |
| 595 | "apple_env", |
| 596 | "user_compile_flags", |
| 597 | "sysroot", |
| 598 | "unfiltered_compile_flags", |
| 599 | "apply_simulator_compiler_flags", |
| 600 | ], |
| 601 | tools = [ |
| 602 | tool( |
| 603 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 604 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 605 | ), |
| 606 | ], |
| 607 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 608 | elif (ctx.attr.cpu == "ios_x86_64" or |
| 609 | ctx.attr.cpu == "tvos_x86_64" or |
| 610 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 611 | objc_compile_action = action_config( |
| 612 | action_name = ACTION_NAMES.objc_compile, |
| 613 | flag_sets = [ |
| 614 | flag_set( |
| 615 | flag_groups = [flag_group(flags = ["-arch", "x86_64"])], |
| 616 | ), |
| 617 | ], |
| 618 | implies = [ |
| 619 | "compiler_input_flags", |
| 620 | "compiler_output_flags", |
| 621 | "objc_actions", |
| 622 | "apply_default_compiler_flags", |
| 623 | "apply_default_warnings", |
| 624 | "framework_paths", |
| 625 | "preprocessor_defines", |
| 626 | "include_system_dirs", |
| 627 | "version_min", |
| 628 | "objc_arc", |
| 629 | "no_objc_arc", |
| 630 | "apple_env", |
| 631 | "user_compile_flags", |
| 632 | "sysroot", |
| 633 | "unfiltered_compile_flags", |
| 634 | "apply_simulator_compiler_flags", |
| 635 | ], |
| 636 | tools = [ |
| 637 | tool( |
| 638 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 639 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 640 | ), |
| 641 | ], |
| 642 | ) |
| 643 | elif (ctx.attr.cpu == "darwin_x86_64"): |
| 644 | objc_compile_action = action_config( |
| 645 | action_name = ACTION_NAMES.objc_compile, |
| 646 | flag_sets = [ |
| 647 | flag_set( |
| 648 | flag_groups = [flag_group(flags = ["-arch", "x86_64"])], |
| 649 | ), |
| 650 | ], |
| 651 | implies = [ |
| 652 | "compiler_input_flags", |
| 653 | "compiler_output_flags", |
| 654 | "objc_actions", |
| 655 | "apply_default_compiler_flags", |
| 656 | "apply_default_warnings", |
| 657 | "framework_paths", |
| 658 | "preprocessor_defines", |
| 659 | "include_system_dirs", |
| 660 | "version_min", |
| 661 | "objc_arc", |
| 662 | "no_objc_arc", |
| 663 | "apple_env", |
| 664 | "user_compile_flags", |
| 665 | "sysroot", |
| 666 | "unfiltered_compile_flags", |
| 667 | ], |
| 668 | tools = [ |
| 669 | tool( |
| 670 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 671 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 672 | ), |
| 673 | ], |
| 674 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 675 | else: |
| 676 | objc_compile_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 677 | |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 678 | if (ctx.attr.cpu == "armeabi-v7a"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 679 | objcpp_executable_action = action_config( |
| 680 | action_name = "objc++-executable", |
| 681 | flag_sets = [ |
| 682 | flag_set( |
| 683 | flag_groups = [ |
| 684 | flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), |
| 685 | flag_group(flags = ["-arch", "<architecture>"]), |
| 686 | flag_group( |
| 687 | flags = [ |
| 688 | "-Xlinker", |
| 689 | "-objc_abi_version", |
| 690 | "-Xlinker", |
| 691 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 692 | "-fobjc-link-runtime", |
| 693 | "-ObjC", |
| 694 | ], |
| 695 | ), |
| 696 | flag_group( |
| 697 | flags = ["-framework", "%{framework_names}"], |
| 698 | iterate_over = "framework_names", |
| 699 | ), |
| 700 | flag_group( |
| 701 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 702 | iterate_over = "weak_framework_names", |
| 703 | ), |
| 704 | flag_group( |
| 705 | flags = ["-l%{library_names}"], |
| 706 | iterate_over = "library_names", |
| 707 | ), |
| 708 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 709 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 710 | flag_group( |
| 711 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 712 | iterate_over = "force_load_exec_paths", |
| 713 | ), |
| 714 | flag_group( |
| 715 | flags = ["%{dep_linkopts}"], |
| 716 | iterate_over = "dep_linkopts", |
| 717 | ), |
| 718 | flag_group( |
| 719 | flags = ["-Wl,%{attr_linkopts}"], |
| 720 | iterate_over = "attr_linkopts", |
| 721 | ), |
| 722 | ], |
| 723 | ), |
| 724 | ], |
| 725 | implies = [ |
| 726 | "include_system_dirs", |
| 727 | "framework_paths", |
| 728 | "version_min", |
| 729 | "strip_debug_symbols", |
| 730 | "apple_env", |
| 731 | "apply_implicit_frameworks", |
| 732 | ], |
| 733 | tools = [ |
| 734 | tool( |
| 735 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 736 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 737 | ), |
| 738 | ], |
| 739 | ) |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 740 | elif (ctx.attr.cpu == "watchos_arm64_32"): |
| 741 | objcpp_executable_action = action_config( |
| 742 | action_name = "objc++-executable", |
| 743 | flag_sets = [ |
| 744 | flag_set( |
| 745 | flag_groups = [ |
| 746 | flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), |
| 747 | flag_group(flags = ["-arch", "arm64_32"]), |
| 748 | flag_group( |
| 749 | flags = [ |
| 750 | "-Xlinker", |
| 751 | "-objc_abi_version", |
| 752 | "-Xlinker", |
| 753 | "2", |
| 754 | "-fobjc-link-runtime", |
| 755 | "-ObjC", |
| 756 | ], |
| 757 | ), |
| 758 | flag_group( |
| 759 | flags = ["-framework", "%{framework_names}"], |
| 760 | iterate_over = "framework_names", |
| 761 | ), |
| 762 | flag_group( |
| 763 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 764 | iterate_over = "weak_framework_names", |
| 765 | ), |
| 766 | flag_group( |
| 767 | flags = ["-l%{library_names}"], |
| 768 | iterate_over = "library_names", |
| 769 | ), |
| 770 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 771 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 772 | flag_group( |
| 773 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 774 | iterate_over = "force_load_exec_paths", |
| 775 | ), |
| 776 | flag_group( |
| 777 | flags = ["%{dep_linkopts}"], |
| 778 | iterate_over = "dep_linkopts", |
| 779 | ), |
| 780 | flag_group( |
| 781 | flags = ["-Wl,%{attr_linkopts}"], |
| 782 | iterate_over = "attr_linkopts", |
| 783 | ), |
| 784 | ], |
| 785 | ), |
| 786 | ], |
| 787 | implies = [ |
| 788 | "include_system_dirs", |
| 789 | "framework_paths", |
| 790 | "version_min", |
| 791 | "strip_debug_symbols", |
| 792 | "apple_env", |
| 793 | "apply_implicit_frameworks", |
| 794 | ], |
| 795 | tools = [ |
| 796 | tool( |
| 797 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 798 | execution_requirements = xcode_execution_requirements, |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 799 | ), |
| 800 | ], |
| 801 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 802 | elif (ctx.attr.cpu == "ios_arm64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 803 | ctx.attr.cpu == "tvos_arm64" or |
| 804 | ctx.attr.cpu == "darwin_arm64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 805 | objcpp_executable_action = action_config( |
| 806 | action_name = "objc++-executable", |
| 807 | flag_sets = [ |
| 808 | flag_set( |
| 809 | flag_groups = [ |
| 810 | flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), |
| 811 | flag_group(flags = ["-arch", "arm64"]), |
| 812 | flag_group( |
| 813 | flags = [ |
| 814 | "-Xlinker", |
| 815 | "-objc_abi_version", |
| 816 | "-Xlinker", |
| 817 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 818 | "-fobjc-link-runtime", |
| 819 | "-ObjC", |
| 820 | ], |
| 821 | ), |
| 822 | flag_group( |
| 823 | flags = ["-framework", "%{framework_names}"], |
| 824 | iterate_over = "framework_names", |
| 825 | ), |
| 826 | flag_group( |
| 827 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 828 | iterate_over = "weak_framework_names", |
| 829 | ), |
| 830 | flag_group( |
| 831 | flags = ["-l%{library_names}"], |
| 832 | iterate_over = "library_names", |
| 833 | ), |
| 834 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 835 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 836 | flag_group( |
| 837 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 838 | iterate_over = "force_load_exec_paths", |
| 839 | ), |
| 840 | flag_group( |
| 841 | flags = ["%{dep_linkopts}"], |
| 842 | iterate_over = "dep_linkopts", |
| 843 | ), |
| 844 | flag_group( |
| 845 | flags = ["-Wl,%{attr_linkopts}"], |
| 846 | iterate_over = "attr_linkopts", |
| 847 | ), |
| 848 | ], |
| 849 | ), |
| 850 | ], |
| 851 | implies = [ |
| 852 | "include_system_dirs", |
| 853 | "framework_paths", |
| 854 | "version_min", |
| 855 | "strip_debug_symbols", |
| 856 | "apple_env", |
| 857 | "apply_implicit_frameworks", |
| 858 | ], |
| 859 | tools = [ |
| 860 | tool( |
| 861 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 862 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 863 | ), |
| 864 | ], |
| 865 | ) |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 866 | elif (ctx.attr.cpu == "ios_arm64e" or |
| 867 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 868 | objcpp_executable_action = action_config( |
| 869 | action_name = "objc++-executable", |
| 870 | flag_sets = [ |
| 871 | flag_set( |
| 872 | flag_groups = [ |
| 873 | flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), |
| 874 | flag_group(flags = ["-arch", "arm64e"]), |
| 875 | flag_group( |
| 876 | flags = [ |
| 877 | "-Xlinker", |
| 878 | "-objc_abi_version", |
| 879 | "-Xlinker", |
| 880 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 881 | "-fobjc-link-runtime", |
| 882 | "-ObjC", |
| 883 | ], |
| 884 | ), |
| 885 | flag_group( |
| 886 | flags = ["-framework", "%{framework_names}"], |
| 887 | iterate_over = "framework_names", |
| 888 | ), |
| 889 | flag_group( |
| 890 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 891 | iterate_over = "weak_framework_names", |
| 892 | ), |
| 893 | flag_group( |
| 894 | flags = ["-l%{library_names}"], |
| 895 | iterate_over = "library_names", |
| 896 | ), |
| 897 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 898 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 899 | flag_group( |
| 900 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 901 | iterate_over = "force_load_exec_paths", |
| 902 | ), |
| 903 | flag_group( |
| 904 | flags = ["%{dep_linkopts}"], |
| 905 | iterate_over = "dep_linkopts", |
| 906 | ), |
| 907 | flag_group( |
| 908 | flags = ["-Wl,%{attr_linkopts}"], |
| 909 | iterate_over = "attr_linkopts", |
| 910 | ), |
| 911 | ], |
| 912 | ), |
| 913 | ], |
| 914 | implies = [ |
| 915 | "include_system_dirs", |
| 916 | "framework_paths", |
| 917 | "version_min", |
| 918 | "strip_debug_symbols", |
| 919 | "apple_env", |
| 920 | "apply_implicit_frameworks", |
| 921 | ], |
| 922 | tools = [ |
| 923 | tool( |
| 924 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 925 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 926 | ), |
| 927 | ], |
| 928 | ) |
| 929 | elif (ctx.attr.cpu == "ios_armv7"): |
| 930 | objcpp_executable_action = action_config( |
| 931 | action_name = "objc++-executable", |
| 932 | flag_sets = [ |
| 933 | flag_set( |
| 934 | flag_groups = [ |
| 935 | flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), |
| 936 | flag_group(flags = ["-arch", "armv7"]), |
| 937 | flag_group( |
| 938 | flags = [ |
| 939 | "-Xlinker", |
| 940 | "-objc_abi_version", |
| 941 | "-Xlinker", |
| 942 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 943 | "-fobjc-link-runtime", |
| 944 | "-ObjC", |
| 945 | ], |
| 946 | ), |
| 947 | flag_group( |
| 948 | flags = ["-framework", "%{framework_names}"], |
| 949 | iterate_over = "framework_names", |
| 950 | ), |
| 951 | flag_group( |
| 952 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 953 | iterate_over = "weak_framework_names", |
| 954 | ), |
| 955 | flag_group( |
| 956 | flags = ["-l%{library_names}"], |
| 957 | iterate_over = "library_names", |
| 958 | ), |
| 959 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 960 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 961 | flag_group( |
| 962 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 963 | iterate_over = "force_load_exec_paths", |
| 964 | ), |
| 965 | flag_group( |
| 966 | flags = ["%{dep_linkopts}"], |
| 967 | iterate_over = "dep_linkopts", |
| 968 | ), |
| 969 | flag_group( |
| 970 | flags = ["-Wl,%{attr_linkopts}"], |
| 971 | iterate_over = "attr_linkopts", |
| 972 | ), |
| 973 | ], |
| 974 | ), |
| 975 | ], |
| 976 | implies = [ |
| 977 | "include_system_dirs", |
| 978 | "framework_paths", |
| 979 | "version_min", |
| 980 | "strip_debug_symbols", |
| 981 | "apple_env", |
| 982 | "apply_implicit_frameworks", |
| 983 | ], |
| 984 | tools = [ |
| 985 | tool( |
| 986 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 987 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 988 | ), |
| 989 | ], |
| 990 | ) |
| 991 | elif (ctx.attr.cpu == "watchos_armv7k"): |
| 992 | objcpp_executable_action = action_config( |
| 993 | action_name = "objc++-executable", |
| 994 | flag_sets = [ |
| 995 | flag_set( |
| 996 | flag_groups = [ |
| 997 | flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), |
| 998 | flag_group(flags = ["-arch", "armv7k"]), |
| 999 | flag_group( |
| 1000 | flags = [ |
| 1001 | "-Xlinker", |
| 1002 | "-objc_abi_version", |
| 1003 | "-Xlinker", |
| 1004 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1005 | "-fobjc-link-runtime", |
| 1006 | "-ObjC", |
| 1007 | ], |
| 1008 | ), |
| 1009 | flag_group( |
| 1010 | flags = ["-framework", "%{framework_names}"], |
| 1011 | iterate_over = "framework_names", |
| 1012 | ), |
| 1013 | flag_group( |
| 1014 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 1015 | iterate_over = "weak_framework_names", |
| 1016 | ), |
| 1017 | flag_group( |
| 1018 | flags = ["-l%{library_names}"], |
| 1019 | iterate_over = "library_names", |
| 1020 | ), |
| 1021 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 1022 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 1023 | flag_group( |
| 1024 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 1025 | iterate_over = "force_load_exec_paths", |
| 1026 | ), |
| 1027 | flag_group( |
| 1028 | flags = ["%{dep_linkopts}"], |
| 1029 | iterate_over = "dep_linkopts", |
| 1030 | ), |
| 1031 | flag_group( |
| 1032 | flags = ["-Wl,%{attr_linkopts}"], |
| 1033 | iterate_over = "attr_linkopts", |
| 1034 | ), |
| 1035 | ], |
| 1036 | ), |
| 1037 | ], |
| 1038 | implies = [ |
| 1039 | "include_system_dirs", |
| 1040 | "framework_paths", |
| 1041 | "version_min", |
| 1042 | "strip_debug_symbols", |
| 1043 | "apple_env", |
| 1044 | "apply_implicit_frameworks", |
| 1045 | ], |
| 1046 | tools = [ |
| 1047 | tool( |
| 1048 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1049 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1050 | ), |
| 1051 | ], |
| 1052 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1053 | elif (ctx.attr.cpu == "ios_i386" or |
| 1054 | ctx.attr.cpu == "watchos_i386"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1055 | objcpp_executable_action = action_config( |
| 1056 | action_name = "objc++-executable", |
| 1057 | flag_sets = [ |
| 1058 | flag_set( |
| 1059 | flag_groups = [ |
| 1060 | flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), |
| 1061 | flag_group(flags = ["-arch", "i386"]), |
| 1062 | flag_group( |
| 1063 | flags = [ |
| 1064 | "-Xlinker", |
| 1065 | "-objc_abi_version", |
| 1066 | "-Xlinker", |
| 1067 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1068 | "-fobjc-link-runtime", |
| 1069 | "-ObjC", |
| 1070 | ], |
| 1071 | ), |
| 1072 | flag_group( |
| 1073 | flags = ["-framework", "%{framework_names}"], |
| 1074 | iterate_over = "framework_names", |
| 1075 | ), |
| 1076 | flag_group( |
| 1077 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 1078 | iterate_over = "weak_framework_names", |
| 1079 | ), |
| 1080 | flag_group( |
| 1081 | flags = ["-l%{library_names}"], |
| 1082 | iterate_over = "library_names", |
| 1083 | ), |
| 1084 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 1085 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 1086 | flag_group( |
| 1087 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 1088 | iterate_over = "force_load_exec_paths", |
| 1089 | ), |
| 1090 | flag_group( |
| 1091 | flags = ["%{dep_linkopts}"], |
| 1092 | iterate_over = "dep_linkopts", |
| 1093 | ), |
| 1094 | flag_group( |
| 1095 | flags = ["-Wl,%{attr_linkopts}"], |
| 1096 | iterate_over = "attr_linkopts", |
| 1097 | ), |
| 1098 | ], |
| 1099 | ), |
| 1100 | ], |
| 1101 | implies = [ |
| 1102 | "include_system_dirs", |
| 1103 | "framework_paths", |
| 1104 | "version_min", |
| 1105 | "strip_debug_symbols", |
| 1106 | "apple_env", |
| 1107 | "apply_implicit_frameworks", |
| 1108 | ], |
| 1109 | tools = [ |
| 1110 | tool( |
| 1111 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1112 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1113 | ), |
| 1114 | ], |
| 1115 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1116 | elif (ctx.attr.cpu == "darwin_x86_64" or |
| 1117 | ctx.attr.cpu == "ios_x86_64" or |
| 1118 | ctx.attr.cpu == "tvos_x86_64" or |
| 1119 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1120 | objcpp_executable_action = action_config( |
| 1121 | action_name = "objc++-executable", |
| 1122 | flag_sets = [ |
| 1123 | flag_set( |
| 1124 | flag_groups = [ |
| 1125 | flag_group(flags = ["-stdlib=libc++", "-std=gnu++11"]), |
| 1126 | flag_group(flags = ["-arch", "x86_64"]), |
| 1127 | flag_group( |
| 1128 | flags = [ |
| 1129 | "-Xlinker", |
| 1130 | "-objc_abi_version", |
| 1131 | "-Xlinker", |
| 1132 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1133 | "-fobjc-link-runtime", |
| 1134 | "-ObjC", |
| 1135 | ], |
| 1136 | ), |
| 1137 | flag_group( |
| 1138 | flags = ["-framework", "%{framework_names}"], |
| 1139 | iterate_over = "framework_names", |
| 1140 | ), |
| 1141 | flag_group( |
| 1142 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 1143 | iterate_over = "weak_framework_names", |
| 1144 | ), |
| 1145 | flag_group( |
| 1146 | flags = ["-l%{library_names}"], |
| 1147 | iterate_over = "library_names", |
| 1148 | ), |
| 1149 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 1150 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 1151 | flag_group( |
| 1152 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 1153 | iterate_over = "force_load_exec_paths", |
| 1154 | ), |
| 1155 | flag_group( |
| 1156 | flags = ["%{dep_linkopts}"], |
| 1157 | iterate_over = "dep_linkopts", |
| 1158 | ), |
| 1159 | flag_group( |
| 1160 | flags = ["-Wl,%{attr_linkopts}"], |
| 1161 | iterate_over = "attr_linkopts", |
| 1162 | ), |
| 1163 | ], |
| 1164 | ), |
| 1165 | ], |
| 1166 | implies = [ |
| 1167 | "include_system_dirs", |
| 1168 | "framework_paths", |
| 1169 | "version_min", |
| 1170 | "strip_debug_symbols", |
| 1171 | "apple_env", |
| 1172 | "apply_implicit_frameworks", |
| 1173 | ], |
| 1174 | tools = [ |
| 1175 | tool( |
| 1176 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1177 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1178 | ), |
| 1179 | ], |
| 1180 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1181 | else: |
| 1182 | objcpp_executable_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1183 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1184 | if (ctx.attr.cpu == "tvos_arm64" or |
| 1185 | ctx.attr.cpu == "tvos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1186 | cpp_link_dynamic_library_action = action_config( |
| 1187 | action_name = ACTION_NAMES.cpp_link_dynamic_library, |
| 1188 | implies = [ |
| 1189 | "contains_objc_source", |
| 1190 | "has_configured_linker_path", |
| 1191 | "symbol_counts", |
| 1192 | "shared_flag", |
| 1193 | "linkstamps", |
| 1194 | "output_execpath_flags", |
| 1195 | "runtime_root_flags", |
| 1196 | "input_param_flags", |
| 1197 | "strip_debug_symbols", |
| 1198 | "linker_param_file", |
| 1199 | "version_min", |
| 1200 | "apple_env", |
| 1201 | "sysroot", |
| 1202 | "cpp_linker_flags", |
| 1203 | ], |
| 1204 | tools = [ |
| 1205 | tool( |
| 1206 | path = "cc_wrapper.sh", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1207 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1208 | ), |
| 1209 | ], |
| 1210 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1211 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 1212 | ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 1213 | ctx.attr.cpu == "darwin_arm64" or |
| 1214 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1215 | ctx.attr.cpu == "ios_arm64" or |
| 1216 | ctx.attr.cpu == "ios_arm64e" or |
| 1217 | ctx.attr.cpu == "ios_armv7" or |
| 1218 | ctx.attr.cpu == "ios_i386" or |
| 1219 | ctx.attr.cpu == "ios_x86_64" or |
| 1220 | ctx.attr.cpu == "watchos_arm64_32" or |
| 1221 | ctx.attr.cpu == "watchos_armv7k" or |
| 1222 | ctx.attr.cpu == "watchos_i386" or |
| 1223 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1224 | cpp_link_dynamic_library_action = action_config( |
| 1225 | action_name = ACTION_NAMES.cpp_link_dynamic_library, |
| 1226 | implies = [ |
| 1227 | "contains_objc_source", |
| 1228 | "has_configured_linker_path", |
| 1229 | "symbol_counts", |
| 1230 | "shared_flag", |
| 1231 | "linkstamps", |
| 1232 | "output_execpath_flags", |
| 1233 | "runtime_root_flags", |
| 1234 | "input_param_flags", |
| 1235 | "strip_debug_symbols", |
| 1236 | "linker_param_file", |
| 1237 | "version_min", |
| 1238 | "apple_env", |
| 1239 | "sysroot", |
| 1240 | ], |
| 1241 | tools = [ |
| 1242 | tool( |
| 1243 | path = "cc_wrapper.sh", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1244 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1245 | ), |
| 1246 | ], |
| 1247 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1248 | else: |
| 1249 | cpp_link_dynamic_library_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1250 | |
| 1251 | cpp_link_static_library_action = action_config( |
| 1252 | action_name = ACTION_NAMES.cpp_link_static_library, |
| 1253 | implies = [ |
| 1254 | "runtime_root_flags", |
| 1255 | "archiver_flags", |
| 1256 | "input_param_flags", |
| 1257 | "linker_param_file", |
| 1258 | "apple_env", |
| 1259 | ], |
| 1260 | tools = [ |
| 1261 | tool( |
Keith Smiley | 4dfc83d | 2019-08-23 13:20:46 -0700 | [diff] [blame] | 1262 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1263 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1264 | ), |
| 1265 | ], |
| 1266 | ) |
| 1267 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1268 | if (ctx.attr.cpu == "tvos_arm64" or |
| 1269 | ctx.attr.cpu == "tvos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1270 | c_compile_action = action_config( |
| 1271 | action_name = ACTION_NAMES.c_compile, |
| 1272 | implies = [ |
| 1273 | "preprocessor_defines", |
| 1274 | "include_system_dirs", |
| 1275 | "version_min", |
| 1276 | "objc_arc", |
| 1277 | "no_objc_arc", |
| 1278 | "apple_env", |
| 1279 | "user_compile_flags", |
| 1280 | "sysroot", |
| 1281 | "unfiltered_compile_flags", |
| 1282 | "compiler_input_flags", |
| 1283 | "compiler_output_flags", |
| 1284 | "unfiltered_cxx_flags", |
| 1285 | ], |
| 1286 | tools = [ |
| 1287 | tool( |
| 1288 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1289 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1290 | ), |
| 1291 | ], |
| 1292 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1293 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 1294 | ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 1295 | ctx.attr.cpu == "darwin_arm64" or |
| 1296 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1297 | ctx.attr.cpu == "ios_arm64" or |
| 1298 | ctx.attr.cpu == "ios_arm64e" or |
| 1299 | ctx.attr.cpu == "ios_armv7" or |
| 1300 | ctx.attr.cpu == "ios_i386" or |
| 1301 | ctx.attr.cpu == "ios_x86_64" or |
| 1302 | ctx.attr.cpu == "watchos_arm64_32" or |
| 1303 | ctx.attr.cpu == "watchos_armv7k" or |
| 1304 | ctx.attr.cpu == "watchos_i386" or |
| 1305 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1306 | c_compile_action = action_config( |
| 1307 | action_name = ACTION_NAMES.c_compile, |
| 1308 | implies = [ |
| 1309 | "preprocessor_defines", |
| 1310 | "include_system_dirs", |
| 1311 | "version_min", |
| 1312 | "objc_arc", |
| 1313 | "no_objc_arc", |
| 1314 | "apple_env", |
| 1315 | "user_compile_flags", |
| 1316 | "sysroot", |
| 1317 | "unfiltered_compile_flags", |
| 1318 | "compiler_input_flags", |
| 1319 | "compiler_output_flags", |
| 1320 | ], |
| 1321 | tools = [ |
| 1322 | tool( |
| 1323 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1324 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1325 | ), |
| 1326 | ], |
| 1327 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1328 | else: |
| 1329 | c_compile_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1330 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1331 | if (ctx.attr.cpu == "tvos_arm64" or |
| 1332 | ctx.attr.cpu == "tvos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1333 | cpp_compile_action = action_config( |
| 1334 | action_name = ACTION_NAMES.cpp_compile, |
| 1335 | implies = [ |
| 1336 | "preprocessor_defines", |
| 1337 | "include_system_dirs", |
| 1338 | "version_min", |
| 1339 | "objc_arc", |
| 1340 | "no_objc_arc", |
| 1341 | "apple_env", |
| 1342 | "user_compile_flags", |
| 1343 | "sysroot", |
| 1344 | "unfiltered_compile_flags", |
| 1345 | "compiler_input_flags", |
| 1346 | "compiler_output_flags", |
| 1347 | "unfiltered_cxx_flags", |
| 1348 | ], |
| 1349 | tools = [ |
| 1350 | tool( |
John Laxson | 871bf83 | 2021-02-12 04:48:06 -0800 | [diff] [blame] | 1351 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1352 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1353 | ), |
| 1354 | ], |
| 1355 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1356 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 1357 | ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 1358 | ctx.attr.cpu == "darwin_arm64" or |
| 1359 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1360 | ctx.attr.cpu == "ios_arm64" or |
| 1361 | ctx.attr.cpu == "ios_arm64e" or |
| 1362 | ctx.attr.cpu == "ios_armv7" or |
| 1363 | ctx.attr.cpu == "ios_i386" or |
| 1364 | ctx.attr.cpu == "ios_x86_64" or |
| 1365 | ctx.attr.cpu == "watchos_arm64_32" or |
| 1366 | ctx.attr.cpu == "watchos_armv7k" or |
| 1367 | ctx.attr.cpu == "watchos_i386" or |
| 1368 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1369 | cpp_compile_action = action_config( |
| 1370 | action_name = ACTION_NAMES.cpp_compile, |
| 1371 | implies = [ |
| 1372 | "preprocessor_defines", |
| 1373 | "include_system_dirs", |
| 1374 | "version_min", |
| 1375 | "objc_arc", |
| 1376 | "no_objc_arc", |
| 1377 | "apple_env", |
| 1378 | "user_compile_flags", |
| 1379 | "sysroot", |
| 1380 | "unfiltered_compile_flags", |
| 1381 | "compiler_input_flags", |
| 1382 | "compiler_output_flags", |
| 1383 | ], |
| 1384 | tools = [ |
| 1385 | tool( |
John Laxson | 871bf83 | 2021-02-12 04:48:06 -0800 | [diff] [blame] | 1386 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1387 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1388 | ), |
| 1389 | ], |
| 1390 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1391 | else: |
| 1392 | cpp_compile_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1393 | |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 1394 | if (ctx.attr.cpu == "armeabi-v7a"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1395 | objcpp_compile_action = action_config( |
| 1396 | action_name = ACTION_NAMES.objcpp_compile, |
| 1397 | flag_sets = [ |
| 1398 | flag_set( |
| 1399 | flag_groups = [ |
| 1400 | flag_group( |
| 1401 | flags = [ |
| 1402 | "-arch", |
| 1403 | "<architecture>", |
| 1404 | "-stdlib=libc++", |
| 1405 | "-std=gnu++11", |
| 1406 | ], |
| 1407 | ), |
| 1408 | ], |
| 1409 | ), |
| 1410 | ], |
| 1411 | implies = [ |
| 1412 | "compiler_input_flags", |
| 1413 | "compiler_output_flags", |
| 1414 | "apply_default_compiler_flags", |
| 1415 | "apply_default_warnings", |
| 1416 | "framework_paths", |
| 1417 | "preprocessor_defines", |
| 1418 | "include_system_dirs", |
| 1419 | "version_min", |
| 1420 | "objc_arc", |
| 1421 | "no_objc_arc", |
| 1422 | "apple_env", |
| 1423 | "user_compile_flags", |
| 1424 | "sysroot", |
| 1425 | "unfiltered_compile_flags", |
| 1426 | ], |
| 1427 | tools = [ |
| 1428 | tool( |
John Laxson | 871bf83 | 2021-02-12 04:48:06 -0800 | [diff] [blame] | 1429 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1430 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1431 | ), |
| 1432 | ], |
| 1433 | ) |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 1434 | elif (ctx.attr.cpu == "watchos_arm64_32"): |
| 1435 | objcpp_compile_action = action_config( |
| 1436 | action_name = ACTION_NAMES.objcpp_compile, |
| 1437 | flag_sets = [ |
| 1438 | flag_set( |
| 1439 | flag_groups = [ |
| 1440 | flag_group( |
| 1441 | flags = [ |
| 1442 | "-arch", |
| 1443 | "arm64_32", |
| 1444 | "-stdlib=libc++", |
| 1445 | "-std=gnu++11", |
| 1446 | ], |
| 1447 | ), |
| 1448 | ], |
| 1449 | ), |
| 1450 | ], |
| 1451 | implies = [ |
| 1452 | "compiler_input_flags", |
| 1453 | "compiler_output_flags", |
| 1454 | "apply_default_compiler_flags", |
| 1455 | "apply_default_warnings", |
| 1456 | "framework_paths", |
| 1457 | "preprocessor_defines", |
| 1458 | "include_system_dirs", |
| 1459 | "version_min", |
| 1460 | "objc_arc", |
| 1461 | "no_objc_arc", |
| 1462 | "apple_env", |
| 1463 | "user_compile_flags", |
| 1464 | "sysroot", |
| 1465 | "unfiltered_compile_flags", |
| 1466 | ], |
| 1467 | tools = [ |
| 1468 | tool( |
John Laxson | 871bf83 | 2021-02-12 04:48:06 -0800 | [diff] [blame] | 1469 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1470 | execution_requirements = xcode_execution_requirements, |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 1471 | ), |
| 1472 | ], |
| 1473 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1474 | elif (ctx.attr.cpu == "ios_arm64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 1475 | ctx.attr.cpu == "tvos_arm64" or |
| 1476 | ctx.attr.cpu == "darwin_arm64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1477 | objcpp_compile_action = action_config( |
| 1478 | action_name = ACTION_NAMES.objcpp_compile, |
| 1479 | flag_sets = [ |
| 1480 | flag_set( |
| 1481 | flag_groups = [ |
| 1482 | flag_group( |
| 1483 | flags = ["-arch", "arm64", "-stdlib=libc++", "-std=gnu++11"], |
| 1484 | ), |
| 1485 | ], |
| 1486 | ), |
| 1487 | ], |
| 1488 | implies = [ |
| 1489 | "compiler_input_flags", |
| 1490 | "compiler_output_flags", |
| 1491 | "apply_default_compiler_flags", |
| 1492 | "apply_default_warnings", |
| 1493 | "framework_paths", |
| 1494 | "preprocessor_defines", |
| 1495 | "include_system_dirs", |
| 1496 | "version_min", |
| 1497 | "objc_arc", |
| 1498 | "no_objc_arc", |
| 1499 | "apple_env", |
| 1500 | "user_compile_flags", |
| 1501 | "sysroot", |
| 1502 | "unfiltered_compile_flags", |
| 1503 | ], |
| 1504 | tools = [ |
| 1505 | tool( |
John Laxson | 871bf83 | 2021-02-12 04:48:06 -0800 | [diff] [blame] | 1506 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1507 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1508 | ), |
| 1509 | ], |
| 1510 | ) |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 1511 | elif (ctx.attr.cpu == "ios_arm64e" or |
| 1512 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1513 | objcpp_compile_action = action_config( |
| 1514 | action_name = ACTION_NAMES.objcpp_compile, |
| 1515 | flag_sets = [ |
| 1516 | flag_set( |
| 1517 | flag_groups = [ |
| 1518 | flag_group( |
| 1519 | flags = ["-arch", "arm64e", "-stdlib=libc++", "-std=gnu++11"], |
| 1520 | ), |
| 1521 | ], |
| 1522 | ), |
| 1523 | ], |
| 1524 | implies = [ |
| 1525 | "compiler_input_flags", |
| 1526 | "compiler_output_flags", |
| 1527 | "apply_default_compiler_flags", |
| 1528 | "apply_default_warnings", |
| 1529 | "framework_paths", |
| 1530 | "preprocessor_defines", |
| 1531 | "include_system_dirs", |
| 1532 | "version_min", |
| 1533 | "objc_arc", |
| 1534 | "no_objc_arc", |
| 1535 | "apple_env", |
| 1536 | "user_compile_flags", |
| 1537 | "sysroot", |
| 1538 | "unfiltered_compile_flags", |
| 1539 | ], |
| 1540 | tools = [ |
| 1541 | tool( |
John Laxson | 871bf83 | 2021-02-12 04:48:06 -0800 | [diff] [blame] | 1542 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1543 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1544 | ), |
| 1545 | ], |
| 1546 | ) |
| 1547 | elif (ctx.attr.cpu == "ios_armv7"): |
| 1548 | objcpp_compile_action = action_config( |
| 1549 | action_name = ACTION_NAMES.objcpp_compile, |
| 1550 | flag_sets = [ |
| 1551 | flag_set( |
| 1552 | flag_groups = [ |
| 1553 | flag_group( |
| 1554 | flags = ["-arch", "armv7", "-stdlib=libc++", "-std=gnu++11"], |
| 1555 | ), |
| 1556 | ], |
| 1557 | ), |
| 1558 | ], |
| 1559 | implies = [ |
| 1560 | "compiler_input_flags", |
| 1561 | "compiler_output_flags", |
| 1562 | "apply_default_compiler_flags", |
| 1563 | "apply_default_warnings", |
| 1564 | "framework_paths", |
| 1565 | "preprocessor_defines", |
| 1566 | "include_system_dirs", |
| 1567 | "version_min", |
| 1568 | "objc_arc", |
| 1569 | "no_objc_arc", |
| 1570 | "apple_env", |
| 1571 | "user_compile_flags", |
| 1572 | "sysroot", |
| 1573 | "unfiltered_compile_flags", |
| 1574 | ], |
| 1575 | tools = [ |
| 1576 | tool( |
| 1577 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1578 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1579 | ), |
| 1580 | ], |
| 1581 | ) |
| 1582 | elif (ctx.attr.cpu == "watchos_armv7k"): |
| 1583 | objcpp_compile_action = action_config( |
| 1584 | action_name = ACTION_NAMES.objcpp_compile, |
| 1585 | flag_sets = [ |
| 1586 | flag_set( |
| 1587 | flag_groups = [ |
| 1588 | flag_group( |
| 1589 | flags = ["-arch", "armv7k", "-stdlib=libc++", "-std=gnu++11"], |
| 1590 | ), |
| 1591 | ], |
| 1592 | ), |
| 1593 | ], |
| 1594 | implies = [ |
| 1595 | "compiler_input_flags", |
| 1596 | "compiler_output_flags", |
| 1597 | "apply_default_compiler_flags", |
| 1598 | "apply_default_warnings", |
| 1599 | "framework_paths", |
| 1600 | "preprocessor_defines", |
| 1601 | "include_system_dirs", |
| 1602 | "version_min", |
| 1603 | "objc_arc", |
| 1604 | "no_objc_arc", |
| 1605 | "apple_env", |
| 1606 | "user_compile_flags", |
| 1607 | "sysroot", |
| 1608 | "unfiltered_compile_flags", |
| 1609 | ], |
| 1610 | tools = [ |
| 1611 | tool( |
John Laxson | 871bf83 | 2021-02-12 04:48:06 -0800 | [diff] [blame] | 1612 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1613 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1614 | ), |
| 1615 | ], |
| 1616 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1617 | elif (ctx.attr.cpu == "ios_i386" or |
| 1618 | ctx.attr.cpu == "watchos_i386"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1619 | objcpp_compile_action = action_config( |
| 1620 | action_name = ACTION_NAMES.objcpp_compile, |
| 1621 | flag_sets = [ |
| 1622 | flag_set( |
| 1623 | flag_groups = [ |
| 1624 | flag_group( |
| 1625 | flags = ["-arch", "i386", "-stdlib=libc++", "-std=gnu++11"], |
| 1626 | ), |
| 1627 | ], |
| 1628 | ), |
| 1629 | ], |
| 1630 | implies = [ |
| 1631 | "compiler_input_flags", |
| 1632 | "compiler_output_flags", |
| 1633 | "apply_default_compiler_flags", |
| 1634 | "apply_default_warnings", |
| 1635 | "framework_paths", |
| 1636 | "preprocessor_defines", |
| 1637 | "include_system_dirs", |
| 1638 | "version_min", |
| 1639 | "objc_arc", |
| 1640 | "no_objc_arc", |
| 1641 | "apple_env", |
| 1642 | "user_compile_flags", |
| 1643 | "sysroot", |
| 1644 | "unfiltered_compile_flags", |
| 1645 | "apply_simulator_compiler_flags", |
| 1646 | ], |
| 1647 | tools = [ |
| 1648 | tool( |
John Laxson | 871bf83 | 2021-02-12 04:48:06 -0800 | [diff] [blame] | 1649 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1650 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1651 | ), |
| 1652 | ], |
| 1653 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1654 | elif (ctx.attr.cpu == "ios_x86_64" or |
| 1655 | ctx.attr.cpu == "tvos_x86_64" or |
| 1656 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1657 | objcpp_compile_action = action_config( |
| 1658 | action_name = ACTION_NAMES.objcpp_compile, |
| 1659 | flag_sets = [ |
| 1660 | flag_set( |
| 1661 | flag_groups = [ |
| 1662 | flag_group( |
| 1663 | flags = ["-arch", "x86_64", "-stdlib=libc++", "-std=gnu++11"], |
| 1664 | ), |
| 1665 | ], |
| 1666 | ), |
| 1667 | ], |
| 1668 | implies = [ |
| 1669 | "compiler_input_flags", |
| 1670 | "compiler_output_flags", |
| 1671 | "apply_default_compiler_flags", |
| 1672 | "apply_default_warnings", |
| 1673 | "framework_paths", |
| 1674 | "preprocessor_defines", |
| 1675 | "include_system_dirs", |
| 1676 | "version_min", |
| 1677 | "objc_arc", |
| 1678 | "no_objc_arc", |
| 1679 | "apple_env", |
| 1680 | "user_compile_flags", |
| 1681 | "sysroot", |
| 1682 | "unfiltered_compile_flags", |
| 1683 | "apply_simulator_compiler_flags", |
| 1684 | ], |
| 1685 | tools = [ |
| 1686 | tool( |
| 1687 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1688 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1689 | ), |
| 1690 | ], |
| 1691 | ) |
| 1692 | elif (ctx.attr.cpu == "darwin_x86_64"): |
| 1693 | objcpp_compile_action = action_config( |
| 1694 | action_name = ACTION_NAMES.objcpp_compile, |
| 1695 | flag_sets = [ |
| 1696 | flag_set( |
| 1697 | flag_groups = [ |
| 1698 | flag_group( |
| 1699 | flags = ["-arch", "x86_64", "-stdlib=libc++", "-std=gnu++11"], |
| 1700 | ), |
| 1701 | ], |
| 1702 | ), |
| 1703 | ], |
| 1704 | implies = [ |
| 1705 | "compiler_input_flags", |
| 1706 | "compiler_output_flags", |
| 1707 | "apply_default_compiler_flags", |
| 1708 | "apply_default_warnings", |
| 1709 | "framework_paths", |
| 1710 | "preprocessor_defines", |
| 1711 | "include_system_dirs", |
| 1712 | "version_min", |
| 1713 | "objc_arc", |
| 1714 | "no_objc_arc", |
| 1715 | "apple_env", |
| 1716 | "user_compile_flags", |
| 1717 | "sysroot", |
| 1718 | "unfiltered_compile_flags", |
| 1719 | ], |
| 1720 | tools = [ |
| 1721 | tool( |
John Laxson | 871bf83 | 2021-02-12 04:48:06 -0800 | [diff] [blame] | 1722 | path = "wrapped_clang_pp", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1723 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1724 | ), |
| 1725 | ], |
| 1726 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1727 | else: |
| 1728 | objcpp_compile_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1729 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1730 | if (ctx.attr.cpu == "tvos_arm64" or |
| 1731 | ctx.attr.cpu == "tvos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1732 | assemble_action = action_config( |
| 1733 | action_name = ACTION_NAMES.assemble, |
| 1734 | implies = [ |
| 1735 | "objc_arc", |
| 1736 | "no_objc_arc", |
| 1737 | "include_system_dirs", |
| 1738 | "apple_env", |
| 1739 | "user_compile_flags", |
| 1740 | "sysroot", |
| 1741 | "unfiltered_compile_flags", |
| 1742 | "compiler_input_flags", |
| 1743 | "compiler_output_flags", |
| 1744 | "unfiltered_cxx_flags", |
| 1745 | ], |
| 1746 | tools = [ |
| 1747 | tool( |
| 1748 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1749 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1750 | ), |
| 1751 | ], |
| 1752 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1753 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 1754 | ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 1755 | ctx.attr.cpu == "darwin_arm64" or |
| 1756 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1757 | ctx.attr.cpu == "ios_arm64" or |
| 1758 | ctx.attr.cpu == "ios_arm64e" or |
| 1759 | ctx.attr.cpu == "ios_armv7" or |
| 1760 | ctx.attr.cpu == "ios_i386" or |
| 1761 | ctx.attr.cpu == "ios_x86_64" or |
| 1762 | ctx.attr.cpu == "watchos_arm64_32" or |
| 1763 | ctx.attr.cpu == "watchos_armv7k" or |
| 1764 | ctx.attr.cpu == "watchos_i386" or |
| 1765 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1766 | assemble_action = action_config( |
| 1767 | action_name = ACTION_NAMES.assemble, |
| 1768 | implies = [ |
| 1769 | "objc_arc", |
| 1770 | "no_objc_arc", |
| 1771 | "include_system_dirs", |
| 1772 | "apple_env", |
| 1773 | "user_compile_flags", |
| 1774 | "sysroot", |
| 1775 | "unfiltered_compile_flags", |
| 1776 | "compiler_input_flags", |
| 1777 | "compiler_output_flags", |
| 1778 | ], |
| 1779 | tools = [ |
| 1780 | tool( |
| 1781 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1782 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1783 | ), |
| 1784 | ], |
| 1785 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1786 | else: |
| 1787 | assemble_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1788 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1789 | if (ctx.attr.cpu == "tvos_arm64" or |
| 1790 | ctx.attr.cpu == "tvos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1791 | preprocess_assemble_action = action_config( |
| 1792 | action_name = ACTION_NAMES.preprocess_assemble, |
| 1793 | implies = [ |
| 1794 | "preprocessor_defines", |
| 1795 | "include_system_dirs", |
| 1796 | "version_min", |
| 1797 | "objc_arc", |
| 1798 | "no_objc_arc", |
| 1799 | "apple_env", |
| 1800 | "user_compile_flags", |
| 1801 | "sysroot", |
| 1802 | "unfiltered_compile_flags", |
| 1803 | "compiler_input_flags", |
| 1804 | "compiler_output_flags", |
| 1805 | "unfiltered_cxx_flags", |
| 1806 | ], |
| 1807 | tools = [ |
| 1808 | tool( |
| 1809 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1810 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1811 | ), |
| 1812 | ], |
| 1813 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1814 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 1815 | ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 1816 | ctx.attr.cpu == "darwin_arm64" or |
| 1817 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1818 | ctx.attr.cpu == "ios_arm64" or |
| 1819 | ctx.attr.cpu == "ios_arm64e" or |
| 1820 | ctx.attr.cpu == "ios_armv7" or |
| 1821 | ctx.attr.cpu == "ios_i386" or |
| 1822 | ctx.attr.cpu == "ios_x86_64" or |
| 1823 | ctx.attr.cpu == "watchos_arm64_32" or |
| 1824 | ctx.attr.cpu == "watchos_armv7k" or |
| 1825 | ctx.attr.cpu == "watchos_i386" or |
| 1826 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1827 | preprocess_assemble_action = action_config( |
| 1828 | action_name = ACTION_NAMES.preprocess_assemble, |
| 1829 | implies = [ |
| 1830 | "preprocessor_defines", |
| 1831 | "include_system_dirs", |
| 1832 | "version_min", |
| 1833 | "objc_arc", |
| 1834 | "no_objc_arc", |
| 1835 | "apple_env", |
| 1836 | "user_compile_flags", |
| 1837 | "sysroot", |
| 1838 | "unfiltered_compile_flags", |
| 1839 | "compiler_input_flags", |
| 1840 | "compiler_output_flags", |
| 1841 | ], |
| 1842 | tools = [ |
| 1843 | tool( |
| 1844 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1845 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1846 | ), |
| 1847 | ], |
| 1848 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1849 | else: |
| 1850 | preprocess_assemble_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1851 | |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 1852 | if (ctx.attr.cpu == "armeabi-v7a"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1853 | objc_archive_action = action_config( |
| 1854 | action_name = "objc-archive", |
| 1855 | flag_sets = [ |
| 1856 | flag_set( |
| 1857 | flag_groups = [ |
| 1858 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 1859 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1860 | "-no_warning_for_no_symbols", |
| 1861 | "-static", |
| 1862 | "-filelist", |
| 1863 | "%{obj_list_path}", |
| 1864 | "-arch_only", |
| 1865 | "<architecture>", |
| 1866 | "-syslibroot", |
| 1867 | "%{sdk_dir}", |
| 1868 | "-o", |
| 1869 | "%{archive_path}", |
| 1870 | ], |
| 1871 | ), |
| 1872 | ], |
| 1873 | ), |
| 1874 | ], |
| 1875 | implies = ["apple_env"], |
| 1876 | tools = [ |
| 1877 | tool( |
| 1878 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1879 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1880 | ), |
| 1881 | ], |
| 1882 | ) |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 1883 | elif (ctx.attr.cpu == "watchos_arm64_32"): |
| 1884 | objc_archive_action = action_config( |
| 1885 | action_name = "objc-archive", |
| 1886 | flag_sets = [ |
| 1887 | flag_set( |
| 1888 | flag_groups = [ |
| 1889 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 1890 | flags = _deterministic_libtool_flags(ctx) + [ |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 1891 | "-no_warning_for_no_symbols", |
| 1892 | "-static", |
| 1893 | "-filelist", |
| 1894 | "%{obj_list_path}", |
| 1895 | "-arch_only", |
| 1896 | "arm64_32", |
| 1897 | "-syslibroot", |
| 1898 | "%{sdk_dir}", |
| 1899 | "-o", |
| 1900 | "%{archive_path}", |
| 1901 | ], |
| 1902 | ), |
| 1903 | ], |
| 1904 | ), |
| 1905 | ], |
| 1906 | implies = ["apple_env"], |
| 1907 | tools = [ |
| 1908 | tool( |
| 1909 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1910 | execution_requirements = xcode_execution_requirements, |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 1911 | ), |
| 1912 | ], |
| 1913 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 1914 | elif (ctx.attr.cpu == "ios_arm64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 1915 | ctx.attr.cpu == "tvos_arm64" or |
| 1916 | ctx.attr.cpu == "darwin_arm64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1917 | objc_archive_action = action_config( |
| 1918 | action_name = "objc-archive", |
| 1919 | flag_sets = [ |
| 1920 | flag_set( |
| 1921 | flag_groups = [ |
| 1922 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 1923 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1924 | "-no_warning_for_no_symbols", |
| 1925 | "-static", |
| 1926 | "-filelist", |
| 1927 | "%{obj_list_path}", |
| 1928 | "-arch_only", |
| 1929 | "arm64", |
| 1930 | "-syslibroot", |
| 1931 | "%{sdk_dir}", |
| 1932 | "-o", |
| 1933 | "%{archive_path}", |
| 1934 | ], |
| 1935 | ), |
| 1936 | ], |
| 1937 | ), |
| 1938 | ], |
| 1939 | implies = ["apple_env"], |
| 1940 | tools = [ |
| 1941 | tool( |
| 1942 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1943 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1944 | ), |
| 1945 | ], |
| 1946 | ) |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 1947 | elif (ctx.attr.cpu == "ios_arm64e" or |
| 1948 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1949 | objc_archive_action = action_config( |
| 1950 | action_name = "objc-archive", |
| 1951 | flag_sets = [ |
| 1952 | flag_set( |
| 1953 | flag_groups = [ |
| 1954 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 1955 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1956 | "-no_warning_for_no_symbols", |
| 1957 | "-static", |
| 1958 | "-filelist", |
| 1959 | "%{obj_list_path}", |
| 1960 | "-arch_only", |
| 1961 | "arm64e", |
| 1962 | "-syslibroot", |
| 1963 | "%{sdk_dir}", |
| 1964 | "-o", |
| 1965 | "%{archive_path}", |
| 1966 | ], |
| 1967 | ), |
| 1968 | ], |
| 1969 | ), |
| 1970 | ], |
| 1971 | implies = ["apple_env"], |
| 1972 | tools = [ |
| 1973 | tool( |
| 1974 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 1975 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1976 | ), |
| 1977 | ], |
| 1978 | ) |
| 1979 | elif (ctx.attr.cpu == "ios_armv7"): |
| 1980 | objc_archive_action = action_config( |
| 1981 | action_name = "objc-archive", |
| 1982 | flag_sets = [ |
| 1983 | flag_set( |
| 1984 | flag_groups = [ |
| 1985 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 1986 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 1987 | "-no_warning_for_no_symbols", |
| 1988 | "-static", |
| 1989 | "-filelist", |
| 1990 | "%{obj_list_path}", |
| 1991 | "-arch_only", |
| 1992 | "armv7", |
| 1993 | "-syslibroot", |
| 1994 | "%{sdk_dir}", |
| 1995 | "-o", |
| 1996 | "%{archive_path}", |
| 1997 | ], |
| 1998 | ), |
| 1999 | ], |
| 2000 | ), |
| 2001 | ], |
| 2002 | implies = ["apple_env"], |
| 2003 | tools = [ |
| 2004 | tool( |
| 2005 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2006 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2007 | ), |
| 2008 | ], |
| 2009 | ) |
| 2010 | elif (ctx.attr.cpu == "watchos_armv7k"): |
| 2011 | objc_archive_action = action_config( |
| 2012 | action_name = "objc-archive", |
| 2013 | flag_sets = [ |
| 2014 | flag_set( |
| 2015 | flag_groups = [ |
| 2016 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 2017 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2018 | "-no_warning_for_no_symbols", |
| 2019 | "-static", |
| 2020 | "-filelist", |
| 2021 | "%{obj_list_path}", |
| 2022 | "-arch_only", |
| 2023 | "armv7k", |
| 2024 | "-syslibroot", |
| 2025 | "%{sdk_dir}", |
| 2026 | "-o", |
| 2027 | "%{archive_path}", |
| 2028 | ], |
| 2029 | ), |
| 2030 | ], |
| 2031 | ), |
| 2032 | ], |
| 2033 | implies = ["apple_env"], |
| 2034 | tools = [ |
| 2035 | tool( |
| 2036 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2037 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2038 | ), |
| 2039 | ], |
| 2040 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2041 | elif (ctx.attr.cpu == "ios_i386" or |
| 2042 | ctx.attr.cpu == "watchos_i386"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2043 | objc_archive_action = action_config( |
| 2044 | action_name = "objc-archive", |
| 2045 | flag_sets = [ |
| 2046 | flag_set( |
| 2047 | flag_groups = [ |
| 2048 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 2049 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2050 | "-no_warning_for_no_symbols", |
| 2051 | "-static", |
| 2052 | "-filelist", |
| 2053 | "%{obj_list_path}", |
| 2054 | "-arch_only", |
| 2055 | "i386", |
| 2056 | "-syslibroot", |
| 2057 | "%{sdk_dir}", |
| 2058 | "-o", |
| 2059 | "%{archive_path}", |
| 2060 | ], |
| 2061 | ), |
| 2062 | ], |
| 2063 | ), |
| 2064 | ], |
| 2065 | implies = ["apple_env"], |
| 2066 | tools = [ |
| 2067 | tool( |
| 2068 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2069 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2070 | ), |
| 2071 | ], |
| 2072 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2073 | elif (ctx.attr.cpu == "darwin_x86_64" or |
| 2074 | ctx.attr.cpu == "ios_x86_64" or |
| 2075 | ctx.attr.cpu == "tvos_x86_64" or |
| 2076 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2077 | objc_archive_action = action_config( |
| 2078 | action_name = "objc-archive", |
| 2079 | flag_sets = [ |
| 2080 | flag_set( |
| 2081 | flag_groups = [ |
| 2082 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 2083 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2084 | "-no_warning_for_no_symbols", |
| 2085 | "-static", |
| 2086 | "-filelist", |
| 2087 | "%{obj_list_path}", |
| 2088 | "-arch_only", |
| 2089 | "x86_64", |
| 2090 | "-syslibroot", |
| 2091 | "%{sdk_dir}", |
| 2092 | "-o", |
| 2093 | "%{archive_path}", |
| 2094 | ], |
| 2095 | ), |
| 2096 | ], |
| 2097 | ), |
| 2098 | ], |
| 2099 | implies = ["apple_env"], |
| 2100 | tools = [ |
| 2101 | tool( |
| 2102 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2103 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2104 | ), |
| 2105 | ], |
| 2106 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2107 | else: |
| 2108 | objc_archive_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2109 | |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 2110 | if (ctx.attr.cpu == "armeabi-v7a"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2111 | objc_executable_action = action_config( |
| 2112 | action_name = "objc-executable", |
| 2113 | flag_sets = [ |
| 2114 | flag_set( |
| 2115 | flag_groups = [ |
| 2116 | flag_group( |
| 2117 | flags = [ |
| 2118 | "-Xlinker", |
| 2119 | "-objc_abi_version", |
| 2120 | "-Xlinker", |
| 2121 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2122 | "-fobjc-link-runtime", |
| 2123 | "-ObjC", |
| 2124 | ], |
| 2125 | ), |
| 2126 | ], |
| 2127 | with_features = [with_feature_set(not_features = ["kernel_extension"])], |
| 2128 | ), |
| 2129 | flag_set( |
| 2130 | flag_groups = [ |
| 2131 | flag_group(flags = ["-arch", "<architecture>"]), |
| 2132 | flag_group( |
| 2133 | flags = ["-framework", "%{framework_names}"], |
| 2134 | iterate_over = "framework_names", |
| 2135 | ), |
| 2136 | flag_group( |
| 2137 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 2138 | iterate_over = "weak_framework_names", |
| 2139 | ), |
| 2140 | flag_group( |
| 2141 | flags = ["-l%{library_names}"], |
| 2142 | iterate_over = "library_names", |
| 2143 | ), |
| 2144 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 2145 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 2146 | flag_group( |
| 2147 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 2148 | iterate_over = "force_load_exec_paths", |
| 2149 | ), |
| 2150 | flag_group( |
| 2151 | flags = ["%{dep_linkopts}"], |
| 2152 | iterate_over = "dep_linkopts", |
| 2153 | ), |
| 2154 | flag_group( |
| 2155 | flags = ["-Wl,%{attr_linkopts}"], |
| 2156 | iterate_over = "attr_linkopts", |
| 2157 | ), |
| 2158 | ], |
| 2159 | ), |
| 2160 | ], |
| 2161 | implies = [ |
| 2162 | "include_system_dirs", |
| 2163 | "framework_paths", |
| 2164 | "version_min", |
| 2165 | "strip_debug_symbols", |
| 2166 | "apple_env", |
| 2167 | "apply_implicit_frameworks", |
| 2168 | ], |
| 2169 | tools = [ |
| 2170 | tool( |
| 2171 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2172 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2173 | ), |
| 2174 | ], |
| 2175 | ) |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 2176 | elif (ctx.attr.cpu == "watchos_arm64_32"): |
| 2177 | objc_executable_action = action_config( |
| 2178 | action_name = "objc-executable", |
| 2179 | flag_sets = [ |
| 2180 | flag_set( |
| 2181 | flag_groups = [ |
| 2182 | flag_group( |
| 2183 | flags = [ |
| 2184 | "-Xlinker", |
| 2185 | "-objc_abi_version", |
| 2186 | "-Xlinker", |
| 2187 | "2", |
| 2188 | "-fobjc-link-runtime", |
| 2189 | "-ObjC", |
| 2190 | ], |
| 2191 | ), |
| 2192 | ], |
| 2193 | with_features = [with_feature_set(not_features = ["kernel_extension"])], |
| 2194 | ), |
| 2195 | flag_set( |
| 2196 | flag_groups = [ |
| 2197 | flag_group(flags = ["-arch", "arm64_32"]), |
| 2198 | flag_group( |
| 2199 | flags = ["-framework", "%{framework_names}"], |
| 2200 | iterate_over = "framework_names", |
| 2201 | ), |
| 2202 | flag_group( |
| 2203 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 2204 | iterate_over = "weak_framework_names", |
| 2205 | ), |
| 2206 | flag_group( |
| 2207 | flags = ["-l%{library_names}"], |
| 2208 | iterate_over = "library_names", |
| 2209 | ), |
| 2210 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 2211 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 2212 | flag_group( |
| 2213 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 2214 | iterate_over = "force_load_exec_paths", |
| 2215 | ), |
| 2216 | flag_group( |
| 2217 | flags = ["%{dep_linkopts}"], |
| 2218 | iterate_over = "dep_linkopts", |
| 2219 | ), |
| 2220 | flag_group( |
| 2221 | flags = ["-Wl,%{attr_linkopts}"], |
| 2222 | iterate_over = "attr_linkopts", |
| 2223 | ), |
| 2224 | ], |
| 2225 | ), |
| 2226 | ], |
| 2227 | implies = [ |
| 2228 | "include_system_dirs", |
| 2229 | "framework_paths", |
| 2230 | "version_min", |
| 2231 | "strip_debug_symbols", |
| 2232 | "apple_env", |
| 2233 | "apply_implicit_frameworks", |
| 2234 | ], |
| 2235 | tools = [ |
| 2236 | tool( |
| 2237 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2238 | execution_requirements = xcode_execution_requirements, |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 2239 | ), |
| 2240 | ], |
| 2241 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2242 | elif (ctx.attr.cpu == "ios_arm64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 2243 | ctx.attr.cpu == "tvos_arm64" or |
| 2244 | ctx.attr.cpu == "darwin_arm64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2245 | objc_executable_action = action_config( |
| 2246 | action_name = "objc-executable", |
| 2247 | flag_sets = [ |
| 2248 | flag_set( |
| 2249 | flag_groups = [ |
| 2250 | flag_group( |
| 2251 | flags = [ |
| 2252 | "-Xlinker", |
| 2253 | "-objc_abi_version", |
| 2254 | "-Xlinker", |
| 2255 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2256 | "-fobjc-link-runtime", |
| 2257 | "-ObjC", |
| 2258 | ], |
| 2259 | ), |
| 2260 | ], |
| 2261 | with_features = [with_feature_set(not_features = ["kernel_extension"])], |
| 2262 | ), |
| 2263 | flag_set( |
| 2264 | flag_groups = [ |
| 2265 | flag_group(flags = ["-arch", "arm64"]), |
| 2266 | flag_group( |
| 2267 | flags = ["-framework", "%{framework_names}"], |
| 2268 | iterate_over = "framework_names", |
| 2269 | ), |
| 2270 | flag_group( |
| 2271 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 2272 | iterate_over = "weak_framework_names", |
| 2273 | ), |
| 2274 | flag_group( |
| 2275 | flags = ["-l%{library_names}"], |
| 2276 | iterate_over = "library_names", |
| 2277 | ), |
| 2278 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 2279 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 2280 | flag_group( |
| 2281 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 2282 | iterate_over = "force_load_exec_paths", |
| 2283 | ), |
| 2284 | flag_group( |
| 2285 | flags = ["%{dep_linkopts}"], |
| 2286 | iterate_over = "dep_linkopts", |
| 2287 | ), |
| 2288 | flag_group( |
| 2289 | flags = ["-Wl,%{attr_linkopts}"], |
| 2290 | iterate_over = "attr_linkopts", |
| 2291 | ), |
| 2292 | ], |
| 2293 | ), |
| 2294 | ], |
| 2295 | implies = [ |
| 2296 | "include_system_dirs", |
| 2297 | "framework_paths", |
| 2298 | "version_min", |
| 2299 | "strip_debug_symbols", |
| 2300 | "apple_env", |
| 2301 | "apply_implicit_frameworks", |
| 2302 | ], |
| 2303 | tools = [ |
| 2304 | tool( |
| 2305 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2306 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2307 | ), |
| 2308 | ], |
| 2309 | ) |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 2310 | elif (ctx.attr.cpu == "ios_arm64e" or |
| 2311 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2312 | objc_executable_action = action_config( |
| 2313 | action_name = "objc-executable", |
| 2314 | flag_sets = [ |
| 2315 | flag_set( |
| 2316 | flag_groups = [ |
| 2317 | flag_group( |
| 2318 | flags = [ |
| 2319 | "-Xlinker", |
| 2320 | "-objc_abi_version", |
| 2321 | "-Xlinker", |
| 2322 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2323 | "-fobjc-link-runtime", |
| 2324 | "-ObjC", |
| 2325 | ], |
| 2326 | ), |
| 2327 | ], |
| 2328 | with_features = [with_feature_set(not_features = ["kernel_extension"])], |
| 2329 | ), |
| 2330 | flag_set( |
| 2331 | flag_groups = [ |
| 2332 | flag_group(flags = ["-arch", "arm64e"]), |
| 2333 | flag_group( |
| 2334 | flags = ["-framework", "%{framework_names}"], |
| 2335 | iterate_over = "framework_names", |
| 2336 | ), |
| 2337 | flag_group( |
| 2338 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 2339 | iterate_over = "weak_framework_names", |
| 2340 | ), |
| 2341 | flag_group( |
| 2342 | flags = ["-l%{library_names}"], |
| 2343 | iterate_over = "library_names", |
| 2344 | ), |
| 2345 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 2346 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 2347 | flag_group( |
| 2348 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 2349 | iterate_over = "force_load_exec_paths", |
| 2350 | ), |
| 2351 | flag_group( |
| 2352 | flags = ["%{dep_linkopts}"], |
| 2353 | iterate_over = "dep_linkopts", |
| 2354 | ), |
| 2355 | flag_group( |
| 2356 | flags = ["-Wl,%{attr_linkopts}"], |
| 2357 | iterate_over = "attr_linkopts", |
| 2358 | ), |
| 2359 | ], |
| 2360 | ), |
| 2361 | ], |
| 2362 | implies = [ |
| 2363 | "include_system_dirs", |
| 2364 | "framework_paths", |
| 2365 | "version_min", |
| 2366 | "strip_debug_symbols", |
| 2367 | "apple_env", |
| 2368 | "apply_implicit_frameworks", |
| 2369 | ], |
| 2370 | tools = [ |
| 2371 | tool( |
| 2372 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2373 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2374 | ), |
| 2375 | ], |
| 2376 | ) |
| 2377 | elif (ctx.attr.cpu == "ios_armv7"): |
| 2378 | objc_executable_action = action_config( |
| 2379 | action_name = "objc-executable", |
| 2380 | flag_sets = [ |
| 2381 | flag_set( |
| 2382 | flag_groups = [ |
| 2383 | flag_group( |
| 2384 | flags = [ |
| 2385 | "-Xlinker", |
| 2386 | "-objc_abi_version", |
| 2387 | "-Xlinker", |
| 2388 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2389 | "-fobjc-link-runtime", |
| 2390 | "-ObjC", |
| 2391 | ], |
| 2392 | ), |
| 2393 | ], |
| 2394 | with_features = [with_feature_set(not_features = ["kernel_extension"])], |
| 2395 | ), |
| 2396 | flag_set( |
| 2397 | flag_groups = [ |
| 2398 | flag_group(flags = ["-arch", "armv7"]), |
| 2399 | flag_group( |
| 2400 | flags = ["-framework", "%{framework_names}"], |
| 2401 | iterate_over = "framework_names", |
| 2402 | ), |
| 2403 | flag_group( |
| 2404 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 2405 | iterate_over = "weak_framework_names", |
| 2406 | ), |
| 2407 | flag_group( |
| 2408 | flags = ["-l%{library_names}"], |
| 2409 | iterate_over = "library_names", |
| 2410 | ), |
| 2411 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 2412 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 2413 | flag_group( |
| 2414 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 2415 | iterate_over = "force_load_exec_paths", |
| 2416 | ), |
| 2417 | flag_group( |
| 2418 | flags = ["%{dep_linkopts}"], |
| 2419 | iterate_over = "dep_linkopts", |
| 2420 | ), |
| 2421 | flag_group( |
| 2422 | flags = ["-Wl,%{attr_linkopts}"], |
| 2423 | iterate_over = "attr_linkopts", |
| 2424 | ), |
| 2425 | ], |
| 2426 | ), |
| 2427 | ], |
| 2428 | implies = [ |
| 2429 | "include_system_dirs", |
| 2430 | "framework_paths", |
| 2431 | "version_min", |
| 2432 | "strip_debug_symbols", |
| 2433 | "apple_env", |
| 2434 | "apply_implicit_frameworks", |
| 2435 | ], |
| 2436 | tools = [ |
| 2437 | tool( |
| 2438 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2439 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2440 | ), |
| 2441 | ], |
| 2442 | ) |
| 2443 | elif (ctx.attr.cpu == "watchos_armv7k"): |
| 2444 | objc_executable_action = action_config( |
| 2445 | action_name = "objc-executable", |
| 2446 | flag_sets = [ |
| 2447 | flag_set( |
| 2448 | flag_groups = [ |
| 2449 | flag_group( |
| 2450 | flags = [ |
| 2451 | "-Xlinker", |
| 2452 | "-objc_abi_version", |
| 2453 | "-Xlinker", |
| 2454 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2455 | "-fobjc-link-runtime", |
| 2456 | "-ObjC", |
| 2457 | ], |
| 2458 | ), |
| 2459 | ], |
| 2460 | with_features = [with_feature_set(not_features = ["kernel_extension"])], |
| 2461 | ), |
| 2462 | flag_set( |
| 2463 | flag_groups = [ |
| 2464 | flag_group(flags = ["-arch", "armv7k"]), |
| 2465 | flag_group( |
| 2466 | flags = ["-framework", "%{framework_names}"], |
| 2467 | iterate_over = "framework_names", |
| 2468 | ), |
| 2469 | flag_group( |
| 2470 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 2471 | iterate_over = "weak_framework_names", |
| 2472 | ), |
| 2473 | flag_group( |
| 2474 | flags = ["-l%{library_names}"], |
| 2475 | iterate_over = "library_names", |
| 2476 | ), |
| 2477 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 2478 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 2479 | flag_group( |
| 2480 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 2481 | iterate_over = "force_load_exec_paths", |
| 2482 | ), |
| 2483 | flag_group( |
| 2484 | flags = ["%{dep_linkopts}"], |
| 2485 | iterate_over = "dep_linkopts", |
| 2486 | ), |
| 2487 | flag_group( |
| 2488 | flags = ["-Wl,%{attr_linkopts}"], |
| 2489 | iterate_over = "attr_linkopts", |
| 2490 | ), |
| 2491 | ], |
| 2492 | ), |
| 2493 | ], |
| 2494 | implies = [ |
| 2495 | "include_system_dirs", |
| 2496 | "framework_paths", |
| 2497 | "version_min", |
| 2498 | "strip_debug_symbols", |
| 2499 | "apple_env", |
| 2500 | "apply_implicit_frameworks", |
| 2501 | ], |
| 2502 | tools = [ |
| 2503 | tool( |
| 2504 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2505 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2506 | ), |
| 2507 | ], |
| 2508 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2509 | elif (ctx.attr.cpu == "ios_i386" or |
| 2510 | ctx.attr.cpu == "watchos_i386"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2511 | objc_executable_action = action_config( |
| 2512 | action_name = "objc-executable", |
| 2513 | flag_sets = [ |
| 2514 | flag_set( |
| 2515 | flag_groups = [ |
| 2516 | flag_group( |
| 2517 | flags = [ |
| 2518 | "-Xlinker", |
| 2519 | "-objc_abi_version", |
| 2520 | "-Xlinker", |
| 2521 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2522 | "-fobjc-link-runtime", |
| 2523 | "-ObjC", |
| 2524 | ], |
| 2525 | ), |
| 2526 | ], |
| 2527 | with_features = [with_feature_set(not_features = ["kernel_extension"])], |
| 2528 | ), |
| 2529 | flag_set( |
| 2530 | flag_groups = [ |
| 2531 | flag_group(flags = ["-arch", "i386"]), |
| 2532 | flag_group( |
| 2533 | flags = ["-framework", "%{framework_names}"], |
| 2534 | iterate_over = "framework_names", |
| 2535 | ), |
| 2536 | flag_group( |
| 2537 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 2538 | iterate_over = "weak_framework_names", |
| 2539 | ), |
| 2540 | flag_group( |
| 2541 | flags = ["-l%{library_names}"], |
| 2542 | iterate_over = "library_names", |
| 2543 | ), |
| 2544 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 2545 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 2546 | flag_group( |
| 2547 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 2548 | iterate_over = "force_load_exec_paths", |
| 2549 | ), |
| 2550 | flag_group( |
| 2551 | flags = ["%{dep_linkopts}"], |
| 2552 | iterate_over = "dep_linkopts", |
| 2553 | ), |
| 2554 | flag_group( |
| 2555 | flags = ["-Wl,%{attr_linkopts}"], |
| 2556 | iterate_over = "attr_linkopts", |
| 2557 | ), |
| 2558 | ], |
| 2559 | ), |
| 2560 | ], |
| 2561 | implies = [ |
| 2562 | "include_system_dirs", |
| 2563 | "framework_paths", |
| 2564 | "version_min", |
| 2565 | "strip_debug_symbols", |
| 2566 | "apple_env", |
| 2567 | "apply_implicit_frameworks", |
| 2568 | ], |
| 2569 | tools = [ |
| 2570 | tool( |
| 2571 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2572 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2573 | ), |
| 2574 | ], |
| 2575 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2576 | elif (ctx.attr.cpu == "darwin_x86_64" or |
| 2577 | ctx.attr.cpu == "ios_x86_64" or |
| 2578 | ctx.attr.cpu == "tvos_x86_64" or |
| 2579 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2580 | objc_executable_action = action_config( |
| 2581 | action_name = "objc-executable", |
| 2582 | flag_sets = [ |
| 2583 | flag_set( |
| 2584 | flag_groups = [ |
| 2585 | flag_group( |
| 2586 | flags = [ |
| 2587 | "-Xlinker", |
| 2588 | "-objc_abi_version", |
| 2589 | "-Xlinker", |
| 2590 | "2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2591 | "-fobjc-link-runtime", |
| 2592 | "-ObjC", |
| 2593 | ], |
| 2594 | ), |
| 2595 | ], |
| 2596 | with_features = [with_feature_set(not_features = ["kernel_extension"])], |
| 2597 | ), |
| 2598 | flag_set( |
| 2599 | flag_groups = [ |
| 2600 | flag_group(flags = ["-arch", "x86_64"]), |
| 2601 | flag_group( |
| 2602 | flags = ["-framework", "%{framework_names}"], |
| 2603 | iterate_over = "framework_names", |
| 2604 | ), |
| 2605 | flag_group( |
| 2606 | flags = ["-weak_framework", "%{weak_framework_names}"], |
| 2607 | iterate_over = "weak_framework_names", |
| 2608 | ), |
| 2609 | flag_group( |
| 2610 | flags = ["-l%{library_names}"], |
| 2611 | iterate_over = "library_names", |
| 2612 | ), |
| 2613 | flag_group(flags = ["-filelist", "%{filelist}"]), |
| 2614 | flag_group(flags = ["-o", "%{linked_binary}"]), |
| 2615 | flag_group( |
| 2616 | flags = ["-force_load", "%{force_load_exec_paths}"], |
| 2617 | iterate_over = "force_load_exec_paths", |
| 2618 | ), |
| 2619 | flag_group( |
| 2620 | flags = ["%{dep_linkopts}"], |
| 2621 | iterate_over = "dep_linkopts", |
| 2622 | ), |
| 2623 | flag_group( |
| 2624 | flags = ["-Wl,%{attr_linkopts}"], |
| 2625 | iterate_over = "attr_linkopts", |
| 2626 | ), |
| 2627 | ], |
| 2628 | ), |
| 2629 | ], |
| 2630 | implies = [ |
| 2631 | "include_system_dirs", |
| 2632 | "framework_paths", |
| 2633 | "version_min", |
| 2634 | "strip_debug_symbols", |
| 2635 | "apple_env", |
| 2636 | "apply_implicit_frameworks", |
| 2637 | ], |
| 2638 | tools = [ |
| 2639 | tool( |
| 2640 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2641 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2642 | ), |
| 2643 | ], |
| 2644 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2645 | else: |
| 2646 | objc_executable_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2647 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2648 | if (ctx.attr.cpu == "tvos_arm64" or |
| 2649 | ctx.attr.cpu == "tvos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2650 | cpp_link_executable_action = action_config( |
| 2651 | action_name = ACTION_NAMES.cpp_link_executable, |
| 2652 | implies = [ |
| 2653 | "contains_objc_source", |
| 2654 | "symbol_counts", |
| 2655 | "linkstamps", |
| 2656 | "output_execpath_flags", |
| 2657 | "runtime_root_flags", |
| 2658 | "input_param_flags", |
| 2659 | "force_pic_flags", |
| 2660 | "strip_debug_symbols", |
| 2661 | "linker_param_file", |
| 2662 | "version_min", |
| 2663 | "apple_env", |
| 2664 | "sysroot", |
| 2665 | "cpp_linker_flags", |
| 2666 | ], |
| 2667 | tools = [ |
| 2668 | tool( |
| 2669 | path = "cc_wrapper.sh", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2670 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2671 | ), |
| 2672 | ], |
| 2673 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2674 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 2675 | ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 2676 | ctx.attr.cpu == "darwin_arm64" or |
| 2677 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2678 | ctx.attr.cpu == "ios_arm64" or |
| 2679 | ctx.attr.cpu == "ios_arm64e" or |
| 2680 | ctx.attr.cpu == "ios_armv7" or |
| 2681 | ctx.attr.cpu == "ios_i386" or |
| 2682 | ctx.attr.cpu == "ios_x86_64" or |
| 2683 | ctx.attr.cpu == "watchos_arm64_32" or |
| 2684 | ctx.attr.cpu == "watchos_armv7k" or |
| 2685 | ctx.attr.cpu == "watchos_i386" or |
| 2686 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2687 | cpp_link_executable_action = action_config( |
| 2688 | action_name = ACTION_NAMES.cpp_link_executable, |
| 2689 | implies = [ |
| 2690 | "contains_objc_source", |
| 2691 | "symbol_counts", |
| 2692 | "linkstamps", |
| 2693 | "output_execpath_flags", |
| 2694 | "runtime_root_flags", |
| 2695 | "input_param_flags", |
| 2696 | "force_pic_flags", |
| 2697 | "strip_debug_symbols", |
| 2698 | "linker_param_file", |
| 2699 | "version_min", |
| 2700 | "apple_env", |
| 2701 | "sysroot", |
| 2702 | ], |
| 2703 | tools = [ |
| 2704 | tool( |
| 2705 | path = "cc_wrapper.sh", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2706 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2707 | ), |
| 2708 | ], |
| 2709 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2710 | else: |
| 2711 | cpp_link_executable_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2712 | |
| 2713 | linkstamp_compile_action = action_config( |
| 2714 | action_name = ACTION_NAMES.linkstamp_compile, |
| 2715 | implies = [ |
| 2716 | "preprocessor_defines", |
| 2717 | "include_system_dirs", |
| 2718 | "version_min", |
| 2719 | "objc_arc", |
| 2720 | "no_objc_arc", |
| 2721 | "apple_env", |
| 2722 | "user_compile_flags", |
| 2723 | "sysroot", |
| 2724 | "unfiltered_compile_flags", |
| 2725 | "compiler_input_flags", |
| 2726 | "compiler_output_flags", |
| 2727 | ], |
| 2728 | tools = [ |
| 2729 | tool( |
| 2730 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2731 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2732 | ), |
| 2733 | ], |
| 2734 | ) |
| 2735 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2736 | if (ctx.attr.cpu == "tvos_arm64" or |
| 2737 | ctx.attr.cpu == "tvos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2738 | cpp_module_compile_action = action_config( |
| 2739 | action_name = ACTION_NAMES.cpp_module_compile, |
| 2740 | implies = [ |
| 2741 | "preprocessor_defines", |
| 2742 | "include_system_dirs", |
| 2743 | "version_min", |
| 2744 | "objc_arc", |
| 2745 | "no_objc_arc", |
| 2746 | "apple_env", |
| 2747 | "user_compile_flags", |
| 2748 | "sysroot", |
| 2749 | "unfiltered_compile_flags", |
| 2750 | "compiler_input_flags", |
| 2751 | "compiler_output_flags", |
| 2752 | "unfiltered_cxx_flags", |
| 2753 | ], |
| 2754 | tools = [ |
| 2755 | tool( |
| 2756 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2757 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2758 | ), |
| 2759 | ], |
| 2760 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2761 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 2762 | ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 2763 | ctx.attr.cpu == "darwin_arm64" or |
| 2764 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2765 | ctx.attr.cpu == "ios_arm64" or |
| 2766 | ctx.attr.cpu == "ios_arm64e" or |
| 2767 | ctx.attr.cpu == "ios_armv7" or |
| 2768 | ctx.attr.cpu == "ios_i386" or |
| 2769 | ctx.attr.cpu == "ios_x86_64" or |
| 2770 | ctx.attr.cpu == "watchos_arm64_32" or |
| 2771 | ctx.attr.cpu == "watchos_armv7k" or |
| 2772 | ctx.attr.cpu == "watchos_i386" or |
| 2773 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2774 | cpp_module_compile_action = action_config( |
| 2775 | action_name = ACTION_NAMES.cpp_module_compile, |
| 2776 | implies = [ |
| 2777 | "preprocessor_defines", |
| 2778 | "include_system_dirs", |
| 2779 | "version_min", |
| 2780 | "objc_arc", |
| 2781 | "no_objc_arc", |
| 2782 | "apple_env", |
| 2783 | "user_compile_flags", |
| 2784 | "sysroot", |
| 2785 | "unfiltered_compile_flags", |
| 2786 | "compiler_input_flags", |
| 2787 | "compiler_output_flags", |
| 2788 | ], |
| 2789 | tools = [ |
| 2790 | tool( |
| 2791 | path = "wrapped_clang", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2792 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2793 | ), |
| 2794 | ], |
| 2795 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2796 | else: |
| 2797 | cpp_module_compile_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2798 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2799 | if (ctx.attr.cpu == "tvos_arm64" or |
| 2800 | ctx.attr.cpu == "tvos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2801 | cpp_link_nodeps_dynamic_library_action = action_config( |
| 2802 | action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 2803 | implies = [ |
| 2804 | "contains_objc_source", |
| 2805 | "has_configured_linker_path", |
| 2806 | "symbol_counts", |
| 2807 | "shared_flag", |
| 2808 | "linkstamps", |
| 2809 | "output_execpath_flags", |
| 2810 | "runtime_root_flags", |
| 2811 | "input_param_flags", |
| 2812 | "strip_debug_symbols", |
| 2813 | "linker_param_file", |
| 2814 | "version_min", |
| 2815 | "apple_env", |
| 2816 | "sysroot", |
| 2817 | "cpp_linker_flags", |
| 2818 | ], |
| 2819 | tools = [ |
| 2820 | tool( |
| 2821 | path = "cc_wrapper.sh", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2822 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2823 | ), |
| 2824 | ], |
| 2825 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2826 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 2827 | ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 2828 | ctx.attr.cpu == "darwin_arm64" or |
| 2829 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2830 | ctx.attr.cpu == "ios_arm64" or |
| 2831 | ctx.attr.cpu == "ios_arm64e" or |
| 2832 | ctx.attr.cpu == "ios_armv7" or |
| 2833 | ctx.attr.cpu == "ios_i386" or |
| 2834 | ctx.attr.cpu == "ios_x86_64" or |
| 2835 | ctx.attr.cpu == "watchos_arm64_32" or |
| 2836 | ctx.attr.cpu == "watchos_armv7k" or |
| 2837 | ctx.attr.cpu == "watchos_i386" or |
| 2838 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2839 | cpp_link_nodeps_dynamic_library_action = action_config( |
| 2840 | action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 2841 | implies = [ |
| 2842 | "contains_objc_source", |
| 2843 | "has_configured_linker_path", |
| 2844 | "symbol_counts", |
| 2845 | "shared_flag", |
| 2846 | "linkstamps", |
| 2847 | "output_execpath_flags", |
| 2848 | "runtime_root_flags", |
| 2849 | "input_param_flags", |
| 2850 | "strip_debug_symbols", |
| 2851 | "linker_param_file", |
| 2852 | "version_min", |
| 2853 | "apple_env", |
| 2854 | "sysroot", |
| 2855 | ], |
| 2856 | tools = [ |
| 2857 | tool( |
| 2858 | path = "cc_wrapper.sh", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2859 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2860 | ), |
| 2861 | ], |
| 2862 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2863 | else: |
| 2864 | cpp_link_nodeps_dynamic_library_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2865 | |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 2866 | if (ctx.attr.cpu == "armeabi-v7a"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2867 | objc_fully_link_action = action_config( |
| 2868 | action_name = "objc-fully-link", |
| 2869 | flag_sets = [ |
| 2870 | flag_set( |
| 2871 | flag_groups = [ |
| 2872 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 2873 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2874 | "-no_warning_for_no_symbols", |
| 2875 | "-static", |
| 2876 | "-arch_only", |
| 2877 | "<architecture>", |
| 2878 | "-syslibroot", |
| 2879 | "%{sdk_dir}", |
| 2880 | "-o", |
| 2881 | "%{fully_linked_archive_path}", |
| 2882 | ], |
| 2883 | ), |
| 2884 | flag_group( |
| 2885 | flags = ["%{objc_library_exec_paths}"], |
| 2886 | iterate_over = "objc_library_exec_paths", |
| 2887 | ), |
| 2888 | flag_group( |
| 2889 | flags = ["%{cc_library_exec_paths}"], |
| 2890 | iterate_over = "cc_library_exec_paths", |
| 2891 | ), |
| 2892 | flag_group( |
| 2893 | flags = ["%{imported_library_exec_paths}"], |
| 2894 | iterate_over = "imported_library_exec_paths", |
| 2895 | ), |
| 2896 | ], |
| 2897 | ), |
| 2898 | ], |
| 2899 | implies = ["apple_env"], |
| 2900 | tools = [ |
| 2901 | tool( |
| 2902 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2903 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2904 | ), |
| 2905 | ], |
| 2906 | ) |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 2907 | elif (ctx.attr.cpu == "watchos_arm64_32"): |
| 2908 | objc_fully_link_action = action_config( |
| 2909 | action_name = "objc-fully-link", |
| 2910 | flag_sets = [ |
| 2911 | flag_set( |
| 2912 | flag_groups = [ |
| 2913 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 2914 | flags = _deterministic_libtool_flags(ctx) + [ |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 2915 | "-no_warning_for_no_symbols", |
| 2916 | "-static", |
| 2917 | "-arch_only", |
| 2918 | "arm64_32", |
| 2919 | "-syslibroot", |
| 2920 | "%{sdk_dir}", |
| 2921 | "-o", |
| 2922 | "%{fully_linked_archive_path}", |
| 2923 | ], |
| 2924 | ), |
| 2925 | flag_group( |
| 2926 | flags = ["%{objc_library_exec_paths}"], |
| 2927 | iterate_over = "objc_library_exec_paths", |
| 2928 | ), |
| 2929 | flag_group( |
| 2930 | flags = ["%{cc_library_exec_paths}"], |
| 2931 | iterate_over = "cc_library_exec_paths", |
| 2932 | ), |
| 2933 | flag_group( |
| 2934 | flags = ["%{imported_library_exec_paths}"], |
| 2935 | iterate_over = "imported_library_exec_paths", |
| 2936 | ), |
| 2937 | ], |
| 2938 | ), |
| 2939 | ], |
| 2940 | implies = ["apple_env"], |
| 2941 | tools = [ |
| 2942 | tool( |
| 2943 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2944 | execution_requirements = xcode_execution_requirements, |
Alessandro Patti | c33038e | 2020-01-23 16:40:45 -0800 | [diff] [blame] | 2945 | ), |
| 2946 | ], |
| 2947 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 2948 | elif (ctx.attr.cpu == "ios_arm64" or |
| 2949 | ctx.attr.cpu == "tvos_arm64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2950 | objc_fully_link_action = action_config( |
| 2951 | action_name = "objc-fully-link", |
| 2952 | flag_sets = [ |
| 2953 | flag_set( |
| 2954 | flag_groups = [ |
| 2955 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 2956 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2957 | "-no_warning_for_no_symbols", |
| 2958 | "-static", |
| 2959 | "-arch_only", |
| 2960 | "arm64", |
| 2961 | "-syslibroot", |
| 2962 | "%{sdk_dir}", |
| 2963 | "-o", |
| 2964 | "%{fully_linked_archive_path}", |
| 2965 | ], |
| 2966 | ), |
| 2967 | flag_group( |
| 2968 | flags = ["%{objc_library_exec_paths}"], |
| 2969 | iterate_over = "objc_library_exec_paths", |
| 2970 | ), |
| 2971 | flag_group( |
| 2972 | flags = ["%{cc_library_exec_paths}"], |
| 2973 | iterate_over = "cc_library_exec_paths", |
| 2974 | ), |
| 2975 | flag_group( |
| 2976 | flags = ["%{imported_library_exec_paths}"], |
| 2977 | iterate_over = "imported_library_exec_paths", |
| 2978 | ), |
| 2979 | ], |
| 2980 | ), |
| 2981 | ], |
| 2982 | implies = ["apple_env"], |
| 2983 | tools = [ |
| 2984 | tool( |
| 2985 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 2986 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2987 | ), |
| 2988 | ], |
| 2989 | ) |
| 2990 | elif (ctx.attr.cpu == "ios_arm64e"): |
| 2991 | objc_fully_link_action = action_config( |
| 2992 | action_name = "objc-fully-link", |
| 2993 | flag_sets = [ |
| 2994 | flag_set( |
| 2995 | flag_groups = [ |
| 2996 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 2997 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 2998 | "-no_warning_for_no_symbols", |
| 2999 | "-static", |
| 3000 | "-arch_only", |
| 3001 | "arm64e", |
| 3002 | "-syslibroot", |
| 3003 | "%{sdk_dir}", |
| 3004 | "-o", |
| 3005 | "%{fully_linked_archive_path}", |
| 3006 | ], |
| 3007 | ), |
| 3008 | flag_group( |
| 3009 | flags = ["%{objc_library_exec_paths}"], |
| 3010 | iterate_over = "objc_library_exec_paths", |
| 3011 | ), |
| 3012 | flag_group( |
| 3013 | flags = ["%{cc_library_exec_paths}"], |
| 3014 | iterate_over = "cc_library_exec_paths", |
| 3015 | ), |
| 3016 | flag_group( |
| 3017 | flags = ["%{imported_library_exec_paths}"], |
| 3018 | iterate_over = "imported_library_exec_paths", |
| 3019 | ), |
| 3020 | ], |
| 3021 | ), |
| 3022 | ], |
| 3023 | implies = ["apple_env"], |
| 3024 | tools = [ |
| 3025 | tool( |
| 3026 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 3027 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3028 | ), |
| 3029 | ], |
| 3030 | ) |
| 3031 | elif (ctx.attr.cpu == "ios_armv7"): |
| 3032 | objc_fully_link_action = action_config( |
| 3033 | action_name = "objc-fully-link", |
| 3034 | flag_sets = [ |
| 3035 | flag_set( |
| 3036 | flag_groups = [ |
| 3037 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 3038 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3039 | "-no_warning_for_no_symbols", |
| 3040 | "-static", |
| 3041 | "-arch_only", |
| 3042 | "armv7", |
| 3043 | "-syslibroot", |
| 3044 | "%{sdk_dir}", |
| 3045 | "-o", |
| 3046 | "%{fully_linked_archive_path}", |
| 3047 | ], |
| 3048 | ), |
| 3049 | flag_group( |
| 3050 | flags = ["%{objc_library_exec_paths}"], |
| 3051 | iterate_over = "objc_library_exec_paths", |
| 3052 | ), |
| 3053 | flag_group( |
| 3054 | flags = ["%{cc_library_exec_paths}"], |
| 3055 | iterate_over = "cc_library_exec_paths", |
| 3056 | ), |
| 3057 | flag_group( |
| 3058 | flags = ["%{imported_library_exec_paths}"], |
| 3059 | iterate_over = "imported_library_exec_paths", |
| 3060 | ), |
| 3061 | ], |
| 3062 | ), |
| 3063 | ], |
| 3064 | implies = ["apple_env"], |
| 3065 | tools = [ |
| 3066 | tool( |
| 3067 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 3068 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3069 | ), |
| 3070 | ], |
| 3071 | ) |
| 3072 | elif (ctx.attr.cpu == "watchos_armv7k"): |
| 3073 | objc_fully_link_action = action_config( |
| 3074 | action_name = "objc-fully-link", |
| 3075 | flag_sets = [ |
| 3076 | flag_set( |
| 3077 | flag_groups = [ |
| 3078 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 3079 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3080 | "-no_warning_for_no_symbols", |
| 3081 | "-static", |
| 3082 | "-arch_only", |
| 3083 | "armv7k", |
| 3084 | "-syslibroot", |
| 3085 | "%{sdk_dir}", |
| 3086 | "-o", |
| 3087 | "%{fully_linked_archive_path}", |
| 3088 | ], |
| 3089 | ), |
| 3090 | flag_group( |
| 3091 | flags = ["%{objc_library_exec_paths}"], |
| 3092 | iterate_over = "objc_library_exec_paths", |
| 3093 | ), |
| 3094 | flag_group( |
| 3095 | flags = ["%{cc_library_exec_paths}"], |
| 3096 | iterate_over = "cc_library_exec_paths", |
| 3097 | ), |
| 3098 | flag_group( |
| 3099 | flags = ["%{imported_library_exec_paths}"], |
| 3100 | iterate_over = "imported_library_exec_paths", |
| 3101 | ), |
| 3102 | ], |
| 3103 | ), |
| 3104 | ], |
| 3105 | implies = ["apple_env"], |
| 3106 | tools = [ |
| 3107 | tool( |
| 3108 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 3109 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3110 | ), |
| 3111 | ], |
| 3112 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3113 | elif (ctx.attr.cpu == "ios_i386" or |
| 3114 | ctx.attr.cpu == "watchos_i386"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3115 | objc_fully_link_action = action_config( |
| 3116 | action_name = "objc-fully-link", |
| 3117 | flag_sets = [ |
| 3118 | flag_set( |
| 3119 | flag_groups = [ |
| 3120 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 3121 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3122 | "-no_warning_for_no_symbols", |
| 3123 | "-static", |
| 3124 | "-arch_only", |
| 3125 | "i386", |
| 3126 | "-syslibroot", |
| 3127 | "%{sdk_dir}", |
| 3128 | "-o", |
| 3129 | "%{fully_linked_archive_path}", |
| 3130 | ], |
| 3131 | ), |
| 3132 | flag_group( |
| 3133 | flags = ["%{objc_library_exec_paths}"], |
| 3134 | iterate_over = "objc_library_exec_paths", |
| 3135 | ), |
| 3136 | flag_group( |
| 3137 | flags = ["%{cc_library_exec_paths}"], |
| 3138 | iterate_over = "cc_library_exec_paths", |
| 3139 | ), |
| 3140 | flag_group( |
| 3141 | flags = ["%{imported_library_exec_paths}"], |
| 3142 | iterate_over = "imported_library_exec_paths", |
| 3143 | ), |
| 3144 | ], |
| 3145 | ), |
| 3146 | ], |
| 3147 | implies = ["apple_env"], |
| 3148 | tools = [ |
| 3149 | tool( |
| 3150 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 3151 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3152 | ), |
| 3153 | ], |
| 3154 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3155 | elif (ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 3156 | ctx.attr.cpu == "darwin_arm64" or |
| 3157 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3158 | ctx.attr.cpu == "ios_x86_64" or |
| 3159 | ctx.attr.cpu == "tvos_x86_64" or |
| 3160 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3161 | objc_fully_link_action = action_config( |
| 3162 | action_name = "objc-fully-link", |
| 3163 | flag_sets = [ |
| 3164 | flag_set( |
| 3165 | flag_groups = [ |
| 3166 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 3167 | flags = _deterministic_libtool_flags(ctx) + [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3168 | "-no_warning_for_no_symbols", |
| 3169 | "-static", |
| 3170 | "-arch_only", |
| 3171 | "x86_64", |
| 3172 | "-syslibroot", |
| 3173 | "%{sdk_dir}", |
| 3174 | "-o", |
| 3175 | "%{fully_linked_archive_path}", |
| 3176 | ], |
| 3177 | ), |
| 3178 | flag_group( |
| 3179 | flags = ["%{objc_library_exec_paths}"], |
| 3180 | iterate_over = "objc_library_exec_paths", |
| 3181 | ), |
| 3182 | flag_group( |
| 3183 | flags = ["%{cc_library_exec_paths}"], |
| 3184 | iterate_over = "cc_library_exec_paths", |
| 3185 | ), |
| 3186 | flag_group( |
| 3187 | flags = ["%{imported_library_exec_paths}"], |
| 3188 | iterate_over = "imported_library_exec_paths", |
| 3189 | ), |
| 3190 | ], |
| 3191 | ), |
| 3192 | ], |
| 3193 | implies = ["apple_env"], |
| 3194 | tools = [ |
| 3195 | tool( |
| 3196 | path = "libtool", |
waltl | a5cd3d7 | 2020-07-30 11:40:02 -0700 | [diff] [blame] | 3197 | execution_requirements = xcode_execution_requirements, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3198 | ), |
| 3199 | ], |
| 3200 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3201 | else: |
| 3202 | objc_fully_link_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3203 | |
| 3204 | if (ctx.attr.cpu == "armeabi-v7a"): |
| 3205 | objcopy_embed_data_action = action_config( |
| 3206 | action_name = "objcopy_embed_data", |
| 3207 | enabled = True, |
| 3208 | tools = [tool(path = "/bin/false")], |
| 3209 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3210 | elif (ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 3211 | ctx.attr.cpu == "darwin_arm64" or |
| 3212 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3213 | ctx.attr.cpu == "ios_arm64" or |
| 3214 | ctx.attr.cpu == "ios_arm64e" or |
| 3215 | ctx.attr.cpu == "ios_armv7" or |
| 3216 | ctx.attr.cpu == "ios_i386" or |
| 3217 | ctx.attr.cpu == "ios_x86_64" or |
| 3218 | ctx.attr.cpu == "tvos_arm64" or |
| 3219 | ctx.attr.cpu == "tvos_x86_64" or |
| 3220 | ctx.attr.cpu == "watchos_arm64_32" or |
| 3221 | ctx.attr.cpu == "watchos_armv7k" or |
| 3222 | ctx.attr.cpu == "watchos_i386" or |
| 3223 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3224 | objcopy_embed_data_action = action_config( |
| 3225 | action_name = "objcopy_embed_data", |
| 3226 | enabled = True, |
| 3227 | tools = [tool(path = "/usr/bin/objcopy")], |
| 3228 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3229 | else: |
| 3230 | objcopy_embed_data_action = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3231 | |
| 3232 | action_configs = [ |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3233 | strip_action, |
| 3234 | c_compile_action, |
| 3235 | cpp_compile_action, |
| 3236 | linkstamp_compile_action, |
| 3237 | cpp_module_compile_action, |
| 3238 | cpp_header_parsing_action, |
| 3239 | objc_compile_action, |
| 3240 | objcpp_compile_action, |
| 3241 | assemble_action, |
| 3242 | preprocess_assemble_action, |
| 3243 | objc_archive_action, |
| 3244 | objc_executable_action, |
| 3245 | objcpp_executable_action, |
| 3246 | cpp_link_executable_action, |
| 3247 | cpp_link_dynamic_library_action, |
| 3248 | cpp_link_nodeps_dynamic_library_action, |
| 3249 | cpp_link_static_library_action, |
| 3250 | objc_fully_link_action, |
| 3251 | objcopy_embed_data_action, |
| 3252 | ] |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3253 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3254 | if (ctx.attr.cpu == "armeabi-v7a" or |
| 3255 | ctx.attr.cpu == "ios_arm64" or |
| 3256 | ctx.attr.cpu == "ios_arm64e" or |
| 3257 | ctx.attr.cpu == "ios_armv7" or |
| 3258 | ctx.attr.cpu == "ios_i386" or |
| 3259 | ctx.attr.cpu == "ios_x86_64" or |
| 3260 | ctx.attr.cpu == "watchos_arm64_32" or |
| 3261 | ctx.attr.cpu == "watchos_armv7k" or |
| 3262 | ctx.attr.cpu == "watchos_i386" or |
| 3263 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3264 | apply_default_compiler_flags_feature = feature( |
| 3265 | name = "apply_default_compiler_flags", |
| 3266 | flag_sets = [ |
| 3267 | flag_set( |
| 3268 | actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile], |
| 3269 | flag_groups = [flag_group(flags = ["-DOS_IOS", "-fno-autolink"])], |
| 3270 | ), |
| 3271 | ], |
| 3272 | ) |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 3273 | elif (ctx.attr.cpu == "darwin_x86_64" or |
| 3274 | ctx.attr.cpu == "darwin_arm64" or |
| 3275 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3276 | apply_default_compiler_flags_feature = feature( |
| 3277 | name = "apply_default_compiler_flags", |
| 3278 | flag_sets = [ |
| 3279 | flag_set( |
| 3280 | actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile], |
| 3281 | flag_groups = [flag_group(flags = ["-DOS_MACOSX", "-fno-autolink"])], |
| 3282 | ), |
| 3283 | ], |
| 3284 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3285 | elif (ctx.attr.cpu == "tvos_arm64" or |
| 3286 | ctx.attr.cpu == "tvos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3287 | apply_default_compiler_flags_feature = feature( |
| 3288 | name = "apply_default_compiler_flags", |
| 3289 | flag_sets = [ |
| 3290 | flag_set( |
| 3291 | actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile], |
| 3292 | flag_groups = [flag_group(flags = ["-DOS_TVOS", "-fno-autolink"])], |
| 3293 | ), |
| 3294 | ], |
| 3295 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3296 | else: |
| 3297 | apply_default_compiler_flags_feature = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3298 | |
| 3299 | dynamic_linking_mode_feature = feature(name = "dynamic_linking_mode") |
| 3300 | |
| 3301 | compile_all_modules_feature = feature(name = "compile_all_modules") |
| 3302 | |
| 3303 | runtime_root_flags_feature = feature( |
| 3304 | name = "runtime_root_flags", |
| 3305 | flag_sets = [ |
| 3306 | flag_set( |
| 3307 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3308 | [ACTION_NAMES.cpp_link_static_library], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3309 | flag_groups = [ |
| 3310 | flag_group( |
| 3311 | flags = [ |
| 3312 | "-Wl,-rpath,@loader_path/%{runtime_library_search_directories}", |
| 3313 | ], |
| 3314 | iterate_over = "runtime_library_search_directories", |
| 3315 | expand_if_available = "runtime_library_search_directories", |
| 3316 | ), |
| 3317 | ], |
| 3318 | ), |
| 3319 | flag_set( |
| 3320 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3321 | [ACTION_NAMES.cpp_link_static_library], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3322 | flag_groups = [ |
| 3323 | flag_group( |
| 3324 | flags = ["%{runtime_root_flags}"], |
| 3325 | iterate_over = "runtime_root_flags", |
| 3326 | expand_if_available = "runtime_root_flags", |
| 3327 | ), |
| 3328 | ], |
| 3329 | ), |
| 3330 | flag_set( |
| 3331 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3332 | [ACTION_NAMES.cpp_link_static_library], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3333 | flag_groups = [ |
| 3334 | flag_group( |
| 3335 | flags = ["%{runtime_root_entries}"], |
| 3336 | iterate_over = "runtime_root_entries", |
| 3337 | expand_if_available = "runtime_root_entries", |
| 3338 | ), |
| 3339 | ], |
| 3340 | ), |
| 3341 | ], |
| 3342 | ) |
| 3343 | |
| 3344 | use_objc_modules_feature = feature( |
| 3345 | name = "use_objc_modules", |
| 3346 | flag_sets = [ |
| 3347 | flag_set( |
| 3348 | actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile], |
| 3349 | flag_groups = [ |
| 3350 | flag_group( |
| 3351 | flags = [ |
| 3352 | "-fmodule-name=%{module_name}", |
| 3353 | "-iquote", |
| 3354 | "%{module_maps_dir}", |
| 3355 | "-fmodules-cache-path=%{modules_cache_path}", |
| 3356 | ], |
| 3357 | ), |
| 3358 | ], |
| 3359 | ), |
| 3360 | ], |
| 3361 | ) |
| 3362 | |
| 3363 | objc_arc_feature = feature( |
| 3364 | name = "objc_arc", |
| 3365 | flag_sets = [ |
| 3366 | flag_set( |
| 3367 | actions = [ |
| 3368 | ACTION_NAMES.c_compile, |
| 3369 | ACTION_NAMES.cpp_compile, |
| 3370 | ACTION_NAMES.cpp_module_compile, |
| 3371 | ACTION_NAMES.cpp_header_parsing, |
| 3372 | ACTION_NAMES.assemble, |
| 3373 | ACTION_NAMES.preprocess_assemble, |
| 3374 | ACTION_NAMES.objc_compile, |
| 3375 | ACTION_NAMES.objcpp_compile, |
| 3376 | ], |
| 3377 | flag_groups = [ |
| 3378 | flag_group( |
| 3379 | flags = ["-fobjc-arc"], |
| 3380 | expand_if_available = "objc_arc", |
| 3381 | ), |
| 3382 | ], |
| 3383 | ), |
| 3384 | ], |
| 3385 | ) |
| 3386 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3387 | if (ctx.attr.cpu == "tvos_arm64" or |
| 3388 | ctx.attr.cpu == "tvos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3389 | unfiltered_cxx_flags_feature = feature( |
| 3390 | name = "unfiltered_cxx_flags", |
| 3391 | flag_sets = [ |
| 3392 | flag_set( |
| 3393 | actions = [ |
| 3394 | ACTION_NAMES.c_compile, |
| 3395 | ACTION_NAMES.cpp_compile, |
| 3396 | ACTION_NAMES.cpp_module_compile, |
| 3397 | ACTION_NAMES.cpp_header_parsing, |
| 3398 | ACTION_NAMES.assemble, |
| 3399 | ACTION_NAMES.preprocess_assemble, |
| 3400 | ], |
| 3401 | flag_groups = [ |
| 3402 | flag_group(flags = ["-no-canonical-prefixes", "-pthread"]), |
| 3403 | ], |
| 3404 | ), |
| 3405 | ], |
| 3406 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3407 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 3408 | ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 3409 | ctx.attr.cpu == "darwin_arm64" or |
| 3410 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3411 | ctx.attr.cpu == "ios_arm64" or |
| 3412 | ctx.attr.cpu == "ios_arm64e" or |
| 3413 | ctx.attr.cpu == "ios_armv7" or |
| 3414 | ctx.attr.cpu == "ios_i386" or |
| 3415 | ctx.attr.cpu == "ios_x86_64" or |
| 3416 | ctx.attr.cpu == "watchos_arm64_32" or |
| 3417 | ctx.attr.cpu == "watchos_armv7k" or |
| 3418 | ctx.attr.cpu == "watchos_i386" or |
| 3419 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3420 | unfiltered_cxx_flags_feature = feature(name = "unfiltered_cxx_flags") |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3421 | else: |
| 3422 | unfiltered_cxx_flags_feature = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3423 | |
| 3424 | compiler_input_flags_feature = feature( |
| 3425 | name = "compiler_input_flags", |
| 3426 | flag_sets = [ |
| 3427 | flag_set( |
| 3428 | actions = [ |
| 3429 | ACTION_NAMES.assemble, |
| 3430 | ACTION_NAMES.preprocess_assemble, |
| 3431 | ACTION_NAMES.c_compile, |
| 3432 | ACTION_NAMES.cpp_compile, |
| 3433 | ACTION_NAMES.linkstamp_compile, |
| 3434 | ACTION_NAMES.cpp_header_parsing, |
| 3435 | ACTION_NAMES.cpp_module_compile, |
| 3436 | ACTION_NAMES.cpp_module_codegen, |
| 3437 | ACTION_NAMES.objc_compile, |
| 3438 | ACTION_NAMES.objcpp_compile, |
| 3439 | ], |
| 3440 | flag_groups = [ |
| 3441 | flag_group( |
| 3442 | flags = ["-c", "%{source_file}"], |
| 3443 | expand_if_available = "source_file", |
| 3444 | ), |
| 3445 | ], |
| 3446 | ), |
| 3447 | ], |
| 3448 | ) |
| 3449 | |
| 3450 | strip_debug_symbols_feature = feature( |
| 3451 | name = "strip_debug_symbols", |
| 3452 | flag_sets = [ |
| 3453 | flag_set( |
| 3454 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3455 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3456 | flag_groups = [ |
| 3457 | flag_group( |
| 3458 | flags = ["-Wl,-S"], |
| 3459 | expand_if_available = "strip_debug_symbols", |
| 3460 | ), |
| 3461 | ], |
| 3462 | ), |
| 3463 | ], |
| 3464 | ) |
| 3465 | |
| 3466 | shared_flag_feature = feature( |
| 3467 | name = "shared_flag", |
| 3468 | flag_sets = [ |
| 3469 | flag_set( |
| 3470 | actions = [ |
| 3471 | ACTION_NAMES.cpp_link_dynamic_library, |
| 3472 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 3473 | ], |
| 3474 | flag_groups = [flag_group(flags = ["-shared"])], |
| 3475 | ), |
| 3476 | ], |
| 3477 | ) |
| 3478 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3479 | if (ctx.attr.cpu == "ios_i386" or |
| 3480 | ctx.attr.cpu == "ios_x86_64" or |
| 3481 | ctx.attr.cpu == "tvos_x86_64" or |
| 3482 | ctx.attr.cpu == "watchos_i386" or |
| 3483 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3484 | apply_simulator_compiler_flags_feature = feature( |
| 3485 | name = "apply_simulator_compiler_flags", |
| 3486 | flag_sets = [ |
| 3487 | flag_set( |
| 3488 | actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile], |
| 3489 | flag_groups = [ |
| 3490 | flag_group( |
| 3491 | flags = [ |
| 3492 | "-fexceptions", |
| 3493 | "-fasm-blocks", |
| 3494 | "-fobjc-abi-version=2", |
| 3495 | "-fobjc-legacy-dispatch", |
| 3496 | ], |
| 3497 | ), |
| 3498 | ], |
| 3499 | ), |
| 3500 | ], |
| 3501 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3502 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 3503 | ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 3504 | ctx.attr.cpu == "darwin_arm64" or |
| 3505 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3506 | ctx.attr.cpu == "ios_arm64" or |
| 3507 | ctx.attr.cpu == "ios_arm64e" or |
| 3508 | ctx.attr.cpu == "ios_armv7" or |
| 3509 | ctx.attr.cpu == "tvos_arm64" or |
| 3510 | ctx.attr.cpu == "watchos_arm64_32" or |
| 3511 | ctx.attr.cpu == "watchos_armv7k"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3512 | apply_simulator_compiler_flags_feature = feature(name = "apply_simulator_compiler_flags") |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3513 | else: |
| 3514 | apply_simulator_compiler_flags_feature = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3515 | |
| 3516 | supports_pic_feature = feature(name = "supports_pic", enabled = True) |
| 3517 | |
| 3518 | fastbuild_feature = feature(name = "fastbuild") |
| 3519 | |
| 3520 | no_legacy_features_feature = feature(name = "no_legacy_features") |
| 3521 | |
| 3522 | symbol_counts_feature = feature( |
| 3523 | name = "symbol_counts", |
| 3524 | flag_sets = [ |
| 3525 | flag_set( |
| 3526 | actions = all_link_actions, |
| 3527 | flag_groups = [ |
| 3528 | flag_group( |
| 3529 | flags = ["-Wl,--print-symbol-counts=%{symbol_counts_output}"], |
| 3530 | expand_if_available = "symbol_counts_output", |
| 3531 | ), |
| 3532 | ], |
| 3533 | ), |
| 3534 | ], |
| 3535 | ) |
| 3536 | |
| 3537 | user_link_flags_feature = feature( |
| 3538 | name = "user_link_flags", |
| 3539 | enabled = True, |
| 3540 | flag_sets = [ |
| 3541 | flag_set( |
| 3542 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3543 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3544 | flag_groups = [ |
| 3545 | flag_group( |
| 3546 | flags = ["%{user_link_flags}"], |
| 3547 | iterate_over = "user_link_flags", |
| 3548 | expand_if_available = "user_link_flags", |
| 3549 | ), |
| 3550 | ], |
| 3551 | ), |
| 3552 | ], |
| 3553 | ) |
| 3554 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3555 | if (ctx.attr.cpu == "armeabi-v7a" or |
| 3556 | ctx.attr.cpu == "ios_arm64" or |
| 3557 | ctx.attr.cpu == "ios_arm64e" or |
| 3558 | ctx.attr.cpu == "ios_armv7" or |
| 3559 | ctx.attr.cpu == "ios_i386" or |
| 3560 | ctx.attr.cpu == "ios_x86_64" or |
| 3561 | ctx.attr.cpu == "tvos_arm64" or |
| 3562 | ctx.attr.cpu == "tvos_x86_64" or |
| 3563 | ctx.attr.cpu == "watchos_arm64_32" or |
| 3564 | ctx.attr.cpu == "watchos_armv7k" or |
| 3565 | ctx.attr.cpu == "watchos_i386" or |
| 3566 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3567 | contains_objc_source_feature = feature( |
| 3568 | name = "contains_objc_source", |
| 3569 | flag_sets = [ |
| 3570 | flag_set( |
| 3571 | actions = [ |
| 3572 | ACTION_NAMES.cpp_link_dynamic_library, |
| 3573 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 3574 | ACTION_NAMES.cpp_link_executable, |
| 3575 | ], |
| 3576 | flag_groups = [flag_group(flags = ["-fobjc-link-runtime"])], |
| 3577 | ), |
| 3578 | flag_set( |
| 3579 | actions = [ |
| 3580 | ACTION_NAMES.cpp_link_dynamic_library, |
| 3581 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 3582 | ACTION_NAMES.cpp_link_executable, |
| 3583 | ], |
| 3584 | flag_groups = [flag_group(flags = ["-framework", "UIKit"])], |
| 3585 | ), |
| 3586 | ], |
| 3587 | ) |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 3588 | elif (ctx.attr.cpu == "darwin_x86_64" or |
| 3589 | ctx.attr.cpu == "darwin_arm64" or |
| 3590 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3591 | contains_objc_source_feature = feature( |
| 3592 | name = "contains_objc_source", |
| 3593 | flag_sets = [ |
| 3594 | flag_set( |
| 3595 | actions = [ |
| 3596 | ACTION_NAMES.cpp_link_dynamic_library, |
| 3597 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 3598 | ACTION_NAMES.cpp_link_executable, |
| 3599 | ], |
| 3600 | flag_groups = [flag_group(flags = ["-fobjc-link-runtime"])], |
| 3601 | ), |
| 3602 | ], |
| 3603 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3604 | else: |
| 3605 | contains_objc_source_feature = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3606 | |
| 3607 | includes_feature = feature( |
| 3608 | name = "includes", |
| 3609 | enabled = True, |
| 3610 | flag_sets = [ |
| 3611 | flag_set( |
| 3612 | actions = [ |
| 3613 | ACTION_NAMES.preprocess_assemble, |
| 3614 | ACTION_NAMES.linkstamp_compile, |
| 3615 | ACTION_NAMES.c_compile, |
| 3616 | ACTION_NAMES.cpp_compile, |
| 3617 | ACTION_NAMES.cpp_header_parsing, |
| 3618 | ACTION_NAMES.cpp_module_compile, |
| 3619 | ACTION_NAMES.objc_compile, |
| 3620 | ACTION_NAMES.objcpp_compile, |
| 3621 | ACTION_NAMES.clif_match, |
| 3622 | ], |
| 3623 | flag_groups = [ |
| 3624 | flag_group( |
| 3625 | flags = ["-include", "%{includes}"], |
| 3626 | iterate_over = "includes", |
| 3627 | expand_if_available = "includes", |
| 3628 | ), |
| 3629 | ], |
| 3630 | ), |
| 3631 | ], |
| 3632 | ) |
| 3633 | |
| 3634 | gcc_coverage_map_format_feature = feature( |
| 3635 | name = "gcc_coverage_map_format", |
| 3636 | flag_sets = [ |
| 3637 | flag_set( |
| 3638 | actions = [ |
| 3639 | ACTION_NAMES.preprocess_assemble, |
| 3640 | ACTION_NAMES.c_compile, |
| 3641 | ACTION_NAMES.cpp_compile, |
| 3642 | ACTION_NAMES.cpp_module_compile, |
| 3643 | ACTION_NAMES.objc_compile, |
| 3644 | ACTION_NAMES.objcpp_compile, |
| 3645 | ], |
| 3646 | flag_groups = [ |
| 3647 | flag_group( |
| 3648 | flags = ["-fprofile-arcs", "-ftest-coverage", "-g"], |
| 3649 | ), |
| 3650 | ], |
| 3651 | ), |
| 3652 | flag_set( |
| 3653 | actions = [ |
| 3654 | ACTION_NAMES.cpp_link_dynamic_library, |
| 3655 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 3656 | ACTION_NAMES.cpp_link_executable, |
| 3657 | ], |
| 3658 | flag_groups = [flag_group(flags = ["--coverage"])], |
| 3659 | ), |
| 3660 | ], |
| 3661 | requires = [feature_set(features = ["coverage"])], |
| 3662 | ) |
| 3663 | |
| 3664 | if (ctx.attr.cpu == "ios_arm64"): |
| 3665 | default_link_flags_feature = feature( |
| 3666 | name = "default_link_flags", |
| 3667 | enabled = True, |
| 3668 | flag_sets = [ |
| 3669 | flag_set( |
| 3670 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3671 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3672 | flag_groups = [ |
| 3673 | flag_group( |
| 3674 | flags = [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3675 | "-no-canonical-prefixes", |
| 3676 | "-target", |
| 3677 | "arm64-apple-ios", |
| 3678 | ], |
| 3679 | ), |
| 3680 | ], |
| 3681 | ), |
| 3682 | ], |
| 3683 | ) |
| 3684 | elif (ctx.attr.cpu == "tvos_arm64"): |
| 3685 | default_link_flags_feature = feature( |
| 3686 | name = "default_link_flags", |
| 3687 | enabled = True, |
| 3688 | flag_sets = [ |
| 3689 | flag_set( |
| 3690 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3691 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3692 | flag_groups = [ |
| 3693 | flag_group( |
| 3694 | flags = [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3695 | "-no-canonical-prefixes", |
| 3696 | "-target", |
| 3697 | "arm64-apple-tvos", |
| 3698 | ], |
| 3699 | ), |
| 3700 | ], |
| 3701 | ), |
| 3702 | ], |
| 3703 | ) |
| 3704 | elif (ctx.attr.cpu == "ios_arm64e"): |
| 3705 | default_link_flags_feature = feature( |
| 3706 | name = "default_link_flags", |
| 3707 | enabled = True, |
| 3708 | flag_sets = [ |
| 3709 | flag_set( |
| 3710 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3711 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3712 | flag_groups = [ |
| 3713 | flag_group( |
| 3714 | flags = [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3715 | "-no-canonical-prefixes", |
| 3716 | "-target", |
| 3717 | "arm64e-apple-ios", |
| 3718 | ], |
| 3719 | ), |
| 3720 | ], |
| 3721 | ), |
| 3722 | ], |
| 3723 | ) |
| 3724 | elif (ctx.attr.cpu == "ios_armv7"): |
| 3725 | default_link_flags_feature = feature( |
| 3726 | name = "default_link_flags", |
| 3727 | enabled = True, |
| 3728 | flag_sets = [ |
| 3729 | flag_set( |
| 3730 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3731 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3732 | flag_groups = [ |
| 3733 | flag_group( |
| 3734 | flags = [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3735 | "-no-canonical-prefixes", |
| 3736 | "-target", |
| 3737 | "armv7-apple-ios", |
| 3738 | ], |
| 3739 | ), |
| 3740 | ], |
| 3741 | ), |
| 3742 | ], |
| 3743 | ) |
| 3744 | elif (ctx.attr.cpu == "watchos_armv7k"): |
| 3745 | default_link_flags_feature = feature( |
| 3746 | name = "default_link_flags", |
| 3747 | enabled = True, |
| 3748 | flag_sets = [ |
| 3749 | flag_set( |
| 3750 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3751 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3752 | flag_groups = [ |
| 3753 | flag_group( |
| 3754 | flags = [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3755 | "-no-canonical-prefixes", |
| 3756 | "-target", |
| 3757 | "armv7-apple-watchos", |
| 3758 | ], |
| 3759 | ), |
| 3760 | ], |
| 3761 | ), |
| 3762 | ], |
| 3763 | ) |
| 3764 | elif (ctx.attr.cpu == "ios_i386"): |
| 3765 | default_link_flags_feature = feature( |
| 3766 | name = "default_link_flags", |
| 3767 | enabled = True, |
| 3768 | flag_sets = [ |
| 3769 | flag_set( |
| 3770 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3771 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3772 | flag_groups = [ |
| 3773 | flag_group( |
| 3774 | flags = [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3775 | "-no-canonical-prefixes", |
| 3776 | "-target", |
| 3777 | "i386-apple-ios", |
| 3778 | ], |
| 3779 | ), |
| 3780 | ], |
| 3781 | ), |
| 3782 | ], |
| 3783 | ) |
| 3784 | elif (ctx.attr.cpu == "watchos_i386"): |
| 3785 | default_link_flags_feature = feature( |
| 3786 | name = "default_link_flags", |
| 3787 | enabled = True, |
| 3788 | flag_sets = [ |
| 3789 | flag_set( |
| 3790 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3791 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3792 | flag_groups = [ |
| 3793 | flag_group( |
| 3794 | flags = [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3795 | "-no-canonical-prefixes", |
| 3796 | "-target", |
| 3797 | "i386-apple-watchos", |
| 3798 | ], |
| 3799 | ), |
| 3800 | ], |
| 3801 | ), |
| 3802 | ], |
| 3803 | ) |
| 3804 | elif (ctx.attr.cpu == "ios_x86_64"): |
| 3805 | default_link_flags_feature = feature( |
| 3806 | name = "default_link_flags", |
| 3807 | enabled = True, |
| 3808 | flag_sets = [ |
| 3809 | flag_set( |
| 3810 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3811 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3812 | flag_groups = [ |
| 3813 | flag_group( |
| 3814 | flags = [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3815 | "-no-canonical-prefixes", |
| 3816 | "-target", |
| 3817 | "x86_64-apple-ios", |
| 3818 | ], |
| 3819 | ), |
| 3820 | ], |
| 3821 | ), |
| 3822 | ], |
| 3823 | ) |
| 3824 | elif (ctx.attr.cpu == "tvos_x86_64"): |
| 3825 | default_link_flags_feature = feature( |
| 3826 | name = "default_link_flags", |
| 3827 | enabled = True, |
| 3828 | flag_sets = [ |
| 3829 | flag_set( |
| 3830 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3831 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3832 | flag_groups = [ |
| 3833 | flag_group( |
| 3834 | flags = [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3835 | "-no-canonical-prefixes", |
| 3836 | "-target", |
| 3837 | "x86_64-apple-tvos", |
| 3838 | ], |
| 3839 | ), |
| 3840 | ], |
| 3841 | ), |
| 3842 | ], |
| 3843 | ) |
| 3844 | elif (ctx.attr.cpu == "darwin_x86_64"): |
| 3845 | default_link_flags_feature = feature( |
| 3846 | name = "default_link_flags", |
| 3847 | enabled = True, |
| 3848 | flag_sets = [ |
| 3849 | flag_set( |
| 3850 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3851 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3852 | flag_groups = [ |
| 3853 | flag_group( |
Yun Peng | 8c7e11a | 2021-01-27 03:23:12 -0800 | [diff] [blame] | 3854 | flags = [ |
| 3855 | "-no-canonical-prefixes", |
| 3856 | "-target", |
| 3857 | "x86_64-apple-macosx", |
| 3858 | ], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3859 | ), |
| 3860 | ], |
| 3861 | ), |
| 3862 | flag_set( |
hlopko | 314cf1f | 2019-03-15 08:17:59 -0700 | [diff] [blame] | 3863 | actions = [ |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3864 | ACTION_NAMES.cpp_link_dynamic_library, |
| 3865 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
hlopko | 314cf1f | 2019-03-15 08:17:59 -0700 | [diff] [blame] | 3866 | ], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3867 | flag_groups = [flag_group(flags = ["-undefined", "dynamic_lookup"])], |
| 3868 | ), |
| 3869 | flag_set( |
| 3870 | actions = [ |
| 3871 | ACTION_NAMES.cpp_link_executable, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3872 | "objc-executable", |
| 3873 | "objc++-executable", |
| 3874 | ], |
| 3875 | flag_groups = [flag_group(flags = ["-undefined", "dynamic_lookup"])], |
| 3876 | with_features = [with_feature_set(features = ["dynamic_linking_mode"])], |
| 3877 | ), |
| 3878 | ], |
| 3879 | ) |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 3880 | elif (ctx.attr.cpu == "darwin_arm64"): |
| 3881 | default_link_flags_feature = feature( |
| 3882 | name = "default_link_flags", |
| 3883 | enabled = True, |
| 3884 | flag_sets = [ |
| 3885 | flag_set( |
| 3886 | actions = all_link_actions + |
| 3887 | ["objc-executable", "objc++-executable"], |
| 3888 | flag_groups = [ |
| 3889 | flag_group( |
| 3890 | flags = [ |
| 3891 | "-no-canonical-prefixes", |
| 3892 | "-target", |
| 3893 | "arm64-apple-macosx", |
| 3894 | ], |
| 3895 | ), |
| 3896 | ], |
| 3897 | ), |
| 3898 | flag_set( |
| 3899 | actions = [ |
| 3900 | ACTION_NAMES.cpp_link_dynamic_library, |
| 3901 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 3902 | ], |
| 3903 | flag_groups = [flag_group(flags = ["-undefined", "dynamic_lookup"])], |
| 3904 | ), |
| 3905 | flag_set( |
| 3906 | actions = [ |
| 3907 | ACTION_NAMES.cpp_link_executable, |
| 3908 | "objc-executable", |
| 3909 | "objc++-executable", |
| 3910 | ], |
| 3911 | flag_groups = [flag_group(flags = ["-undefined", "dynamic_lookup"])], |
| 3912 | with_features = [with_feature_set(features = ["dynamic_linking_mode"])], |
| 3913 | ), |
| 3914 | ], |
| 3915 | ) |
| 3916 | elif (ctx.attr.cpu == "darwin_arm64e"): |
| 3917 | default_link_flags_feature = feature( |
| 3918 | name = "default_link_flags", |
| 3919 | enabled = True, |
| 3920 | flag_sets = [ |
| 3921 | flag_set( |
| 3922 | actions = all_link_actions + |
| 3923 | ["objc-executable", "objc++-executable"], |
| 3924 | flag_groups = [ |
| 3925 | flag_group( |
| 3926 | flags = [ |
| 3927 | "-no-canonical-prefixes", |
| 3928 | "-target", |
| 3929 | "arm64e-apple-macos", |
| 3930 | ], |
| 3931 | ), |
| 3932 | ], |
| 3933 | ), |
| 3934 | flag_set( |
| 3935 | actions = [ |
| 3936 | ACTION_NAMES.cpp_link_dynamic_library, |
| 3937 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 3938 | ], |
| 3939 | flag_groups = [flag_group(flags = ["-undefined", "dynamic_lookup"])], |
| 3940 | ), |
| 3941 | flag_set( |
| 3942 | actions = [ |
| 3943 | ACTION_NAMES.cpp_link_executable, |
| 3944 | "objc-executable", |
| 3945 | "objc++-executable", |
| 3946 | ], |
| 3947 | flag_groups = [flag_group(flags = ["-undefined", "dynamic_lookup"])], |
| 3948 | with_features = [with_feature_set(features = ["dynamic_linking_mode"])], |
| 3949 | ), |
| 3950 | ], |
| 3951 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3952 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 3953 | ctx.attr.cpu == "watchos_arm64_32" or |
| 3954 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3955 | default_link_flags_feature = feature( |
| 3956 | name = "default_link_flags", |
| 3957 | enabled = True, |
| 3958 | flag_sets = [ |
| 3959 | flag_set( |
| 3960 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 3961 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3962 | flag_groups = [ |
| 3963 | flag_group( |
Keith Smiley | f8e38d1 | 2019-02-13 13:33:36 -0800 | [diff] [blame] | 3964 | flags = ["-no-canonical-prefixes"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3965 | ), |
| 3966 | ], |
| 3967 | ), |
| 3968 | ], |
| 3969 | ) |
Keith Smiley | f8e38d1 | 2019-02-13 13:33:36 -0800 | [diff] [blame] | 3970 | else: |
| 3971 | fail("Unreachable") |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 3972 | |
| 3973 | output_execpath_flags_feature = feature( |
| 3974 | name = "output_execpath_flags", |
| 3975 | flag_sets = [ |
| 3976 | flag_set( |
| 3977 | actions = all_link_actions, |
| 3978 | flag_groups = [ |
| 3979 | flag_group( |
| 3980 | flags = ["-o", "%{output_execpath}"], |
| 3981 | expand_if_available = "output_execpath", |
| 3982 | ), |
| 3983 | ], |
| 3984 | ), |
| 3985 | ], |
| 3986 | ) |
| 3987 | |
| 3988 | no_enable_modules_feature = feature( |
| 3989 | name = "no_enable_modules", |
| 3990 | flag_sets = [ |
| 3991 | flag_set( |
| 3992 | actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile], |
| 3993 | flag_groups = [flag_group(flags = ["-fmodule-maps"])], |
| 3994 | ), |
| 3995 | ], |
| 3996 | requires = [feature_set(features = ["use_objc_modules"])], |
| 3997 | ) |
| 3998 | |
| 3999 | pic_feature = feature( |
| 4000 | name = "pic", |
hlopko | 2f17a86 | 2019-02-26 07:56:03 -0800 | [diff] [blame] | 4001 | enabled = True, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4002 | flag_sets = [ |
| 4003 | flag_set( |
| 4004 | actions = [ |
| 4005 | ACTION_NAMES.c_compile, |
| 4006 | ACTION_NAMES.cpp_compile, |
| 4007 | ACTION_NAMES.cpp_module_codegen, |
| 4008 | ACTION_NAMES.cpp_module_compile, |
| 4009 | ACTION_NAMES.linkstamp_compile, |
| 4010 | ACTION_NAMES.preprocess_assemble, |
| 4011 | ], |
| 4012 | flag_groups = [ |
| 4013 | flag_group(flags = ["-fPIC"], expand_if_available = "pic"), |
| 4014 | ], |
| 4015 | ), |
| 4016 | ], |
| 4017 | ) |
| 4018 | |
| 4019 | framework_paths_feature = feature( |
| 4020 | name = "framework_paths", |
| 4021 | flag_sets = [ |
| 4022 | flag_set( |
| 4023 | actions = [ |
waltl | b494074 | 2019-12-11 23:34:53 -0800 | [diff] [blame] | 4024 | ACTION_NAMES.preprocess_assemble, |
| 4025 | ACTION_NAMES.c_compile, |
| 4026 | ACTION_NAMES.cpp_compile, |
| 4027 | ACTION_NAMES.cpp_header_parsing, |
| 4028 | ACTION_NAMES.cpp_module_compile, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4029 | ACTION_NAMES.objc_compile, |
| 4030 | ACTION_NAMES.objcpp_compile, |
waltl | b494074 | 2019-12-11 23:34:53 -0800 | [diff] [blame] | 4031 | ], |
| 4032 | flag_groups = [ |
| 4033 | flag_group( |
| 4034 | flags = ["-F%{framework_include_paths}"], |
| 4035 | iterate_over = "framework_include_paths", |
| 4036 | ), |
| 4037 | ], |
| 4038 | ), |
| 4039 | flag_set( |
| 4040 | actions = [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4041 | "objc-executable", |
| 4042 | "objc++-executable", |
| 4043 | ], |
| 4044 | flag_groups = [ |
| 4045 | flag_group( |
| 4046 | flags = ["-F%{framework_paths}"], |
| 4047 | iterate_over = "framework_paths", |
| 4048 | ), |
| 4049 | ], |
| 4050 | ), |
| 4051 | ], |
| 4052 | ) |
| 4053 | |
Keith Smiley | 235e76b | 2019-02-28 16:46:01 -0800 | [diff] [blame] | 4054 | if ctx.attr.cpu == "armeabi-v7a": |
| 4055 | # This stub doesn't have a sensible value for this feature |
| 4056 | version_min_feature = feature(name = "version_min") |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 4057 | elif (ctx.attr.cpu == "ios_i386" or |
| 4058 | ctx.attr.cpu == "ios_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4059 | version_min_feature = feature( |
| 4060 | name = "version_min", |
| 4061 | flag_sets = [ |
| 4062 | flag_set( |
| 4063 | actions = [ |
| 4064 | "objc-executable", |
| 4065 | "objc++-executable", |
| 4066 | ACTION_NAMES.cpp_link_executable, |
| 4067 | ACTION_NAMES.cpp_link_dynamic_library, |
| 4068 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 4069 | ACTION_NAMES.preprocess_assemble, |
| 4070 | ACTION_NAMES.c_compile, |
| 4071 | ACTION_NAMES.cpp_compile, |
| 4072 | ACTION_NAMES.cpp_header_parsing, |
| 4073 | ACTION_NAMES.cpp_module_compile, |
| 4074 | ACTION_NAMES.objc_compile, |
| 4075 | ACTION_NAMES.objcpp_compile, |
| 4076 | ], |
| 4077 | flag_groups = [ |
| 4078 | flag_group( |
| 4079 | flags = ["-mios-simulator-version-min=%{version_min}"], |
| 4080 | ), |
| 4081 | ], |
| 4082 | ), |
| 4083 | ], |
| 4084 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 4085 | elif (ctx.attr.cpu == "ios_arm64" or |
| 4086 | ctx.attr.cpu == "ios_arm64e" or |
| 4087 | ctx.attr.cpu == "ios_armv7"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4088 | version_min_feature = feature( |
| 4089 | name = "version_min", |
| 4090 | flag_sets = [ |
| 4091 | flag_set( |
| 4092 | actions = [ |
| 4093 | "objc-executable", |
| 4094 | "objc++-executable", |
| 4095 | ACTION_NAMES.cpp_link_executable, |
| 4096 | ACTION_NAMES.cpp_link_dynamic_library, |
| 4097 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 4098 | ACTION_NAMES.preprocess_assemble, |
| 4099 | ACTION_NAMES.c_compile, |
| 4100 | ACTION_NAMES.cpp_compile, |
| 4101 | ACTION_NAMES.cpp_header_parsing, |
| 4102 | ACTION_NAMES.cpp_module_compile, |
| 4103 | ACTION_NAMES.objc_compile, |
| 4104 | ACTION_NAMES.objcpp_compile, |
| 4105 | ], |
| 4106 | flag_groups = [ |
| 4107 | flag_group( |
| 4108 | flags = ["-miphoneos-version-min=%{version_min}"], |
| 4109 | ), |
| 4110 | ], |
| 4111 | ), |
| 4112 | ], |
| 4113 | ) |
| 4114 | elif (ctx.attr.cpu == "tvos_x86_64"): |
| 4115 | version_min_feature = feature( |
| 4116 | name = "version_min", |
| 4117 | flag_sets = [ |
| 4118 | flag_set( |
| 4119 | actions = [ |
| 4120 | "objc-executable", |
| 4121 | "objc++-executable", |
| 4122 | ACTION_NAMES.cpp_link_executable, |
| 4123 | ACTION_NAMES.cpp_link_dynamic_library, |
| 4124 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 4125 | ACTION_NAMES.preprocess_assemble, |
| 4126 | ACTION_NAMES.c_compile, |
| 4127 | ACTION_NAMES.cpp_compile, |
| 4128 | ACTION_NAMES.cpp_header_parsing, |
| 4129 | ACTION_NAMES.cpp_module_compile, |
| 4130 | ACTION_NAMES.objc_compile, |
| 4131 | ACTION_NAMES.objcpp_compile, |
| 4132 | ], |
| 4133 | flag_groups = [ |
| 4134 | flag_group( |
| 4135 | flags = ["-mtvos-simulator-version-min=%{version_min}"], |
| 4136 | ), |
| 4137 | ], |
| 4138 | ), |
| 4139 | ], |
| 4140 | ) |
Keith Smiley | 235e76b | 2019-02-28 16:46:01 -0800 | [diff] [blame] | 4141 | elif (ctx.attr.cpu == "watchos_i386" or ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4142 | version_min_feature = feature( |
| 4143 | name = "version_min", |
| 4144 | flag_sets = [ |
| 4145 | flag_set( |
| 4146 | actions = [ |
| 4147 | "objc-executable", |
| 4148 | "objc++-executable", |
| 4149 | ACTION_NAMES.cpp_link_executable, |
| 4150 | ACTION_NAMES.cpp_link_dynamic_library, |
| 4151 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 4152 | ACTION_NAMES.preprocess_assemble, |
| 4153 | ACTION_NAMES.c_compile, |
| 4154 | ACTION_NAMES.cpp_compile, |
| 4155 | ACTION_NAMES.cpp_header_parsing, |
| 4156 | ACTION_NAMES.cpp_module_compile, |
| 4157 | ACTION_NAMES.objc_compile, |
| 4158 | ACTION_NAMES.objcpp_compile, |
| 4159 | ], |
| 4160 | flag_groups = [ |
| 4161 | flag_group( |
| 4162 | flags = ["-mwatchos-simulator-version-min=%{version_min}"], |
| 4163 | ), |
| 4164 | ], |
| 4165 | ), |
| 4166 | ], |
| 4167 | ) |
Keith Smiley | 235e76b | 2019-02-28 16:46:01 -0800 | [diff] [blame] | 4168 | elif (ctx.attr.cpu == "watchos_armv7k" or ctx.attr.cpu == "watchos_arm64_32"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4169 | version_min_feature = feature( |
| 4170 | name = "version_min", |
| 4171 | flag_sets = [ |
| 4172 | flag_set( |
| 4173 | actions = [ |
| 4174 | "objc-executable", |
| 4175 | "objc++-executable", |
| 4176 | ACTION_NAMES.cpp_link_executable, |
| 4177 | ACTION_NAMES.cpp_link_dynamic_library, |
| 4178 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 4179 | ACTION_NAMES.preprocess_assemble, |
| 4180 | ACTION_NAMES.c_compile, |
| 4181 | ACTION_NAMES.cpp_compile, |
| 4182 | ACTION_NAMES.cpp_header_parsing, |
| 4183 | ACTION_NAMES.cpp_module_compile, |
| 4184 | ACTION_NAMES.objc_compile, |
| 4185 | ACTION_NAMES.objcpp_compile, |
| 4186 | ], |
| 4187 | flag_groups = [ |
| 4188 | flag_group( |
| 4189 | flags = ["-mwatchos-version-min=%{version_min}"], |
| 4190 | ), |
| 4191 | ], |
| 4192 | ), |
| 4193 | ], |
| 4194 | ) |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 4195 | elif (ctx.attr.cpu == "darwin_x86_64" or |
| 4196 | ctx.attr.cpu == "darwin_arm64" or |
| 4197 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4198 | version_min_feature = feature( |
| 4199 | name = "version_min", |
| 4200 | flag_sets = [ |
| 4201 | flag_set( |
| 4202 | actions = [ |
| 4203 | "objc-executable", |
| 4204 | "objc++-executable", |
| 4205 | ACTION_NAMES.cpp_link_executable, |
| 4206 | ACTION_NAMES.cpp_link_dynamic_library, |
| 4207 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 4208 | ACTION_NAMES.preprocess_assemble, |
| 4209 | ACTION_NAMES.c_compile, |
| 4210 | ACTION_NAMES.cpp_compile, |
| 4211 | ACTION_NAMES.cpp_header_parsing, |
| 4212 | ACTION_NAMES.cpp_module_compile, |
| 4213 | ACTION_NAMES.objc_compile, |
| 4214 | ACTION_NAMES.objcpp_compile, |
| 4215 | ], |
| 4216 | flag_groups = [ |
| 4217 | flag_group(flags = ["-mmacosx-version-min=%{version_min}"]), |
| 4218 | ], |
| 4219 | ), |
| 4220 | ], |
| 4221 | ) |
| 4222 | elif (ctx.attr.cpu == "tvos_arm64"): |
| 4223 | version_min_feature = feature( |
| 4224 | name = "version_min", |
| 4225 | flag_sets = [ |
| 4226 | flag_set( |
| 4227 | actions = [ |
| 4228 | "objc-executable", |
| 4229 | "objc++-executable", |
| 4230 | ACTION_NAMES.cpp_link_executable, |
| 4231 | ACTION_NAMES.cpp_link_dynamic_library, |
| 4232 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 4233 | ACTION_NAMES.preprocess_assemble, |
| 4234 | ACTION_NAMES.c_compile, |
| 4235 | ACTION_NAMES.cpp_compile, |
| 4236 | ACTION_NAMES.cpp_header_parsing, |
| 4237 | ACTION_NAMES.cpp_module_compile, |
| 4238 | ACTION_NAMES.objc_compile, |
| 4239 | ACTION_NAMES.objcpp_compile, |
| 4240 | ], |
| 4241 | flag_groups = [flag_group(flags = ["-mtvos-version-min=%{version_min}"])], |
| 4242 | ), |
| 4243 | ], |
| 4244 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 4245 | else: |
| 4246 | version_min_feature = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4247 | |
| 4248 | compiler_output_flags_feature = feature( |
| 4249 | name = "compiler_output_flags", |
| 4250 | flag_sets = [ |
| 4251 | flag_set( |
| 4252 | actions = [ |
| 4253 | ACTION_NAMES.assemble, |
| 4254 | ACTION_NAMES.preprocess_assemble, |
| 4255 | ACTION_NAMES.c_compile, |
| 4256 | ACTION_NAMES.cpp_compile, |
| 4257 | ACTION_NAMES.linkstamp_compile, |
| 4258 | ACTION_NAMES.cpp_header_parsing, |
| 4259 | ACTION_NAMES.cpp_module_compile, |
| 4260 | ACTION_NAMES.cpp_module_codegen, |
| 4261 | ACTION_NAMES.objc_compile, |
| 4262 | ACTION_NAMES.objcpp_compile, |
| 4263 | ], |
| 4264 | flag_groups = [ |
| 4265 | flag_group( |
| 4266 | flags = ["-S"], |
| 4267 | expand_if_available = "output_assembly_file", |
| 4268 | ), |
| 4269 | flag_group( |
| 4270 | flags = ["-E"], |
| 4271 | expand_if_available = "output_preprocess_file", |
| 4272 | ), |
| 4273 | flag_group( |
| 4274 | flags = ["-o", "%{output_file}"], |
| 4275 | expand_if_available = "output_file", |
| 4276 | ), |
| 4277 | ], |
| 4278 | ), |
| 4279 | ], |
| 4280 | ) |
| 4281 | |
| 4282 | opt_feature = feature(name = "opt") |
| 4283 | |
| 4284 | pch_feature = feature( |
| 4285 | name = "pch", |
| 4286 | flag_sets = [ |
| 4287 | flag_set( |
| 4288 | actions = [ |
| 4289 | ACTION_NAMES.objc_compile, |
| 4290 | ACTION_NAMES.objcpp_compile, |
| 4291 | ACTION_NAMES.c_compile, |
| 4292 | ACTION_NAMES.cpp_compile, |
| 4293 | ], |
| 4294 | flag_groups = [flag_group(flags = ["-include", "%{pch_file}"])], |
| 4295 | ), |
| 4296 | ], |
| 4297 | ) |
| 4298 | |
| 4299 | coverage_feature = feature(name = "coverage") |
| 4300 | |
Googler | 4d3c5e2 | 2019-06-19 17:25:20 -0700 | [diff] [blame] | 4301 | include_system_dirs_feature = feature( |
| 4302 | name = "include_system_dirs", |
| 4303 | flag_sets = [ |
| 4304 | flag_set( |
| 4305 | actions = [ |
| 4306 | ACTION_NAMES.c_compile, |
| 4307 | ACTION_NAMES.cpp_compile, |
| 4308 | ACTION_NAMES.cpp_module_compile, |
| 4309 | ACTION_NAMES.cpp_header_parsing, |
| 4310 | ACTION_NAMES.objc_compile, |
| 4311 | ACTION_NAMES.objcpp_compile, |
| 4312 | "objc-executable", |
| 4313 | "objc++-executable", |
| 4314 | ACTION_NAMES.assemble, |
| 4315 | ACTION_NAMES.preprocess_assemble, |
| 4316 | ], |
| 4317 | flag_groups = [ |
| 4318 | flag_group( |
| 4319 | flags = [ |
| 4320 | "-isysroot", |
| 4321 | "%{sdk_dir}", |
| 4322 | "-F%{sdk_framework_dir}", |
| 4323 | "-F%{platform_developer_framework_dir}", |
| 4324 | ], |
| 4325 | ), |
| 4326 | ], |
| 4327 | ), |
| 4328 | ], |
| 4329 | ) |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4330 | |
| 4331 | input_param_flags_feature = feature( |
| 4332 | name = "input_param_flags", |
| 4333 | flag_sets = [ |
| 4334 | flag_set( |
| 4335 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 4336 | [ACTION_NAMES.cpp_link_static_library], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4337 | flag_groups = [ |
| 4338 | flag_group( |
| 4339 | flags = ["-L%{library_search_directories}"], |
| 4340 | iterate_over = "library_search_directories", |
| 4341 | expand_if_available = "library_search_directories", |
| 4342 | ), |
| 4343 | ], |
| 4344 | ), |
| 4345 | flag_set( |
| 4346 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 4347 | [ACTION_NAMES.cpp_link_static_library], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4348 | flag_groups = [ |
| 4349 | flag_group( |
| 4350 | flags = ["%{libopts}"], |
| 4351 | iterate_over = "libopts", |
| 4352 | expand_if_available = "libopts", |
| 4353 | ), |
| 4354 | ], |
| 4355 | ), |
| 4356 | flag_set( |
| 4357 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 4358 | [ACTION_NAMES.cpp_link_static_library], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4359 | flag_groups = [ |
| 4360 | flag_group( |
| 4361 | flags = ["-Wl,-force_load,%{whole_archive_linker_params}"], |
| 4362 | iterate_over = "whole_archive_linker_params", |
| 4363 | expand_if_available = "whole_archive_linker_params", |
| 4364 | ), |
| 4365 | ], |
| 4366 | ), |
| 4367 | flag_set( |
| 4368 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 4369 | [ACTION_NAMES.cpp_link_static_library], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4370 | flag_groups = [ |
| 4371 | flag_group( |
| 4372 | flags = ["%{linker_input_params}"], |
| 4373 | iterate_over = "linker_input_params", |
| 4374 | expand_if_available = "linker_input_params", |
| 4375 | ), |
| 4376 | ], |
| 4377 | ), |
| 4378 | flag_set( |
| 4379 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 4380 | [ACTION_NAMES.cpp_link_static_library], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4381 | flag_groups = [ |
| 4382 | flag_group( |
| 4383 | iterate_over = "libraries_to_link", |
| 4384 | flag_groups = [ |
| 4385 | flag_group( |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4386 | iterate_over = "libraries_to_link.object_files", |
| 4387 | flag_groups = [ |
| 4388 | flag_group( |
| 4389 | flags = ["%{libraries_to_link.object_files}"], |
| 4390 | expand_if_false = "libraries_to_link.is_whole_archive", |
| 4391 | ), |
| 4392 | flag_group( |
| 4393 | flags = ["-Wl,-force_load,%{libraries_to_link.object_files}"], |
| 4394 | expand_if_true = "libraries_to_link.is_whole_archive", |
| 4395 | ), |
| 4396 | ], |
| 4397 | expand_if_equal = variable_with_value( |
| 4398 | name = "libraries_to_link.type", |
| 4399 | value = "object_file_group", |
| 4400 | ), |
| 4401 | ), |
| 4402 | flag_group( |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4403 | flag_groups = [ |
| 4404 | flag_group( |
| 4405 | flags = ["%{libraries_to_link.name}"], |
| 4406 | expand_if_false = "libraries_to_link.is_whole_archive", |
| 4407 | ), |
| 4408 | flag_group( |
| 4409 | flags = ["-Wl,-force_load,%{libraries_to_link.name}"], |
| 4410 | expand_if_true = "libraries_to_link.is_whole_archive", |
| 4411 | ), |
| 4412 | ], |
| 4413 | expand_if_equal = variable_with_value( |
| 4414 | name = "libraries_to_link.type", |
| 4415 | value = "object_file", |
| 4416 | ), |
| 4417 | ), |
| 4418 | flag_group( |
| 4419 | flag_groups = [ |
| 4420 | flag_group( |
| 4421 | flags = ["%{libraries_to_link.name}"], |
| 4422 | expand_if_false = "libraries_to_link.is_whole_archive", |
| 4423 | ), |
| 4424 | flag_group( |
| 4425 | flags = ["-Wl,-force_load,%{libraries_to_link.name}"], |
| 4426 | expand_if_true = "libraries_to_link.is_whole_archive", |
| 4427 | ), |
| 4428 | ], |
| 4429 | expand_if_equal = variable_with_value( |
| 4430 | name = "libraries_to_link.type", |
| 4431 | value = "interface_library", |
| 4432 | ), |
| 4433 | ), |
| 4434 | flag_group( |
| 4435 | flag_groups = [ |
| 4436 | flag_group( |
| 4437 | flags = ["%{libraries_to_link.name}"], |
| 4438 | expand_if_false = "libraries_to_link.is_whole_archive", |
| 4439 | ), |
| 4440 | flag_group( |
| 4441 | flags = ["-Wl,-force_load,%{libraries_to_link.name}"], |
| 4442 | expand_if_true = "libraries_to_link.is_whole_archive", |
| 4443 | ), |
| 4444 | ], |
| 4445 | expand_if_equal = variable_with_value( |
| 4446 | name = "libraries_to_link.type", |
| 4447 | value = "static_library", |
| 4448 | ), |
| 4449 | ), |
| 4450 | flag_group( |
| 4451 | flag_groups = [ |
| 4452 | flag_group( |
| 4453 | flags = ["-l%{libraries_to_link.name}"], |
| 4454 | expand_if_false = "libraries_to_link.is_whole_archive", |
| 4455 | ), |
| 4456 | flag_group( |
| 4457 | flags = ["-Wl,-force_load,-l%{libraries_to_link.name}"], |
| 4458 | expand_if_true = "libraries_to_link.is_whole_archive", |
| 4459 | ), |
| 4460 | ], |
| 4461 | expand_if_equal = variable_with_value( |
| 4462 | name = "libraries_to_link.type", |
| 4463 | value = "dynamic_library", |
| 4464 | ), |
| 4465 | ), |
| 4466 | flag_group( |
| 4467 | flag_groups = [ |
| 4468 | flag_group( |
| 4469 | flags = ["-l:%{libraries_to_link.name}"], |
| 4470 | expand_if_false = "libraries_to_link.is_whole_archive", |
| 4471 | ), |
| 4472 | flag_group( |
| 4473 | flags = ["-Wl,-force_load,-l:%{libraries_to_link.name}"], |
| 4474 | expand_if_true = "libraries_to_link.is_whole_archive", |
| 4475 | ), |
| 4476 | ], |
| 4477 | expand_if_equal = variable_with_value( |
| 4478 | name = "libraries_to_link.type", |
| 4479 | value = "versioned_dynamic_library", |
| 4480 | ), |
| 4481 | ), |
| 4482 | ], |
| 4483 | expand_if_available = "libraries_to_link", |
| 4484 | ), |
| 4485 | ], |
| 4486 | ), |
| 4487 | ], |
| 4488 | ) |
| 4489 | |
| 4490 | per_object_debug_info_feature = feature( |
| 4491 | name = "per_object_debug_info", |
| 4492 | flag_sets = [ |
| 4493 | flag_set( |
| 4494 | actions = [ |
| 4495 | ACTION_NAMES.c_compile, |
| 4496 | ACTION_NAMES.cpp_compile, |
| 4497 | ACTION_NAMES.cpp_module_codegen, |
| 4498 | ACTION_NAMES.assemble, |
| 4499 | ACTION_NAMES.preprocess_assemble, |
| 4500 | ], |
| 4501 | flag_groups = [ |
| 4502 | flag_group( |
| 4503 | flags = ["-gsplit-dwarf"], |
| 4504 | expand_if_available = "per_object_debug_info_file", |
| 4505 | ), |
| 4506 | ], |
| 4507 | ), |
| 4508 | ], |
| 4509 | ) |
| 4510 | |
| 4511 | lipo_feature = feature( |
| 4512 | name = "lipo", |
| 4513 | flag_sets = [ |
| 4514 | flag_set( |
| 4515 | actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], |
| 4516 | flag_groups = [flag_group(flags = ["-fripa"])], |
| 4517 | ), |
| 4518 | ], |
| 4519 | requires = [ |
| 4520 | feature_set(features = ["autofdo"]), |
| 4521 | feature_set(features = ["fdo_optimize"]), |
| 4522 | feature_set(features = ["fdo_instrument"]), |
| 4523 | ], |
| 4524 | ) |
| 4525 | |
| 4526 | apple_env_feature = feature( |
| 4527 | name = "apple_env", |
| 4528 | env_sets = [ |
| 4529 | env_set( |
| 4530 | actions = [ |
| 4531 | ACTION_NAMES.c_compile, |
| 4532 | ACTION_NAMES.cpp_compile, |
| 4533 | ACTION_NAMES.cpp_module_compile, |
| 4534 | ACTION_NAMES.cpp_header_parsing, |
| 4535 | ACTION_NAMES.assemble, |
| 4536 | ACTION_NAMES.preprocess_assemble, |
| 4537 | ACTION_NAMES.objc_compile, |
| 4538 | ACTION_NAMES.objcpp_compile, |
| 4539 | "objc-archive", |
| 4540 | "objc-fully-link", |
| 4541 | ACTION_NAMES.cpp_link_executable, |
| 4542 | ACTION_NAMES.cpp_link_dynamic_library, |
| 4543 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 4544 | ACTION_NAMES.cpp_link_static_library, |
| 4545 | "objc-executable", |
| 4546 | "objc++-executable", |
| 4547 | ACTION_NAMES.linkstamp_compile, |
| 4548 | ], |
| 4549 | env_entries = [ |
| 4550 | env_entry( |
| 4551 | key = "XCODE_VERSION_OVERRIDE", |
| 4552 | value = "%{xcode_version_override_value}", |
| 4553 | ), |
| 4554 | env_entry( |
| 4555 | key = "APPLE_SDK_VERSION_OVERRIDE", |
| 4556 | value = "%{apple_sdk_version_override_value}", |
| 4557 | ), |
| 4558 | env_entry( |
| 4559 | key = "APPLE_SDK_PLATFORM", |
| 4560 | value = "%{apple_sdk_platform_value}", |
| 4561 | ), |
Keith Smiley | 073ae81 | 2021-02-26 03:34:45 -0800 | [diff] [blame^] | 4562 | env_entry( |
| 4563 | key = "ZERO_AR_DATE", |
| 4564 | value = "1", |
| 4565 | ), |
Daniel Wagner-Hall | ec1ace4 | 2020-10-22 07:07:45 -0700 | [diff] [blame] | 4566 | ] + [env_entry(key = key, value = value) for key, value in ctx.attr.extra_env.items()], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4567 | ), |
| 4568 | ], |
| 4569 | ) |
| 4570 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 4571 | if (ctx.attr.cpu == "armeabi-v7a" or |
| 4572 | ctx.attr.cpu == "ios_arm64" or |
| 4573 | ctx.attr.cpu == "ios_arm64e" or |
| 4574 | ctx.attr.cpu == "ios_armv7" or |
| 4575 | ctx.attr.cpu == "ios_i386" or |
| 4576 | ctx.attr.cpu == "ios_x86_64" or |
| 4577 | ctx.attr.cpu == "tvos_arm64" or |
| 4578 | ctx.attr.cpu == "tvos_x86_64" or |
| 4579 | ctx.attr.cpu == "watchos_arm64_32" or |
| 4580 | ctx.attr.cpu == "watchos_armv7k" or |
| 4581 | ctx.attr.cpu == "watchos_i386" or |
| 4582 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4583 | apply_implicit_frameworks_feature = feature( |
| 4584 | name = "apply_implicit_frameworks", |
| 4585 | flag_sets = [ |
| 4586 | flag_set( |
| 4587 | actions = ["objc-executable", "objc++-executable"], |
| 4588 | flag_groups = [ |
| 4589 | flag_group( |
| 4590 | flags = ["-framework", "Foundation", "-framework", "UIKit"], |
| 4591 | ), |
| 4592 | ], |
| 4593 | ), |
| 4594 | ], |
| 4595 | ) |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 4596 | elif (ctx.attr.cpu == "darwin_x86_64" or |
| 4597 | ctx.attr.cpu == "darwin_arm64" or |
| 4598 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4599 | apply_implicit_frameworks_feature = feature( |
| 4600 | name = "apply_implicit_frameworks", |
| 4601 | flag_sets = [ |
| 4602 | flag_set( |
| 4603 | actions = ["objc-executable", "objc++-executable"], |
| 4604 | flag_groups = [flag_group(flags = ["-framework", "Foundation"])], |
| 4605 | with_features = [with_feature_set(not_features = ["kernel_extension"])], |
| 4606 | ), |
| 4607 | ], |
| 4608 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 4609 | else: |
| 4610 | apply_implicit_frameworks_feature = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4611 | |
| 4612 | dbg_feature = feature(name = "dbg") |
| 4613 | |
| 4614 | has_configured_linker_path_feature = feature(name = "has_configured_linker_path") |
| 4615 | |
| 4616 | random_seed_feature = feature( |
| 4617 | name = "random_seed", |
hlopko | 2f17a86 | 2019-02-26 07:56:03 -0800 | [diff] [blame] | 4618 | enabled = True, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4619 | flag_sets = [ |
| 4620 | flag_set( |
| 4621 | actions = [ |
| 4622 | ACTION_NAMES.c_compile, |
| 4623 | ACTION_NAMES.cpp_compile, |
| 4624 | ACTION_NAMES.cpp_module_codegen, |
| 4625 | ACTION_NAMES.cpp_module_compile, |
| 4626 | ], |
| 4627 | flag_groups = [ |
| 4628 | flag_group( |
| 4629 | flags = ["-frandom-seed=%{output_file}"], |
| 4630 | expand_if_available = "output_file", |
| 4631 | ), |
| 4632 | ], |
| 4633 | ), |
| 4634 | ], |
| 4635 | ) |
| 4636 | |
| 4637 | llvm_coverage_map_format_feature = feature( |
| 4638 | name = "llvm_coverage_map_format", |
| 4639 | flag_sets = [ |
| 4640 | flag_set( |
| 4641 | actions = [ |
| 4642 | ACTION_NAMES.preprocess_assemble, |
| 4643 | ACTION_NAMES.c_compile, |
| 4644 | ACTION_NAMES.cpp_compile, |
| 4645 | ACTION_NAMES.cpp_module_compile, |
| 4646 | ACTION_NAMES.objc_compile, |
| 4647 | ACTION_NAMES.objcpp_compile, |
| 4648 | ], |
| 4649 | flag_groups = [ |
| 4650 | flag_group( |
| 4651 | flags = ["-fprofile-instr-generate", "-fcoverage-mapping", "-g"], |
| 4652 | ), |
| 4653 | ], |
| 4654 | ), |
| 4655 | flag_set( |
| 4656 | actions = [ |
| 4657 | ACTION_NAMES.cpp_link_dynamic_library, |
| 4658 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 4659 | ACTION_NAMES.cpp_link_executable, |
| 4660 | "objc-executable", |
| 4661 | "objc++-executable", |
| 4662 | ], |
| 4663 | flag_groups = [flag_group(flags = ["-fprofile-instr-generate"])], |
| 4664 | ), |
| 4665 | ], |
| 4666 | requires = [feature_set(features = ["coverage"])], |
| 4667 | ) |
| 4668 | |
| 4669 | force_pic_flags_feature = feature( |
| 4670 | name = "force_pic_flags", |
| 4671 | flag_sets = [ |
| 4672 | flag_set( |
| 4673 | actions = [ACTION_NAMES.cpp_link_executable], |
| 4674 | flag_groups = [ |
| 4675 | flag_group( |
| 4676 | flags = ["-Wl,-pie"], |
| 4677 | expand_if_available = "force_pic", |
| 4678 | ), |
| 4679 | ], |
| 4680 | ), |
| 4681 | ], |
| 4682 | ) |
| 4683 | |
| 4684 | sysroot_feature = feature( |
| 4685 | name = "sysroot", |
| 4686 | flag_sets = [ |
| 4687 | flag_set( |
| 4688 | actions = [ |
| 4689 | ACTION_NAMES.assemble, |
| 4690 | ACTION_NAMES.preprocess_assemble, |
| 4691 | ACTION_NAMES.c_compile, |
| 4692 | ACTION_NAMES.cpp_compile, |
| 4693 | ACTION_NAMES.cpp_module_compile, |
| 4694 | ACTION_NAMES.objc_compile, |
| 4695 | ACTION_NAMES.objcpp_compile, |
| 4696 | ACTION_NAMES.cpp_header_parsing, |
| 4697 | ACTION_NAMES.cpp_link_executable, |
| 4698 | ACTION_NAMES.cpp_link_dynamic_library, |
| 4699 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 4700 | ACTION_NAMES.linkstamp_compile, |
| 4701 | ACTION_NAMES.clif_match, |
| 4702 | ], |
| 4703 | flag_groups = [ |
| 4704 | flag_group( |
| 4705 | flags = ["--sysroot=%{sysroot}"], |
| 4706 | expand_if_available = "sysroot", |
| 4707 | ), |
| 4708 | ], |
| 4709 | ), |
| 4710 | ], |
| 4711 | ) |
| 4712 | |
| 4713 | autofdo_feature = feature( |
| 4714 | name = "autofdo", |
| 4715 | flag_sets = [ |
| 4716 | flag_set( |
| 4717 | actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], |
| 4718 | flag_groups = [ |
| 4719 | flag_group( |
| 4720 | flags = [ |
| 4721 | "-fauto-profile=%{fdo_profile_path}", |
| 4722 | "-fprofile-correction", |
| 4723 | ], |
| 4724 | expand_if_available = "fdo_profile_path", |
| 4725 | ), |
| 4726 | ], |
| 4727 | ), |
| 4728 | ], |
| 4729 | provides = ["profile"], |
| 4730 | ) |
| 4731 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4732 | link_libcpp_feature = feature( |
| 4733 | name = "link_libc++", |
| 4734 | enabled = True, |
| 4735 | flag_sets = [ |
| 4736 | flag_set( |
| 4737 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 4738 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4739 | flag_groups = [flag_group(flags = ["-lc++"])], |
| 4740 | with_features = [with_feature_set(not_features = ["kernel_extension"])], |
| 4741 | ), |
| 4742 | ], |
| 4743 | ) |
| 4744 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4745 | objc_actions_feature = feature( |
| 4746 | name = "objc_actions", |
| 4747 | implies = [ |
| 4748 | "objc-compile", |
| 4749 | "objc++-compile", |
| 4750 | "objc-fully-link", |
| 4751 | "objc-archive", |
| 4752 | "objc-executable", |
| 4753 | "objc++-executable", |
| 4754 | "assemble", |
| 4755 | "preprocess-assemble", |
| 4756 | "c-compile", |
| 4757 | "c++-compile", |
| 4758 | "c++-link-static-library", |
| 4759 | "c++-link-dynamic-library", |
| 4760 | "c++-link-nodeps-dynamic-library", |
| 4761 | "c++-link-executable", |
| 4762 | ], |
| 4763 | ) |
| 4764 | |
hlopko | 2f17a86 | 2019-02-26 07:56:03 -0800 | [diff] [blame] | 4765 | module_maps_feature = feature(name = "module_maps", enabled = True) |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4766 | |
| 4767 | if (ctx.attr.cpu == "ios_arm64"): |
| 4768 | unfiltered_compile_flags_feature = feature( |
| 4769 | name = "unfiltered_compile_flags", |
| 4770 | flag_sets = [ |
| 4771 | flag_set( |
| 4772 | actions = [ |
| 4773 | ACTION_NAMES.assemble, |
| 4774 | ACTION_NAMES.preprocess_assemble, |
| 4775 | ACTION_NAMES.c_compile, |
| 4776 | ACTION_NAMES.cpp_compile, |
| 4777 | ACTION_NAMES.cpp_header_parsing, |
| 4778 | ACTION_NAMES.cpp_module_compile, |
| 4779 | ACTION_NAMES.cpp_module_codegen, |
| 4780 | ACTION_NAMES.linkstamp_compile, |
| 4781 | ], |
| 4782 | flag_groups = [ |
| 4783 | flag_group( |
| 4784 | flags = [ |
| 4785 | "-no-canonical-prefixes", |
| 4786 | "-Wno-builtin-macro-redefined", |
| 4787 | "-D__DATE__=\"redacted\"", |
| 4788 | "-D__TIMESTAMP__=\"redacted\"", |
| 4789 | "-D__TIME__=\"redacted\"", |
| 4790 | "-target", |
| 4791 | "arm64-apple-ios", |
| 4792 | ], |
| 4793 | ), |
| 4794 | ], |
| 4795 | ), |
| 4796 | ], |
| 4797 | ) |
| 4798 | elif (ctx.attr.cpu == "tvos_arm64"): |
| 4799 | unfiltered_compile_flags_feature = feature( |
| 4800 | name = "unfiltered_compile_flags", |
| 4801 | flag_sets = [ |
| 4802 | flag_set( |
| 4803 | actions = [ |
| 4804 | ACTION_NAMES.assemble, |
| 4805 | ACTION_NAMES.preprocess_assemble, |
| 4806 | ACTION_NAMES.c_compile, |
| 4807 | ACTION_NAMES.cpp_compile, |
| 4808 | ACTION_NAMES.cpp_header_parsing, |
| 4809 | ACTION_NAMES.cpp_module_compile, |
| 4810 | ACTION_NAMES.cpp_module_codegen, |
| 4811 | ACTION_NAMES.linkstamp_compile, |
| 4812 | ], |
| 4813 | flag_groups = [ |
| 4814 | flag_group( |
| 4815 | flags = [ |
| 4816 | "-no-canonical-prefixes", |
| 4817 | "-Wno-builtin-macro-redefined", |
| 4818 | "-D__DATE__=\"redacted\"", |
| 4819 | "-D__TIMESTAMP__=\"redacted\"", |
| 4820 | "-D__TIME__=\"redacted\"", |
| 4821 | "-target", |
| 4822 | "arm64-apple-tvos", |
| 4823 | ], |
| 4824 | ), |
| 4825 | ], |
| 4826 | ), |
| 4827 | ], |
| 4828 | ) |
| 4829 | elif (ctx.attr.cpu == "ios_arm64e"): |
| 4830 | unfiltered_compile_flags_feature = feature( |
| 4831 | name = "unfiltered_compile_flags", |
| 4832 | flag_sets = [ |
| 4833 | flag_set( |
| 4834 | actions = [ |
| 4835 | ACTION_NAMES.assemble, |
| 4836 | ACTION_NAMES.preprocess_assemble, |
| 4837 | ACTION_NAMES.c_compile, |
| 4838 | ACTION_NAMES.cpp_compile, |
| 4839 | ACTION_NAMES.cpp_header_parsing, |
| 4840 | ACTION_NAMES.cpp_module_compile, |
| 4841 | ACTION_NAMES.cpp_module_codegen, |
| 4842 | ACTION_NAMES.linkstamp_compile, |
| 4843 | ], |
| 4844 | flag_groups = [ |
| 4845 | flag_group( |
| 4846 | flags = [ |
| 4847 | "-no-canonical-prefixes", |
| 4848 | "-Wno-builtin-macro-redefined", |
| 4849 | "-D__DATE__=\"redacted\"", |
| 4850 | "-D__TIMESTAMP__=\"redacted\"", |
| 4851 | "-D__TIME__=\"redacted\"", |
| 4852 | "-target", |
| 4853 | "arm64e-apple-ios", |
| 4854 | ], |
| 4855 | ), |
| 4856 | ], |
| 4857 | ), |
| 4858 | ], |
| 4859 | ) |
Patrick Balestra | 65b6254 | 2020-05-27 13:51:52 -0700 | [diff] [blame] | 4860 | elif (ctx.attr.cpu == "watchos_arm64_32"): |
| 4861 | unfiltered_compile_flags_feature = feature( |
| 4862 | name = "unfiltered_compile_flags", |
| 4863 | flag_sets = [ |
| 4864 | flag_set( |
| 4865 | actions = [ |
| 4866 | ACTION_NAMES.assemble, |
| 4867 | ACTION_NAMES.preprocess_assemble, |
| 4868 | ACTION_NAMES.c_compile, |
| 4869 | ACTION_NAMES.cpp_compile, |
| 4870 | ACTION_NAMES.cpp_header_parsing, |
| 4871 | ACTION_NAMES.cpp_module_compile, |
| 4872 | ACTION_NAMES.cpp_module_codegen, |
| 4873 | ACTION_NAMES.linkstamp_compile, |
| 4874 | ], |
| 4875 | flag_groups = [ |
| 4876 | flag_group( |
| 4877 | flags = [ |
| 4878 | "-no-canonical-prefixes", |
| 4879 | "-Wno-builtin-macro-redefined", |
| 4880 | "-D__DATE__=\"redacted\"", |
| 4881 | "-D__TIMESTAMP__=\"redacted\"", |
| 4882 | "-D__TIME__=\"redacted\"", |
| 4883 | "-target", |
| 4884 | "arm64_32-apple-watchos", |
| 4885 | ], |
| 4886 | ), |
| 4887 | ], |
| 4888 | ), |
| 4889 | ], |
| 4890 | ) |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 4891 | elif (ctx.attr.cpu == "ios_armv7"): |
| 4892 | unfiltered_compile_flags_feature = feature( |
| 4893 | name = "unfiltered_compile_flags", |
| 4894 | flag_sets = [ |
| 4895 | flag_set( |
| 4896 | actions = [ |
| 4897 | ACTION_NAMES.assemble, |
| 4898 | ACTION_NAMES.preprocess_assemble, |
| 4899 | ACTION_NAMES.c_compile, |
| 4900 | ACTION_NAMES.cpp_compile, |
| 4901 | ACTION_NAMES.cpp_header_parsing, |
| 4902 | ACTION_NAMES.cpp_module_compile, |
| 4903 | ACTION_NAMES.cpp_module_codegen, |
| 4904 | ACTION_NAMES.linkstamp_compile, |
| 4905 | ], |
| 4906 | flag_groups = [ |
| 4907 | flag_group( |
| 4908 | flags = [ |
| 4909 | "-no-canonical-prefixes", |
| 4910 | "-Wno-builtin-macro-redefined", |
| 4911 | "-D__DATE__=\"redacted\"", |
| 4912 | "-D__TIMESTAMP__=\"redacted\"", |
| 4913 | "-D__TIME__=\"redacted\"", |
| 4914 | "-target", |
| 4915 | "armv7-apple-ios", |
| 4916 | ], |
| 4917 | ), |
| 4918 | ], |
| 4919 | ), |
| 4920 | ], |
| 4921 | ) |
| 4922 | elif (ctx.attr.cpu == "watchos_armv7k"): |
| 4923 | unfiltered_compile_flags_feature = feature( |
| 4924 | name = "unfiltered_compile_flags", |
| 4925 | flag_sets = [ |
| 4926 | flag_set( |
| 4927 | actions = [ |
| 4928 | ACTION_NAMES.assemble, |
| 4929 | ACTION_NAMES.preprocess_assemble, |
| 4930 | ACTION_NAMES.c_compile, |
| 4931 | ACTION_NAMES.cpp_compile, |
| 4932 | ACTION_NAMES.cpp_header_parsing, |
| 4933 | ACTION_NAMES.cpp_module_compile, |
| 4934 | ACTION_NAMES.cpp_module_codegen, |
| 4935 | ACTION_NAMES.linkstamp_compile, |
| 4936 | ], |
| 4937 | flag_groups = [ |
| 4938 | flag_group( |
| 4939 | flags = [ |
| 4940 | "-no-canonical-prefixes", |
| 4941 | "-Wno-builtin-macro-redefined", |
| 4942 | "-D__DATE__=\"redacted\"", |
| 4943 | "-D__TIMESTAMP__=\"redacted\"", |
| 4944 | "-D__TIME__=\"redacted\"", |
| 4945 | "-target", |
| 4946 | "armv7k-apple-watchos", |
| 4947 | ], |
| 4948 | ), |
| 4949 | ], |
| 4950 | ), |
| 4951 | ], |
| 4952 | ) |
| 4953 | elif (ctx.attr.cpu == "ios_i386"): |
| 4954 | unfiltered_compile_flags_feature = feature( |
| 4955 | name = "unfiltered_compile_flags", |
| 4956 | flag_sets = [ |
| 4957 | flag_set( |
| 4958 | actions = [ |
| 4959 | ACTION_NAMES.assemble, |
| 4960 | ACTION_NAMES.preprocess_assemble, |
| 4961 | ACTION_NAMES.c_compile, |
| 4962 | ACTION_NAMES.cpp_compile, |
| 4963 | ACTION_NAMES.cpp_header_parsing, |
| 4964 | ACTION_NAMES.cpp_module_compile, |
| 4965 | ACTION_NAMES.cpp_module_codegen, |
| 4966 | ACTION_NAMES.linkstamp_compile, |
| 4967 | ], |
| 4968 | flag_groups = [ |
| 4969 | flag_group( |
| 4970 | flags = [ |
| 4971 | "-no-canonical-prefixes", |
| 4972 | "-Wno-builtin-macro-redefined", |
| 4973 | "-D__DATE__=\"redacted\"", |
| 4974 | "-D__TIMESTAMP__=\"redacted\"", |
| 4975 | "-D__TIME__=\"redacted\"", |
| 4976 | "-target", |
| 4977 | "i386-apple-ios", |
| 4978 | ], |
| 4979 | ), |
| 4980 | ], |
| 4981 | ), |
| 4982 | ], |
| 4983 | ) |
| 4984 | elif (ctx.attr.cpu == "watchos_i386"): |
| 4985 | unfiltered_compile_flags_feature = feature( |
| 4986 | name = "unfiltered_compile_flags", |
| 4987 | flag_sets = [ |
| 4988 | flag_set( |
| 4989 | actions = [ |
| 4990 | ACTION_NAMES.assemble, |
| 4991 | ACTION_NAMES.preprocess_assemble, |
| 4992 | ACTION_NAMES.c_compile, |
| 4993 | ACTION_NAMES.cpp_compile, |
| 4994 | ACTION_NAMES.cpp_header_parsing, |
| 4995 | ACTION_NAMES.cpp_module_compile, |
| 4996 | ACTION_NAMES.cpp_module_codegen, |
| 4997 | ACTION_NAMES.linkstamp_compile, |
| 4998 | ], |
| 4999 | flag_groups = [ |
| 5000 | flag_group( |
| 5001 | flags = [ |
| 5002 | "-no-canonical-prefixes", |
| 5003 | "-Wno-builtin-macro-redefined", |
| 5004 | "-D__DATE__=\"redacted\"", |
| 5005 | "-D__TIMESTAMP__=\"redacted\"", |
| 5006 | "-D__TIME__=\"redacted\"", |
| 5007 | "-target", |
| 5008 | "i386-apple-watchos", |
| 5009 | ], |
| 5010 | ), |
| 5011 | ], |
| 5012 | ), |
| 5013 | ], |
| 5014 | ) |
| 5015 | elif (ctx.attr.cpu == "ios_x86_64"): |
| 5016 | unfiltered_compile_flags_feature = feature( |
| 5017 | name = "unfiltered_compile_flags", |
| 5018 | flag_sets = [ |
| 5019 | flag_set( |
| 5020 | actions = [ |
| 5021 | ACTION_NAMES.assemble, |
| 5022 | ACTION_NAMES.preprocess_assemble, |
| 5023 | ACTION_NAMES.c_compile, |
| 5024 | ACTION_NAMES.cpp_compile, |
| 5025 | ACTION_NAMES.cpp_header_parsing, |
| 5026 | ACTION_NAMES.cpp_module_compile, |
| 5027 | ACTION_NAMES.cpp_module_codegen, |
| 5028 | ACTION_NAMES.linkstamp_compile, |
| 5029 | ], |
| 5030 | flag_groups = [ |
| 5031 | flag_group( |
| 5032 | flags = [ |
| 5033 | "-no-canonical-prefixes", |
| 5034 | "-Wno-builtin-macro-redefined", |
| 5035 | "-D__DATE__=\"redacted\"", |
| 5036 | "-D__TIMESTAMP__=\"redacted\"", |
| 5037 | "-D__TIME__=\"redacted\"", |
| 5038 | "-target", |
| 5039 | "x86_64-apple-ios", |
| 5040 | ], |
| 5041 | ), |
| 5042 | ], |
| 5043 | ), |
| 5044 | ], |
| 5045 | ) |
| 5046 | elif (ctx.attr.cpu == "tvos_x86_64"): |
| 5047 | unfiltered_compile_flags_feature = feature( |
| 5048 | name = "unfiltered_compile_flags", |
| 5049 | flag_sets = [ |
| 5050 | flag_set( |
| 5051 | actions = [ |
| 5052 | ACTION_NAMES.assemble, |
| 5053 | ACTION_NAMES.preprocess_assemble, |
| 5054 | ACTION_NAMES.c_compile, |
| 5055 | ACTION_NAMES.cpp_compile, |
| 5056 | ACTION_NAMES.cpp_header_parsing, |
| 5057 | ACTION_NAMES.cpp_module_compile, |
| 5058 | ACTION_NAMES.cpp_module_codegen, |
| 5059 | ACTION_NAMES.linkstamp_compile, |
| 5060 | ], |
| 5061 | flag_groups = [ |
| 5062 | flag_group( |
| 5063 | flags = [ |
| 5064 | "-no-canonical-prefixes", |
| 5065 | "-Wno-builtin-macro-redefined", |
| 5066 | "-D__DATE__=\"redacted\"", |
| 5067 | "-D__TIMESTAMP__=\"redacted\"", |
| 5068 | "-D__TIME__=\"redacted\"", |
| 5069 | "-target", |
| 5070 | "x86_64-apple-tvos", |
| 5071 | ], |
| 5072 | ), |
| 5073 | ], |
| 5074 | ), |
| 5075 | ], |
| 5076 | ) |
Patrick Balestra | 65b6254 | 2020-05-27 13:51:52 -0700 | [diff] [blame] | 5077 | elif (ctx.attr.cpu == "watchos_x86_64"): |
| 5078 | unfiltered_compile_flags_feature = feature( |
| 5079 | name = "unfiltered_compile_flags", |
| 5080 | flag_sets = [ |
| 5081 | flag_set( |
| 5082 | actions = [ |
| 5083 | ACTION_NAMES.assemble, |
| 5084 | ACTION_NAMES.preprocess_assemble, |
| 5085 | ACTION_NAMES.c_compile, |
| 5086 | ACTION_NAMES.cpp_compile, |
| 5087 | ACTION_NAMES.cpp_header_parsing, |
| 5088 | ACTION_NAMES.cpp_module_compile, |
| 5089 | ACTION_NAMES.cpp_module_codegen, |
| 5090 | ACTION_NAMES.linkstamp_compile, |
| 5091 | ], |
| 5092 | flag_groups = [ |
| 5093 | flag_group( |
| 5094 | flags = [ |
| 5095 | "-no-canonical-prefixes", |
| 5096 | "-Wno-builtin-macro-redefined", |
| 5097 | "-D__DATE__=\"redacted\"", |
| 5098 | "-D__TIMESTAMP__=\"redacted\"", |
| 5099 | "-D__TIME__=\"redacted\"", |
| 5100 | "-target", |
| 5101 | "x86_64-apple-watchos", |
| 5102 | ], |
| 5103 | ), |
| 5104 | ], |
| 5105 | ), |
| 5106 | ], |
| 5107 | ) |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 5108 | elif (ctx.attr.cpu == "darwin_arm64"): |
| 5109 | unfiltered_compile_flags_feature = feature( |
| 5110 | name = "unfiltered_compile_flags", |
| 5111 | flag_sets = [ |
| 5112 | flag_set( |
| 5113 | actions = [ |
| 5114 | ACTION_NAMES.assemble, |
| 5115 | ACTION_NAMES.preprocess_assemble, |
| 5116 | ACTION_NAMES.c_compile, |
| 5117 | ACTION_NAMES.cpp_compile, |
| 5118 | ACTION_NAMES.cpp_header_parsing, |
| 5119 | ACTION_NAMES.cpp_module_compile, |
| 5120 | ACTION_NAMES.cpp_module_codegen, |
| 5121 | ACTION_NAMES.linkstamp_compile, |
| 5122 | ], |
| 5123 | flag_groups = [ |
| 5124 | flag_group( |
| 5125 | flags = [ |
| 5126 | "-no-canonical-prefixes", |
| 5127 | "-Wno-builtin-macro-redefined", |
| 5128 | "-D__DATE__=\"redacted\"", |
| 5129 | "-D__TIMESTAMP__=\"redacted\"", |
| 5130 | "-D__TIME__=\"redacted\"", |
| 5131 | "-target", |
| 5132 | "arm64-apple-macosx", |
| 5133 | ], |
| 5134 | ), |
| 5135 | ], |
| 5136 | ), |
| 5137 | ], |
| 5138 | ) |
| 5139 | elif (ctx.attr.cpu == "darwin_arm64e"): |
| 5140 | unfiltered_compile_flags_feature = feature( |
| 5141 | name = "unfiltered_compile_flags", |
| 5142 | flag_sets = [ |
| 5143 | flag_set( |
| 5144 | actions = [ |
| 5145 | ACTION_NAMES.assemble, |
| 5146 | ACTION_NAMES.preprocess_assemble, |
| 5147 | ACTION_NAMES.c_compile, |
| 5148 | ACTION_NAMES.cpp_compile, |
| 5149 | ACTION_NAMES.cpp_header_parsing, |
| 5150 | ACTION_NAMES.cpp_module_compile, |
| 5151 | ACTION_NAMES.cpp_module_codegen, |
| 5152 | ACTION_NAMES.linkstamp_compile, |
| 5153 | ], |
| 5154 | flag_groups = [ |
| 5155 | flag_group( |
| 5156 | flags = [ |
| 5157 | "-no-canonical-prefixes", |
| 5158 | "-Wno-builtin-macro-redefined", |
| 5159 | "-D__DATE__=\"redacted\"", |
| 5160 | "-D__TIMESTAMP__=\"redacted\"", |
| 5161 | "-D__TIME__=\"redacted\"", |
| 5162 | "-target", |
| 5163 | "arm64e-apple-macosx", |
| 5164 | ], |
| 5165 | ), |
| 5166 | ], |
| 5167 | ), |
| 5168 | ], |
| 5169 | ) |
Yun Peng | 8c7e11a | 2021-01-27 03:23:12 -0800 | [diff] [blame] | 5170 | elif (ctx.attr.cpu == "darwin_x86_64"): |
| 5171 | unfiltered_compile_flags_feature = feature( |
| 5172 | name = "unfiltered_compile_flags", |
| 5173 | flag_sets = [ |
| 5174 | flag_set( |
| 5175 | actions = [ |
| 5176 | ACTION_NAMES.assemble, |
| 5177 | ACTION_NAMES.preprocess_assemble, |
| 5178 | ACTION_NAMES.c_compile, |
| 5179 | ACTION_NAMES.cpp_compile, |
| 5180 | ACTION_NAMES.cpp_header_parsing, |
| 5181 | ACTION_NAMES.cpp_module_compile, |
| 5182 | ACTION_NAMES.cpp_module_codegen, |
| 5183 | ACTION_NAMES.linkstamp_compile, |
| 5184 | ], |
| 5185 | flag_groups = [ |
| 5186 | flag_group( |
| 5187 | flags = [ |
| 5188 | "-no-canonical-prefixes", |
| 5189 | "-Wno-builtin-macro-redefined", |
| 5190 | "-D__DATE__=\"redacted\"", |
| 5191 | "-D__TIMESTAMP__=\"redacted\"", |
| 5192 | "-D__TIME__=\"redacted\"", |
| 5193 | "-target", |
| 5194 | "x86_64-apple-macosx", |
| 5195 | ], |
| 5196 | ), |
| 5197 | ], |
| 5198 | ), |
| 5199 | ], |
| 5200 | ) |
| 5201 | elif (ctx.attr.cpu == "armeabi-v7a"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5202 | unfiltered_compile_flags_feature = feature( |
| 5203 | name = "unfiltered_compile_flags", |
| 5204 | flag_sets = [ |
| 5205 | flag_set( |
| 5206 | actions = [ |
| 5207 | ACTION_NAMES.assemble, |
| 5208 | ACTION_NAMES.preprocess_assemble, |
| 5209 | ACTION_NAMES.c_compile, |
| 5210 | ACTION_NAMES.cpp_compile, |
| 5211 | ACTION_NAMES.cpp_header_parsing, |
| 5212 | ACTION_NAMES.cpp_module_compile, |
| 5213 | ACTION_NAMES.cpp_module_codegen, |
| 5214 | ACTION_NAMES.linkstamp_compile, |
| 5215 | ], |
| 5216 | flag_groups = [ |
| 5217 | flag_group( |
| 5218 | flags = [ |
| 5219 | "-no-canonical-prefixes", |
| 5220 | "-Wno-builtin-macro-redefined", |
| 5221 | "-D__DATE__=\"redacted\"", |
| 5222 | "-D__TIMESTAMP__=\"redacted\"", |
| 5223 | "-D__TIME__=\"redacted\"", |
| 5224 | ], |
| 5225 | ), |
| 5226 | ], |
| 5227 | ), |
| 5228 | ], |
| 5229 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5230 | else: |
| 5231 | unfiltered_compile_flags_feature = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5232 | |
| 5233 | linker_param_file_feature = feature( |
| 5234 | name = "linker_param_file", |
| 5235 | flag_sets = [ |
| 5236 | flag_set( |
Keith Smiley | f08819b | 2020-11-12 03:13:54 -0800 | [diff] [blame] | 5237 | actions = all_link_actions + [ |
| 5238 | ACTION_NAMES.cpp_link_static_library, |
| 5239 | ACTION_NAMES.objc_archive, |
| 5240 | ACTION_NAMES.objc_fully_link, |
| 5241 | ACTION_NAMES.objc_executable, |
| 5242 | ACTION_NAMES.objcpp_executable, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5243 | ], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5244 | flag_groups = [ |
| 5245 | flag_group( |
| 5246 | flags = ["@%{linker_param_file}"], |
| 5247 | expand_if_available = "linker_param_file", |
| 5248 | ), |
| 5249 | ], |
| 5250 | ), |
| 5251 | ], |
| 5252 | ) |
| 5253 | |
Keith Smiley | 3d6d0c9 | 2020-10-22 05:18:51 -0700 | [diff] [blame] | 5254 | relative_ast_path_feature = feature( |
| 5255 | name = "relative_ast_path", |
| 5256 | env_sets = [ |
| 5257 | env_set( |
| 5258 | actions = all_link_actions + [ |
| 5259 | ACTION_NAMES.objc_executable, |
| 5260 | ACTION_NAMES.objcpp_executable, |
| 5261 | ], |
| 5262 | env_entries = [ |
| 5263 | env_entry( |
| 5264 | key = "RELATIVE_AST_PATH", |
| 5265 | value = "true", |
| 5266 | ), |
| 5267 | ], |
| 5268 | ), |
| 5269 | ], |
| 5270 | ) |
| 5271 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5272 | archiver_flags_feature = feature( |
| 5273 | name = "archiver_flags", |
| 5274 | flag_sets = [ |
| 5275 | flag_set( |
| 5276 | actions = [ACTION_NAMES.cpp_link_static_library], |
| 5277 | flag_groups = [ |
| 5278 | flag_group( |
Thi Doan | d483d6f | 2020-08-17 13:27:22 -0700 | [diff] [blame] | 5279 | flags = _deterministic_libtool_flags(ctx) + [ |
| 5280 | "-no_warning_for_no_symbols", |
| 5281 | "-static", |
| 5282 | "-o", |
| 5283 | "%{output_execpath}", |
| 5284 | ], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5285 | expand_if_available = "output_execpath", |
| 5286 | ), |
| 5287 | ], |
| 5288 | ), |
| 5289 | ], |
| 5290 | ) |
| 5291 | |
| 5292 | fdo_optimize_feature = feature( |
| 5293 | name = "fdo_optimize", |
| 5294 | flag_sets = [ |
| 5295 | flag_set( |
| 5296 | actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], |
| 5297 | flag_groups = [ |
| 5298 | flag_group( |
| 5299 | flags = [ |
| 5300 | "-fprofile-use=%{fdo_profile_path}", |
Googler | a5b1693 | 2020-04-13 13:06:59 -0700 | [diff] [blame] | 5301 | "-Wno-profile-instr-unprofiled", |
| 5302 | "-Wno-profile-instr-out-of-date", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5303 | "-fprofile-correction", |
| 5304 | ], |
| 5305 | expand_if_available = "fdo_profile_path", |
| 5306 | ), |
| 5307 | ], |
| 5308 | ), |
| 5309 | ], |
| 5310 | provides = ["profile"], |
| 5311 | ) |
| 5312 | |
| 5313 | no_objc_arc_feature = feature( |
| 5314 | name = "no_objc_arc", |
| 5315 | flag_sets = [ |
| 5316 | flag_set( |
| 5317 | actions = [ |
| 5318 | ACTION_NAMES.c_compile, |
| 5319 | ACTION_NAMES.cpp_compile, |
| 5320 | ACTION_NAMES.cpp_module_compile, |
| 5321 | ACTION_NAMES.cpp_header_parsing, |
| 5322 | ACTION_NAMES.assemble, |
| 5323 | ACTION_NAMES.preprocess_assemble, |
| 5324 | ACTION_NAMES.objc_compile, |
| 5325 | ACTION_NAMES.objcpp_compile, |
| 5326 | ], |
| 5327 | flag_groups = [ |
| 5328 | flag_group( |
| 5329 | flags = ["-fno-objc-arc"], |
| 5330 | expand_if_available = "no_objc_arc", |
| 5331 | ), |
| 5332 | ], |
| 5333 | ), |
| 5334 | ], |
| 5335 | ) |
| 5336 | |
| 5337 | if (ctx.attr.cpu == "tvos_arm64"): |
| 5338 | cpp_linker_flags_feature = feature( |
| 5339 | name = "cpp_linker_flags", |
| 5340 | flag_sets = [ |
| 5341 | flag_set( |
| 5342 | actions = [ |
| 5343 | ACTION_NAMES.cpp_link_executable, |
| 5344 | ACTION_NAMES.cpp_link_dynamic_library, |
| 5345 | ], |
| 5346 | flag_groups = [ |
| 5347 | flag_group( |
| 5348 | flags = ["-lc++", "-target", "arm64-apple-tvos"], |
| 5349 | ), |
| 5350 | ], |
| 5351 | ), |
| 5352 | ], |
| 5353 | ) |
| 5354 | elif (ctx.attr.cpu == "tvos_x86_64"): |
| 5355 | cpp_linker_flags_feature = feature( |
| 5356 | name = "cpp_linker_flags", |
| 5357 | flag_sets = [ |
| 5358 | flag_set( |
| 5359 | actions = [ |
| 5360 | ACTION_NAMES.cpp_link_executable, |
| 5361 | ACTION_NAMES.cpp_link_dynamic_library, |
| 5362 | ], |
| 5363 | flag_groups = [ |
| 5364 | flag_group( |
| 5365 | flags = ["-lc++", "-target", "x86_64-apple-tvos"], |
| 5366 | ), |
| 5367 | ], |
| 5368 | ), |
| 5369 | ], |
| 5370 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5371 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 5372 | ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 5373 | ctx.attr.cpu == "darwin_arm64" or |
| 5374 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5375 | ctx.attr.cpu == "ios_arm64" or |
| 5376 | ctx.attr.cpu == "ios_arm64e" or |
| 5377 | ctx.attr.cpu == "ios_armv7" or |
| 5378 | ctx.attr.cpu == "ios_i386" or |
| 5379 | ctx.attr.cpu == "ios_x86_64" or |
| 5380 | ctx.attr.cpu == "watchos_arm64_32" or |
| 5381 | ctx.attr.cpu == "watchos_armv7k" or |
| 5382 | ctx.attr.cpu == "watchos_i386" or |
| 5383 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5384 | cpp_linker_flags_feature = feature(name = "cpp_linker_flags") |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5385 | else: |
| 5386 | cpp_linker_flags_feature = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5387 | |
| 5388 | exclude_private_headers_in_module_maps_feature = feature(name = "exclude_private_headers_in_module_maps") |
| 5389 | |
| 5390 | debug_prefix_map_pwd_is_dot_feature = feature( |
| 5391 | name = "debug_prefix_map_pwd_is_dot", |
Keith Smiley | e794ee6 | 2020-10-28 02:28:18 -0700 | [diff] [blame] | 5392 | enabled = True, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5393 | flag_sets = [ |
| 5394 | flag_set( |
| 5395 | actions = [ |
| 5396 | ACTION_NAMES.assemble, |
| 5397 | ACTION_NAMES.preprocess_assemble, |
| 5398 | ACTION_NAMES.c_compile, |
| 5399 | ACTION_NAMES.cpp_compile, |
| 5400 | ACTION_NAMES.cpp_header_parsing, |
| 5401 | ACTION_NAMES.cpp_module_compile, |
| 5402 | ACTION_NAMES.cpp_module_codegen, |
| 5403 | ACTION_NAMES.linkstamp_compile, |
| 5404 | ACTION_NAMES.objc_compile, |
| 5405 | ACTION_NAMES.objcpp_compile, |
| 5406 | ], |
Keith Smiley | 58bb42a | 2021-02-02 02:44:04 -0800 | [diff] [blame] | 5407 | flag_groups = [flag_group(flags = ["DEBUG_PREFIX_MAP_PWD=."])], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5408 | ), |
| 5409 | ], |
| 5410 | ) |
| 5411 | |
Keith Smiley | bc5883a | 2020-10-21 08:06:11 -0700 | [diff] [blame] | 5412 | remap_xcode_path_feature = feature( |
| 5413 | name = "remap_xcode_path", |
| 5414 | flag_sets = [ |
| 5415 | flag_set( |
| 5416 | actions = [ |
| 5417 | ACTION_NAMES.assemble, |
| 5418 | ACTION_NAMES.preprocess_assemble, |
| 5419 | ACTION_NAMES.c_compile, |
| 5420 | ACTION_NAMES.cpp_compile, |
| 5421 | ACTION_NAMES.cpp_header_parsing, |
| 5422 | ACTION_NAMES.cpp_module_compile, |
| 5423 | ACTION_NAMES.cpp_module_codegen, |
| 5424 | ACTION_NAMES.linkstamp_compile, |
| 5425 | ACTION_NAMES.objc_compile, |
| 5426 | ACTION_NAMES.objcpp_compile, |
| 5427 | ], |
| 5428 | flag_groups = [flag_group(flags = [ |
| 5429 | "-fdebug-prefix-map=__BAZEL_XCODE_DEVELOPER_DIR__=DEVELOPER_DIR", |
| 5430 | ])], |
| 5431 | ), |
| 5432 | ], |
| 5433 | ) |
| 5434 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5435 | linkstamps_feature = feature( |
| 5436 | name = "linkstamps", |
| 5437 | flag_sets = [ |
| 5438 | flag_set( |
| 5439 | actions = all_link_actions, |
| 5440 | flag_groups = [ |
| 5441 | flag_group( |
| 5442 | flags = ["%{linkstamp_paths}"], |
| 5443 | iterate_over = "linkstamp_paths", |
| 5444 | expand_if_available = "linkstamp_paths", |
| 5445 | ), |
| 5446 | ], |
| 5447 | ), |
| 5448 | ], |
| 5449 | ) |
| 5450 | |
| 5451 | include_paths_feature = feature( |
| 5452 | name = "include_paths", |
hlopko | 2f17a86 | 2019-02-26 07:56:03 -0800 | [diff] [blame] | 5453 | enabled = True, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5454 | flag_sets = [ |
| 5455 | flag_set( |
| 5456 | actions = [ |
| 5457 | ACTION_NAMES.preprocess_assemble, |
| 5458 | ACTION_NAMES.c_compile, |
| 5459 | ACTION_NAMES.cpp_compile, |
| 5460 | ACTION_NAMES.cpp_header_parsing, |
| 5461 | ACTION_NAMES.cpp_module_compile, |
| 5462 | ACTION_NAMES.linkstamp_compile, |
| 5463 | ACTION_NAMES.clif_match, |
| 5464 | ACTION_NAMES.objc_compile, |
| 5465 | ACTION_NAMES.objcpp_compile, |
| 5466 | ], |
| 5467 | flag_groups = [ |
| 5468 | flag_group( |
| 5469 | flags = ["-iquote", "%{quote_include_paths}"], |
| 5470 | iterate_over = "quote_include_paths", |
| 5471 | ), |
| 5472 | flag_group( |
| 5473 | flags = ["-I%{include_paths}"], |
| 5474 | iterate_over = "include_paths", |
| 5475 | ), |
| 5476 | flag_group( |
| 5477 | flags = ["-isystem", "%{system_include_paths}"], |
| 5478 | iterate_over = "system_include_paths", |
| 5479 | ), |
| 5480 | ], |
| 5481 | ), |
| 5482 | ], |
| 5483 | ) |
| 5484 | |
| 5485 | only_doth_headers_in_module_maps_feature = feature(name = "only_doth_headers_in_module_maps") |
| 5486 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5487 | if (ctx.attr.cpu == "armeabi-v7a" or |
| 5488 | ctx.attr.cpu == "ios_arm64e" or |
| 5489 | ctx.attr.cpu == "tvos_arm64" or |
| 5490 | ctx.attr.cpu == "tvos_x86_64" or |
| 5491 | ctx.attr.cpu == "watchos_arm64_32" or |
| 5492 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5493 | default_compile_flags_feature = feature( |
| 5494 | name = "default_compile_flags", |
| 5495 | enabled = True, |
| 5496 | flag_sets = [ |
| 5497 | flag_set( |
| 5498 | actions = [ |
| 5499 | ACTION_NAMES.assemble, |
| 5500 | ACTION_NAMES.preprocess_assemble, |
| 5501 | ACTION_NAMES.linkstamp_compile, |
| 5502 | ACTION_NAMES.c_compile, |
| 5503 | ACTION_NAMES.cpp_compile, |
| 5504 | ACTION_NAMES.cpp_header_parsing, |
| 5505 | ACTION_NAMES.cpp_module_compile, |
| 5506 | ACTION_NAMES.cpp_module_codegen, |
| 5507 | ACTION_NAMES.lto_backend, |
| 5508 | ACTION_NAMES.clif_match, |
| 5509 | ACTION_NAMES.objc_compile, |
| 5510 | ACTION_NAMES.objcpp_compile, |
| 5511 | ], |
| 5512 | flag_groups = [ |
| 5513 | flag_group( |
| 5514 | flags = [ |
| 5515 | "-D_FORTIFY_SOURCE=1", |
Keith Smiley | 8959dff | 2021-01-18 21:08:43 -0800 | [diff] [blame] | 5516 | ], |
| 5517 | ), |
| 5518 | ], |
| 5519 | with_features = [with_feature_set(not_features = ["asan"])], |
| 5520 | ), |
| 5521 | flag_set( |
| 5522 | actions = [ |
| 5523 | ACTION_NAMES.assemble, |
| 5524 | ACTION_NAMES.preprocess_assemble, |
| 5525 | ACTION_NAMES.linkstamp_compile, |
| 5526 | ACTION_NAMES.c_compile, |
| 5527 | ACTION_NAMES.cpp_compile, |
| 5528 | ACTION_NAMES.cpp_header_parsing, |
| 5529 | ACTION_NAMES.cpp_module_compile, |
| 5530 | ACTION_NAMES.cpp_module_codegen, |
| 5531 | ACTION_NAMES.lto_backend, |
| 5532 | ACTION_NAMES.clif_match, |
| 5533 | ACTION_NAMES.objc_compile, |
| 5534 | ACTION_NAMES.objcpp_compile, |
| 5535 | ], |
| 5536 | flag_groups = [ |
| 5537 | flag_group( |
| 5538 | flags = [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5539 | "-fstack-protector", |
| 5540 | "-fcolor-diagnostics", |
| 5541 | "-Wall", |
| 5542 | "-Wthread-safety", |
| 5543 | "-Wself-assign", |
| 5544 | "-fno-omit-frame-pointer", |
| 5545 | ], |
| 5546 | ), |
| 5547 | ], |
| 5548 | ), |
| 5549 | flag_set( |
| 5550 | actions = [ |
| 5551 | ACTION_NAMES.assemble, |
| 5552 | ACTION_NAMES.preprocess_assemble, |
| 5553 | ACTION_NAMES.linkstamp_compile, |
| 5554 | ACTION_NAMES.c_compile, |
| 5555 | ACTION_NAMES.cpp_compile, |
| 5556 | ACTION_NAMES.cpp_header_parsing, |
| 5557 | ACTION_NAMES.cpp_module_compile, |
| 5558 | ACTION_NAMES.cpp_module_codegen, |
| 5559 | ACTION_NAMES.lto_backend, |
| 5560 | ACTION_NAMES.clif_match, |
| 5561 | ACTION_NAMES.objc_compile, |
| 5562 | ACTION_NAMES.objcpp_compile, |
| 5563 | ], |
| 5564 | flag_groups = [flag_group(flags = ["-O0", "-DDEBUG"])], |
| 5565 | with_features = [with_feature_set(features = ["fastbuild"])], |
| 5566 | ), |
| 5567 | flag_set( |
| 5568 | actions = [ |
| 5569 | ACTION_NAMES.assemble, |
| 5570 | ACTION_NAMES.preprocess_assemble, |
| 5571 | ACTION_NAMES.linkstamp_compile, |
| 5572 | ACTION_NAMES.c_compile, |
| 5573 | ACTION_NAMES.cpp_compile, |
| 5574 | ACTION_NAMES.cpp_header_parsing, |
| 5575 | ACTION_NAMES.cpp_module_compile, |
| 5576 | ACTION_NAMES.cpp_module_codegen, |
| 5577 | ACTION_NAMES.lto_backend, |
| 5578 | ACTION_NAMES.clif_match, |
| 5579 | ACTION_NAMES.objc_compile, |
| 5580 | ACTION_NAMES.objcpp_compile, |
| 5581 | ], |
| 5582 | flag_groups = [ |
| 5583 | flag_group( |
| 5584 | flags = [ |
| 5585 | "-g0", |
| 5586 | "-O2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5587 | "-DNDEBUG", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5588 | "-DNS_BLOCK_ASSERTIONS=1", |
| 5589 | ], |
| 5590 | ), |
| 5591 | ], |
| 5592 | with_features = [with_feature_set(features = ["opt"])], |
| 5593 | ), |
| 5594 | flag_set( |
| 5595 | actions = [ |
| 5596 | ACTION_NAMES.assemble, |
| 5597 | ACTION_NAMES.preprocess_assemble, |
| 5598 | ACTION_NAMES.linkstamp_compile, |
| 5599 | ACTION_NAMES.c_compile, |
| 5600 | ACTION_NAMES.cpp_compile, |
| 5601 | ACTION_NAMES.cpp_header_parsing, |
| 5602 | ACTION_NAMES.cpp_module_compile, |
| 5603 | ACTION_NAMES.cpp_module_codegen, |
| 5604 | ACTION_NAMES.lto_backend, |
| 5605 | ACTION_NAMES.clif_match, |
| 5606 | ACTION_NAMES.objc_compile, |
| 5607 | ACTION_NAMES.objcpp_compile, |
| 5608 | ], |
| 5609 | flag_groups = [flag_group(flags = ["-g"])], |
| 5610 | with_features = [with_feature_set(features = ["dbg"])], |
| 5611 | ), |
| 5612 | flag_set( |
| 5613 | actions = [ |
| 5614 | ACTION_NAMES.linkstamp_compile, |
| 5615 | ACTION_NAMES.cpp_compile, |
| 5616 | ACTION_NAMES.cpp_header_parsing, |
| 5617 | ACTION_NAMES.cpp_module_compile, |
| 5618 | ACTION_NAMES.cpp_module_codegen, |
| 5619 | ACTION_NAMES.lto_backend, |
| 5620 | ACTION_NAMES.clif_match, |
| 5621 | ], |
| 5622 | flag_groups = [flag_group(flags = ["-std=c++11"])], |
| 5623 | ), |
| 5624 | ], |
| 5625 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5626 | elif (ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 5627 | ctx.attr.cpu == "darwin_arm64" or |
| 5628 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5629 | ctx.attr.cpu == "ios_arm64" or |
| 5630 | ctx.attr.cpu == "ios_armv7" or |
| 5631 | ctx.attr.cpu == "ios_i386" or |
| 5632 | ctx.attr.cpu == "ios_x86_64" or |
| 5633 | ctx.attr.cpu == "watchos_armv7k" or |
| 5634 | ctx.attr.cpu == "watchos_i386"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5635 | default_compile_flags_feature = feature( |
| 5636 | name = "default_compile_flags", |
| 5637 | enabled = True, |
| 5638 | flag_sets = [ |
| 5639 | flag_set( |
| 5640 | actions = [ |
| 5641 | ACTION_NAMES.assemble, |
| 5642 | ACTION_NAMES.preprocess_assemble, |
| 5643 | ACTION_NAMES.linkstamp_compile, |
| 5644 | ACTION_NAMES.c_compile, |
| 5645 | ACTION_NAMES.cpp_compile, |
| 5646 | ACTION_NAMES.cpp_header_parsing, |
| 5647 | ACTION_NAMES.cpp_module_compile, |
| 5648 | ACTION_NAMES.cpp_module_codegen, |
| 5649 | ACTION_NAMES.lto_backend, |
| 5650 | ACTION_NAMES.clif_match, |
| 5651 | ACTION_NAMES.objc_compile, |
| 5652 | ACTION_NAMES.objcpp_compile, |
| 5653 | ], |
| 5654 | flag_groups = [ |
| 5655 | flag_group( |
| 5656 | flags = [ |
| 5657 | "-D_FORTIFY_SOURCE=1", |
Keith Smiley | 8959dff | 2021-01-18 21:08:43 -0800 | [diff] [blame] | 5658 | ], |
| 5659 | ), |
| 5660 | ], |
| 5661 | with_features = [with_feature_set(not_features = ["asan"])], |
| 5662 | ), |
| 5663 | flag_set( |
| 5664 | actions = [ |
| 5665 | ACTION_NAMES.assemble, |
| 5666 | ACTION_NAMES.preprocess_assemble, |
| 5667 | ACTION_NAMES.linkstamp_compile, |
| 5668 | ACTION_NAMES.c_compile, |
| 5669 | ACTION_NAMES.cpp_compile, |
| 5670 | ACTION_NAMES.cpp_header_parsing, |
| 5671 | ACTION_NAMES.cpp_module_compile, |
| 5672 | ACTION_NAMES.cpp_module_codegen, |
| 5673 | ACTION_NAMES.lto_backend, |
| 5674 | ACTION_NAMES.clif_match, |
| 5675 | ACTION_NAMES.objc_compile, |
| 5676 | ACTION_NAMES.objcpp_compile, |
| 5677 | ], |
| 5678 | flag_groups = [ |
| 5679 | flag_group( |
| 5680 | flags = [ |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5681 | "-fstack-protector", |
| 5682 | "-fcolor-diagnostics", |
| 5683 | "-Wall", |
| 5684 | "-Wthread-safety", |
| 5685 | "-Wself-assign", |
| 5686 | "-fno-omit-frame-pointer", |
| 5687 | ], |
| 5688 | ), |
| 5689 | ], |
| 5690 | ), |
| 5691 | flag_set( |
| 5692 | actions = [ |
| 5693 | ACTION_NAMES.assemble, |
| 5694 | ACTION_NAMES.preprocess_assemble, |
| 5695 | ACTION_NAMES.linkstamp_compile, |
| 5696 | ACTION_NAMES.c_compile, |
| 5697 | ACTION_NAMES.cpp_compile, |
| 5698 | ACTION_NAMES.cpp_header_parsing, |
| 5699 | ACTION_NAMES.cpp_module_compile, |
| 5700 | ACTION_NAMES.cpp_module_codegen, |
| 5701 | ACTION_NAMES.lto_backend, |
| 5702 | ACTION_NAMES.clif_match, |
| 5703 | ACTION_NAMES.objc_compile, |
| 5704 | ACTION_NAMES.objcpp_compile, |
| 5705 | ], |
| 5706 | flag_groups = [flag_group(flags = ["-O0", "-DDEBUG"])], |
| 5707 | with_features = [with_feature_set(features = ["fastbuild"])], |
| 5708 | ), |
| 5709 | flag_set( |
| 5710 | actions = [ |
| 5711 | ACTION_NAMES.assemble, |
| 5712 | ACTION_NAMES.preprocess_assemble, |
| 5713 | ACTION_NAMES.linkstamp_compile, |
| 5714 | ACTION_NAMES.c_compile, |
| 5715 | ACTION_NAMES.cpp_compile, |
| 5716 | ACTION_NAMES.cpp_header_parsing, |
| 5717 | ACTION_NAMES.cpp_module_compile, |
| 5718 | ACTION_NAMES.cpp_module_codegen, |
| 5719 | ACTION_NAMES.lto_backend, |
| 5720 | ACTION_NAMES.clif_match, |
| 5721 | ACTION_NAMES.objc_compile, |
| 5722 | ACTION_NAMES.objcpp_compile, |
| 5723 | ], |
| 5724 | flag_groups = [ |
| 5725 | flag_group( |
| 5726 | flags = [ |
| 5727 | "-g0", |
| 5728 | "-O2", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5729 | "-DNDEBUG", |
Keith Smiley | 174ed30 | 2020-08-04 19:15:54 -0700 | [diff] [blame] | 5730 | "-DNS_BLOCK_ASSERTIONS=1", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5731 | ], |
| 5732 | ), |
| 5733 | ], |
| 5734 | with_features = [with_feature_set(features = ["opt"])], |
| 5735 | ), |
| 5736 | flag_set( |
| 5737 | actions = [ |
| 5738 | ACTION_NAMES.assemble, |
| 5739 | ACTION_NAMES.preprocess_assemble, |
| 5740 | ACTION_NAMES.linkstamp_compile, |
| 5741 | ACTION_NAMES.c_compile, |
| 5742 | ACTION_NAMES.cpp_compile, |
| 5743 | ACTION_NAMES.cpp_header_parsing, |
| 5744 | ACTION_NAMES.cpp_module_compile, |
| 5745 | ACTION_NAMES.cpp_module_codegen, |
| 5746 | ACTION_NAMES.lto_backend, |
| 5747 | ACTION_NAMES.clif_match, |
| 5748 | ACTION_NAMES.objc_compile, |
| 5749 | ACTION_NAMES.objcpp_compile, |
| 5750 | ], |
| 5751 | flag_groups = [flag_group(flags = ["-g"])], |
| 5752 | with_features = [with_feature_set(features = ["dbg"])], |
| 5753 | ), |
| 5754 | flag_set( |
| 5755 | actions = [ |
| 5756 | ACTION_NAMES.linkstamp_compile, |
| 5757 | ACTION_NAMES.cpp_compile, |
| 5758 | ACTION_NAMES.cpp_header_parsing, |
| 5759 | ACTION_NAMES.cpp_module_compile, |
| 5760 | ACTION_NAMES.cpp_module_codegen, |
| 5761 | ACTION_NAMES.lto_backend, |
| 5762 | ACTION_NAMES.clif_match, |
| 5763 | ], |
| 5764 | flag_groups = [flag_group(flags = ["-std=c++11"])], |
| 5765 | ), |
| 5766 | ], |
| 5767 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5768 | else: |
| 5769 | default_compile_flags_feature = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5770 | |
| 5771 | objcopy_embed_flags_feature = feature( |
| 5772 | name = "objcopy_embed_flags", |
| 5773 | enabled = True, |
| 5774 | flag_sets = [ |
| 5775 | flag_set( |
| 5776 | actions = ["objcopy_embed_data"], |
| 5777 | flag_groups = [flag_group(flags = ["-I", "binary"])], |
| 5778 | ), |
| 5779 | ], |
| 5780 | ) |
| 5781 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5782 | dead_strip_feature = feature( |
| 5783 | name = "dead_strip", |
| 5784 | flag_sets = [ |
| 5785 | flag_set( |
| 5786 | actions = all_link_actions + |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5787 | ["objc-executable", "objc++-executable"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5788 | flag_groups = [ |
| 5789 | flag_group( |
Keith Smiley | 6ba3d91 | 2020-11-13 07:50:47 -0800 | [diff] [blame] | 5790 | flags = ["-dead_strip"], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5791 | ), |
| 5792 | ], |
| 5793 | ), |
| 5794 | ], |
| 5795 | requires = [feature_set(features = ["opt"])], |
| 5796 | ) |
| 5797 | |
Keith Smiley | 930424b | 2020-07-14 02:50:15 -0700 | [diff] [blame] | 5798 | oso_prefix_feature = feature( |
| 5799 | name = "oso_prefix_is_pwd", |
| 5800 | flag_sets = [ |
| 5801 | flag_set( |
Keith Smiley | 306e5f1 | 2020-11-05 03:10:16 -0800 | [diff] [blame] | 5802 | actions = ["objc-executable", "objc++-executable"], |
Keith Smiley | 930424b | 2020-07-14 02:50:15 -0700 | [diff] [blame] | 5803 | flag_groups = [flag_group(flags = ["OSO_PREFIX_MAP_PWD"])], |
| 5804 | ), |
| 5805 | ], |
| 5806 | ) |
| 5807 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5808 | generate_dsym_file_feature = feature( |
| 5809 | name = "generate_dsym_file", |
| 5810 | flag_sets = [ |
| 5811 | flag_set( |
| 5812 | actions = [ |
| 5813 | ACTION_NAMES.c_compile, |
| 5814 | ACTION_NAMES.cpp_compile, |
| 5815 | ACTION_NAMES.objc_compile, |
| 5816 | ACTION_NAMES.objcpp_compile, |
| 5817 | "objc-executable", |
| 5818 | "objc++-executable", |
| 5819 | ], |
| 5820 | flag_groups = [flag_group(flags = ["-g"])], |
| 5821 | ), |
| 5822 | flag_set( |
| 5823 | actions = ["objc-executable", "objc++-executable"], |
| 5824 | flag_groups = [ |
| 5825 | flag_group( |
| 5826 | flags = [ |
| 5827 | "DSYM_HINT_LINKED_BINARY=%{linked_binary}", |
| 5828 | "DSYM_HINT_DSYM_PATH=%{dsym_path}", |
| 5829 | ], |
| 5830 | ), |
| 5831 | ], |
| 5832 | ), |
| 5833 | ], |
| 5834 | ) |
| 5835 | |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 5836 | # Kernel extensions for Apple Silicon are arm64e. |
| 5837 | if (ctx.attr.cpu == "darwin_x86_64" or |
| 5838 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5839 | kernel_extension_feature = feature( |
| 5840 | name = "kernel_extension", |
| 5841 | flag_sets = [ |
| 5842 | flag_set( |
| 5843 | actions = ["objc-executable", "objc++-executable"], |
| 5844 | flag_groups = [ |
| 5845 | flag_group( |
| 5846 | flags = [ |
| 5847 | "-nostdlib", |
| 5848 | "-lkmod", |
| 5849 | "-lkmodc++", |
| 5850 | "-lcc_kext", |
| 5851 | "-Xlinker", |
| 5852 | "-kext", |
| 5853 | ], |
| 5854 | ), |
| 5855 | ], |
| 5856 | ), |
| 5857 | ], |
| 5858 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5859 | elif (ctx.attr.cpu == "armeabi-v7a" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 5860 | ctx.attr.cpu == "darwin_arm64" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5861 | ctx.attr.cpu == "ios_arm64" or |
| 5862 | ctx.attr.cpu == "ios_arm64e" or |
| 5863 | ctx.attr.cpu == "ios_armv7" or |
| 5864 | ctx.attr.cpu == "ios_i386" or |
| 5865 | ctx.attr.cpu == "ios_x86_64" or |
| 5866 | ctx.attr.cpu == "tvos_arm64" or |
| 5867 | ctx.attr.cpu == "tvos_x86_64" or |
| 5868 | ctx.attr.cpu == "watchos_arm64_32" or |
| 5869 | ctx.attr.cpu == "watchos_armv7k" or |
| 5870 | ctx.attr.cpu == "watchos_i386" or |
| 5871 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5872 | kernel_extension_feature = feature(name = "kernel_extension") |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5873 | else: |
| 5874 | kernel_extension_feature = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5875 | |
| 5876 | apply_default_warnings_feature = feature( |
| 5877 | name = "apply_default_warnings", |
| 5878 | flag_sets = [ |
| 5879 | flag_set( |
| 5880 | actions = [ACTION_NAMES.objc_compile, ACTION_NAMES.objcpp_compile], |
| 5881 | flag_groups = [ |
| 5882 | flag_group( |
| 5883 | flags = [ |
| 5884 | "-Wshorten-64-to-32", |
| 5885 | "-Wbool-conversion", |
| 5886 | "-Wconstant-conversion", |
| 5887 | "-Wduplicate-method-match", |
| 5888 | "-Wempty-body", |
| 5889 | "-Wenum-conversion", |
| 5890 | "-Wint-conversion", |
| 5891 | "-Wunreachable-code", |
| 5892 | "-Wmismatched-return-types", |
| 5893 | "-Wundeclared-selector", |
| 5894 | "-Wuninitialized", |
| 5895 | "-Wunused-function", |
| 5896 | "-Wunused-variable", |
| 5897 | ], |
| 5898 | ), |
| 5899 | ], |
| 5900 | ), |
| 5901 | ], |
| 5902 | ) |
| 5903 | |
| 5904 | dependency_file_feature = feature( |
| 5905 | name = "dependency_file", |
hlopko | 2f17a86 | 2019-02-26 07:56:03 -0800 | [diff] [blame] | 5906 | enabled = True, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5907 | flag_sets = [ |
| 5908 | flag_set( |
| 5909 | actions = [ |
| 5910 | ACTION_NAMES.assemble, |
| 5911 | ACTION_NAMES.preprocess_assemble, |
| 5912 | ACTION_NAMES.c_compile, |
| 5913 | ACTION_NAMES.cpp_compile, |
| 5914 | ACTION_NAMES.cpp_module_compile, |
| 5915 | ACTION_NAMES.objc_compile, |
| 5916 | ACTION_NAMES.objcpp_compile, |
| 5917 | ACTION_NAMES.cpp_header_parsing, |
| 5918 | ], |
| 5919 | flag_groups = [ |
| 5920 | flag_group( |
| 5921 | flags = ["-MD", "-MF", "%{dependency_file}"], |
| 5922 | expand_if_available = "dependency_file", |
| 5923 | ), |
| 5924 | ], |
| 5925 | ), |
| 5926 | ], |
| 5927 | ) |
| 5928 | |
| 5929 | preprocessor_defines_feature = feature( |
| 5930 | name = "preprocessor_defines", |
hlopko | 2f17a86 | 2019-02-26 07:56:03 -0800 | [diff] [blame] | 5931 | enabled = True, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5932 | flag_sets = [ |
| 5933 | flag_set( |
| 5934 | actions = [ |
| 5935 | ACTION_NAMES.preprocess_assemble, |
| 5936 | ACTION_NAMES.c_compile, |
| 5937 | ACTION_NAMES.cpp_compile, |
| 5938 | ACTION_NAMES.cpp_header_parsing, |
| 5939 | ACTION_NAMES.cpp_module_compile, |
| 5940 | ACTION_NAMES.linkstamp_compile, |
| 5941 | ACTION_NAMES.objc_compile, |
| 5942 | ACTION_NAMES.objcpp_compile, |
| 5943 | ], |
| 5944 | flag_groups = [ |
| 5945 | flag_group( |
| 5946 | flags = ["-D%{preprocessor_defines}"], |
| 5947 | iterate_over = "preprocessor_defines", |
| 5948 | ), |
| 5949 | ], |
| 5950 | ), |
| 5951 | ], |
| 5952 | ) |
| 5953 | |
| 5954 | fdo_instrument_feature = feature( |
| 5955 | name = "fdo_instrument", |
| 5956 | flag_sets = [ |
| 5957 | flag_set( |
| 5958 | actions = [ |
| 5959 | ACTION_NAMES.c_compile, |
| 5960 | ACTION_NAMES.cpp_compile, |
| 5961 | ACTION_NAMES.cpp_link_dynamic_library, |
| 5962 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 5963 | ACTION_NAMES.cpp_link_executable, |
| 5964 | ], |
| 5965 | flag_groups = [ |
| 5966 | flag_group( |
| 5967 | flags = [ |
| 5968 | "-fprofile-generate=%{fdo_instrument_path}", |
| 5969 | "-fno-data-sections", |
| 5970 | ], |
| 5971 | expand_if_available = "fdo_instrument_path", |
| 5972 | ), |
| 5973 | ], |
| 5974 | ), |
| 5975 | ], |
| 5976 | provides = ["profile"], |
| 5977 | ) |
| 5978 | |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 5979 | if (ctx.attr.cpu == "darwin_x86_64" or |
| 5980 | ctx.attr.cpu == "darwin_arm64" or |
| 5981 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 5982 | link_cocoa_feature = feature( |
| 5983 | name = "link_cocoa", |
| 5984 | flag_sets = [ |
| 5985 | flag_set( |
| 5986 | actions = ["objc-executable", "objc++-executable"], |
| 5987 | flag_groups = [flag_group(flags = ["-framework", "Cocoa"])], |
| 5988 | ), |
| 5989 | ], |
| 5990 | ) |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 5991 | elif (ctx.attr.cpu == "armeabi-v7a" or |
| 5992 | ctx.attr.cpu == "ios_arm64" or |
| 5993 | ctx.attr.cpu == "ios_arm64e" or |
| 5994 | ctx.attr.cpu == "ios_armv7" or |
| 5995 | ctx.attr.cpu == "ios_i386" or |
| 5996 | ctx.attr.cpu == "ios_x86_64" or |
| 5997 | ctx.attr.cpu == "tvos_arm64" or |
| 5998 | ctx.attr.cpu == "tvos_x86_64" or |
| 5999 | ctx.attr.cpu == "watchos_arm64_32" or |
| 6000 | ctx.attr.cpu == "watchos_armv7k" or |
| 6001 | ctx.attr.cpu == "watchos_i386" or |
| 6002 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6003 | link_cocoa_feature = feature(name = "link_cocoa") |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6004 | else: |
| 6005 | link_cocoa_feature = None |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6006 | |
| 6007 | user_compile_flags_feature = feature( |
| 6008 | name = "user_compile_flags", |
| 6009 | flag_sets = [ |
| 6010 | flag_set( |
| 6011 | actions = [ |
| 6012 | ACTION_NAMES.assemble, |
| 6013 | ACTION_NAMES.preprocess_assemble, |
| 6014 | ACTION_NAMES.c_compile, |
| 6015 | ACTION_NAMES.cpp_compile, |
| 6016 | ACTION_NAMES.cpp_header_parsing, |
| 6017 | ACTION_NAMES.cpp_module_compile, |
| 6018 | ACTION_NAMES.cpp_module_codegen, |
| 6019 | ACTION_NAMES.linkstamp_compile, |
| 6020 | ACTION_NAMES.objc_compile, |
| 6021 | ACTION_NAMES.objcpp_compile, |
| 6022 | ], |
| 6023 | flag_groups = [ |
| 6024 | flag_group( |
| 6025 | flags = ["%{user_compile_flags}"], |
| 6026 | iterate_over = "user_compile_flags", |
| 6027 | expand_if_available = "user_compile_flags", |
| 6028 | ), |
| 6029 | ], |
| 6030 | ), |
| 6031 | ], |
| 6032 | ) |
| 6033 | |
Keith Smiley | f8e38d1 | 2019-02-13 13:33:36 -0800 | [diff] [blame] | 6034 | headerpad_feature = feature( |
| 6035 | name = "headerpad", |
| 6036 | enabled = True, |
| 6037 | flag_sets = [ |
| 6038 | flag_set( |
| 6039 | actions = all_link_actions + [ |
| 6040 | ACTION_NAMES.objc_executable, |
| 6041 | ACTION_NAMES.objcpp_executable, |
| 6042 | ], |
| 6043 | flag_groups = [flag_group(flags = ["-headerpad_max_install_names"])], |
| 6044 | with_features = [with_feature_set(not_features = [ |
| 6045 | "bitcode_embedded", |
| 6046 | "bitcode_embedded_markers", |
| 6047 | ])], |
| 6048 | ), |
| 6049 | ], |
| 6050 | ) |
| 6051 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6052 | if (ctx.attr.cpu == "ios_arm64" or |
| 6053 | ctx.attr.cpu == "ios_arm64e" or |
| 6054 | ctx.attr.cpu == "ios_armv7" or |
| 6055 | ctx.attr.cpu == "tvos_arm64" or |
| 6056 | ctx.attr.cpu == "watchos_arm64_32" or |
| 6057 | ctx.attr.cpu == "watchos_armv7k" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 6058 | ctx.attr.cpu == "darwin_x86_64" or |
| 6059 | ctx.attr.cpu == "darwin_arm64" or |
| 6060 | ctx.attr.cpu == "darwin_arm64e"): |
Keith Smiley | f8e38d1 | 2019-02-13 13:33:36 -0800 | [diff] [blame] | 6061 | bitcode_embedded_feature = feature( |
| 6062 | name = "bitcode_embedded", |
| 6063 | flag_sets = [ |
| 6064 | flag_set( |
| 6065 | actions = [ |
| 6066 | ACTION_NAMES.c_compile, |
| 6067 | ACTION_NAMES.cpp_compile, |
| 6068 | ACTION_NAMES.objc_compile, |
| 6069 | ACTION_NAMES.objcpp_compile, |
| 6070 | ], |
| 6071 | flag_groups = [flag_group(flags = ["-fembed-bitcode"])], |
| 6072 | ), |
| 6073 | flag_set( |
| 6074 | actions = all_link_actions + [ |
| 6075 | ACTION_NAMES.objc_executable, |
| 6076 | ACTION_NAMES.objcpp_executable, |
| 6077 | ], |
Keith Smiley | e83db1e | 2019-10-02 04:13:58 -0700 | [diff] [blame] | 6078 | flag_groups = [ |
| 6079 | flag_group( |
| 6080 | flags = [ |
| 6081 | "-fembed-bitcode", |
| 6082 | "-Xlinker", |
| 6083 | "-bitcode_verify", |
| 6084 | "-Xlinker", |
| 6085 | "-bitcode_hide_symbols", |
| 6086 | "-Xlinker", |
| 6087 | "-bitcode_symbol_map", |
| 6088 | "-Xlinker", |
Keith Smiley | a1471a8 | 2020-11-11 12:01:09 -0800 | [diff] [blame] | 6089 | "%{bitcode_symbol_map_path}", |
Keith Smiley | e83db1e | 2019-10-02 04:13:58 -0700 | [diff] [blame] | 6090 | ], |
| 6091 | expand_if_available = "bitcode_symbol_map_path", |
| 6092 | ), |
| 6093 | ], |
Keith Smiley | f8e38d1 | 2019-02-13 13:33:36 -0800 | [diff] [blame] | 6094 | ), |
| 6095 | ], |
| 6096 | ) |
Keith Smiley | f8e38d1 | 2019-02-13 13:33:36 -0800 | [diff] [blame] | 6097 | bitcode_embedded_markers_feature = feature( |
| 6098 | name = "bitcode_embedded_markers", |
| 6099 | flag_sets = [ |
| 6100 | flag_set( |
| 6101 | actions = [ |
| 6102 | ACTION_NAMES.c_compile, |
| 6103 | ACTION_NAMES.cpp_compile, |
| 6104 | ACTION_NAMES.objc_compile, |
| 6105 | ACTION_NAMES.objcpp_compile, |
| 6106 | ], |
| 6107 | flag_groups = [flag_group(flags = ["-fembed-bitcode-marker"])], |
| 6108 | ), |
| 6109 | flag_set( |
| 6110 | actions = all_link_actions + [ |
| 6111 | ACTION_NAMES.objc_executable, |
| 6112 | ACTION_NAMES.objcpp_executable, |
| 6113 | ], |
| 6114 | flag_groups = [flag_group(flags = ["-fembed-bitcode-marker"])], |
| 6115 | ), |
| 6116 | ], |
| 6117 | ) |
| 6118 | else: |
| 6119 | bitcode_embedded_markers_feature = feature(name = "bitcode_embedded_markers") |
| 6120 | bitcode_embedded_feature = feature(name = "bitcode_embedded") |
| 6121 | |
Thi Doan | fa1740d | 2020-09-03 21:44:22 -0700 | [diff] [blame] | 6122 | generate_linkmap_feature = feature( |
| 6123 | name = "generate_linkmap", |
| 6124 | flag_sets = [ |
| 6125 | flag_set( |
| 6126 | actions = [ |
| 6127 | ACTION_NAMES.objc_executable, |
| 6128 | ACTION_NAMES.objcpp_executable, |
| 6129 | ], |
| 6130 | flag_groups = [ |
| 6131 | flag_group( |
| 6132 | flags = [ |
| 6133 | "-Xlinker", |
| 6134 | "-map", |
| 6135 | "-Xlinker", |
| 6136 | "%{linkmap_exec_path}", |
| 6137 | ], |
| 6138 | ), |
| 6139 | ], |
| 6140 | ), |
| 6141 | ], |
| 6142 | ) |
| 6143 | |
Yannic Bonenberger | cf47f90 | 2020-11-12 06:13:14 -0800 | [diff] [blame] | 6144 | set_install_name = feature( |
| 6145 | name = "set_install_name", |
| 6146 | enabled = ctx.fragments.cpp.do_not_use_macos_set_install_name, |
| 6147 | flag_sets = [ |
| 6148 | flag_set( |
| 6149 | actions = [ |
| 6150 | ACTION_NAMES.cpp_link_dynamic_library, |
| 6151 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 6152 | ], |
| 6153 | flag_groups = [ |
| 6154 | flag_group( |
| 6155 | flags = [ |
| 6156 | "-Wl,-install_name,@rpath/%{runtime_solib_name}", |
| 6157 | ], |
| 6158 | expand_if_available = "runtime_solib_name", |
| 6159 | ), |
| 6160 | ], |
| 6161 | ), |
| 6162 | ], |
| 6163 | ) |
| 6164 | |
Keith Smiley | 8959dff | 2021-01-18 21:08:43 -0800 | [diff] [blame] | 6165 | asan_feature = feature( |
| 6166 | name = "asan", |
| 6167 | flag_sets = [ |
| 6168 | flag_set( |
| 6169 | actions = [ |
| 6170 | ACTION_NAMES.c_compile, |
| 6171 | ACTION_NAMES.cpp_compile, |
| 6172 | ACTION_NAMES.objc_compile, |
| 6173 | ACTION_NAMES.objcpp_compile, |
| 6174 | ], |
| 6175 | flag_groups = [ |
| 6176 | flag_group(flags = ["-fsanitize=address"]), |
| 6177 | ], |
| 6178 | with_features = [ |
| 6179 | with_feature_set(features = ["asan"]), |
| 6180 | ], |
| 6181 | ), |
| 6182 | flag_set( |
| 6183 | actions = [ |
| 6184 | ACTION_NAMES.cpp_link_executable, |
| 6185 | ACTION_NAMES.cpp_link_dynamic_library, |
| 6186 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 6187 | ACTION_NAMES.objc_executable, |
| 6188 | ACTION_NAMES.objcpp_executable, |
| 6189 | ], |
| 6190 | flag_groups = [ |
| 6191 | flag_group(flags = ["-fsanitize=address"]), |
| 6192 | ], |
| 6193 | with_features = [ |
| 6194 | with_feature_set(features = ["asan"]), |
| 6195 | ], |
| 6196 | ), |
| 6197 | ], |
| 6198 | ) |
| 6199 | |
| 6200 | tsan_feature = feature( |
| 6201 | name = "tsan", |
| 6202 | flag_sets = [ |
| 6203 | flag_set( |
| 6204 | actions = [ |
| 6205 | ACTION_NAMES.c_compile, |
| 6206 | ACTION_NAMES.cpp_compile, |
| 6207 | ACTION_NAMES.objc_compile, |
| 6208 | ACTION_NAMES.objcpp_compile, |
| 6209 | ], |
| 6210 | flag_groups = [ |
| 6211 | flag_group(flags = ["-fsanitize=thread"]), |
| 6212 | ], |
| 6213 | with_features = [ |
| 6214 | with_feature_set(features = ["tsan"]), |
| 6215 | ], |
| 6216 | ), |
| 6217 | flag_set( |
| 6218 | actions = [ |
| 6219 | ACTION_NAMES.cpp_link_executable, |
| 6220 | ACTION_NAMES.cpp_link_dynamic_library, |
| 6221 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 6222 | ACTION_NAMES.objc_executable, |
| 6223 | ACTION_NAMES.objcpp_executable, |
| 6224 | ], |
| 6225 | flag_groups = [ |
| 6226 | flag_group(flags = ["-fsanitize=thread"]), |
| 6227 | ], |
| 6228 | with_features = [ |
| 6229 | with_feature_set(features = ["tsan"]), |
| 6230 | ], |
| 6231 | ), |
| 6232 | ], |
| 6233 | ) |
| 6234 | |
| 6235 | ubsan_feature = feature( |
| 6236 | name = "ubsan", |
| 6237 | flag_sets = [ |
| 6238 | flag_set( |
| 6239 | actions = [ |
| 6240 | ACTION_NAMES.c_compile, |
| 6241 | ACTION_NAMES.cpp_compile, |
| 6242 | ACTION_NAMES.objc_compile, |
| 6243 | ACTION_NAMES.objcpp_compile, |
| 6244 | ], |
| 6245 | flag_groups = [ |
| 6246 | flag_group(flags = ["-fsanitize=undefined"]), |
| 6247 | ], |
| 6248 | with_features = [ |
| 6249 | with_feature_set(features = ["ubsan"]), |
| 6250 | ], |
| 6251 | ), |
| 6252 | flag_set( |
| 6253 | actions = [ |
| 6254 | ACTION_NAMES.cpp_link_executable, |
| 6255 | ACTION_NAMES.cpp_link_dynamic_library, |
| 6256 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 6257 | ACTION_NAMES.objc_executable, |
| 6258 | ACTION_NAMES.objcpp_executable, |
| 6259 | ], |
| 6260 | flag_groups = [ |
| 6261 | flag_group(flags = ["-fsanitize=undefined"]), |
| 6262 | ], |
| 6263 | with_features = [ |
| 6264 | with_feature_set(features = ["ubsan"]), |
| 6265 | ], |
| 6266 | ), |
| 6267 | ], |
| 6268 | ) |
| 6269 | |
| 6270 | default_sanitizer_flags_feature = feature( |
| 6271 | name = "default_sanitizer_flags", |
| 6272 | enabled = True, |
| 6273 | flag_sets = [ |
| 6274 | flag_set( |
| 6275 | actions = [ |
| 6276 | ACTION_NAMES.c_compile, |
| 6277 | ACTION_NAMES.cpp_compile, |
| 6278 | ACTION_NAMES.objc_compile, |
| 6279 | ACTION_NAMES.objcpp_compile, |
| 6280 | ], |
| 6281 | flag_groups = [ |
| 6282 | flag_group( |
| 6283 | flags = [ |
| 6284 | "-O1", |
| 6285 | "-gline-tables-only", |
| 6286 | "-fno-omit-frame-pointer", |
| 6287 | "-fno-sanitize-recover=all", |
| 6288 | ], |
| 6289 | ), |
| 6290 | ], |
| 6291 | with_features = [ |
| 6292 | with_feature_set(features = ["asan"]), |
| 6293 | with_feature_set(features = ["tsan"]), |
| 6294 | with_feature_set(features = ["ubsan"]), |
| 6295 | ], |
| 6296 | ), |
| 6297 | ], |
| 6298 | ) |
| 6299 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6300 | if (ctx.attr.cpu == "ios_arm64" or |
| 6301 | ctx.attr.cpu == "ios_arm64e" or |
| 6302 | ctx.attr.cpu == "ios_armv7" or |
| 6303 | ctx.attr.cpu == "ios_i386" or |
| 6304 | ctx.attr.cpu == "ios_x86_64" or |
| 6305 | ctx.attr.cpu == "tvos_arm64" or |
| 6306 | ctx.attr.cpu == "tvos_x86_64" or |
| 6307 | ctx.attr.cpu == "watchos_arm64_32" or |
| 6308 | ctx.attr.cpu == "watchos_armv7k" or |
| 6309 | ctx.attr.cpu == "watchos_i386" or |
| 6310 | ctx.attr.cpu == "watchos_x86_64"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6311 | features = [ |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6312 | fastbuild_feature, |
| 6313 | no_legacy_features_feature, |
| 6314 | opt_feature, |
| 6315 | dbg_feature, |
| 6316 | link_libcpp_feature, |
| 6317 | compile_all_modules_feature, |
| 6318 | exclude_private_headers_in_module_maps_feature, |
| 6319 | has_configured_linker_path_feature, |
| 6320 | only_doth_headers_in_module_maps_feature, |
| 6321 | default_compile_flags_feature, |
| 6322 | debug_prefix_map_pwd_is_dot_feature, |
Keith Smiley | bc5883a | 2020-10-21 08:06:11 -0700 | [diff] [blame] | 6323 | remap_xcode_path_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6324 | generate_dsym_file_feature, |
Thi Doan | fa1740d | 2020-09-03 21:44:22 -0700 | [diff] [blame] | 6325 | generate_linkmap_feature, |
Keith Smiley | 930424b | 2020-07-14 02:50:15 -0700 | [diff] [blame] | 6326 | oso_prefix_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6327 | contains_objc_source_feature, |
| 6328 | objc_actions_feature, |
| 6329 | strip_debug_symbols_feature, |
| 6330 | symbol_counts_feature, |
| 6331 | shared_flag_feature, |
| 6332 | kernel_extension_feature, |
| 6333 | linkstamps_feature, |
| 6334 | output_execpath_flags_feature, |
| 6335 | archiver_flags_feature, |
| 6336 | runtime_root_flags_feature, |
| 6337 | input_param_flags_feature, |
| 6338 | force_pic_flags_feature, |
| 6339 | pch_feature, |
| 6340 | module_maps_feature, |
| 6341 | use_objc_modules_feature, |
| 6342 | no_enable_modules_feature, |
| 6343 | apply_default_warnings_feature, |
| 6344 | includes_feature, |
| 6345 | include_paths_feature, |
| 6346 | sysroot_feature, |
| 6347 | dependency_file_feature, |
| 6348 | pic_feature, |
| 6349 | per_object_debug_info_feature, |
| 6350 | preprocessor_defines_feature, |
| 6351 | framework_paths_feature, |
| 6352 | random_seed_feature, |
| 6353 | fdo_instrument_feature, |
| 6354 | fdo_optimize_feature, |
| 6355 | autofdo_feature, |
| 6356 | lipo_feature, |
| 6357 | coverage_feature, |
| 6358 | llvm_coverage_map_format_feature, |
| 6359 | gcc_coverage_map_format_feature, |
| 6360 | apply_default_compiler_flags_feature, |
| 6361 | include_system_dirs_feature, |
| 6362 | headerpad_feature, |
| 6363 | bitcode_embedded_feature, |
| 6364 | bitcode_embedded_markers_feature, |
| 6365 | objc_arc_feature, |
| 6366 | no_objc_arc_feature, |
| 6367 | apple_env_feature, |
Keith Smiley | 3d6d0c9 | 2020-10-22 05:18:51 -0700 | [diff] [blame] | 6368 | relative_ast_path_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6369 | user_link_flags_feature, |
| 6370 | default_link_flags_feature, |
| 6371 | version_min_feature, |
| 6372 | dead_strip_feature, |
| 6373 | cpp_linker_flags_feature, |
| 6374 | apply_implicit_frameworks_feature, |
| 6375 | link_cocoa_feature, |
| 6376 | apply_simulator_compiler_flags_feature, |
| 6377 | unfiltered_cxx_flags_feature, |
| 6378 | user_compile_flags_feature, |
| 6379 | unfiltered_compile_flags_feature, |
| 6380 | linker_param_file_feature, |
| 6381 | compiler_input_flags_feature, |
| 6382 | compiler_output_flags_feature, |
| 6383 | objcopy_embed_flags_feature, |
Yannic Bonenberger | cf47f90 | 2020-11-12 06:13:14 -0800 | [diff] [blame] | 6384 | set_install_name, |
Keith Smiley | 8959dff | 2021-01-18 21:08:43 -0800 | [diff] [blame] | 6385 | asan_feature, |
| 6386 | tsan_feature, |
| 6387 | ubsan_feature, |
| 6388 | default_sanitizer_flags_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6389 | ] |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 6390 | elif (ctx.attr.cpu == "darwin_x86_64" or |
| 6391 | ctx.attr.cpu == "darwin_arm64" or |
| 6392 | ctx.attr.cpu == "darwin_arm64e"): |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6393 | features = [ |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6394 | fastbuild_feature, |
| 6395 | no_legacy_features_feature, |
| 6396 | opt_feature, |
| 6397 | dbg_feature, |
| 6398 | link_libcpp_feature, |
| 6399 | compile_all_modules_feature, |
| 6400 | exclude_private_headers_in_module_maps_feature, |
| 6401 | has_configured_linker_path_feature, |
| 6402 | only_doth_headers_in_module_maps_feature, |
| 6403 | default_compile_flags_feature, |
| 6404 | debug_prefix_map_pwd_is_dot_feature, |
Keith Smiley | bc5883a | 2020-10-21 08:06:11 -0700 | [diff] [blame] | 6405 | remap_xcode_path_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6406 | generate_dsym_file_feature, |
Thi Doan | fa1740d | 2020-09-03 21:44:22 -0700 | [diff] [blame] | 6407 | generate_linkmap_feature, |
Keith Smiley | 930424b | 2020-07-14 02:50:15 -0700 | [diff] [blame] | 6408 | oso_prefix_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6409 | contains_objc_source_feature, |
| 6410 | objc_actions_feature, |
| 6411 | strip_debug_symbols_feature, |
| 6412 | symbol_counts_feature, |
| 6413 | shared_flag_feature, |
| 6414 | kernel_extension_feature, |
| 6415 | linkstamps_feature, |
| 6416 | output_execpath_flags_feature, |
| 6417 | archiver_flags_feature, |
| 6418 | runtime_root_flags_feature, |
| 6419 | input_param_flags_feature, |
| 6420 | force_pic_flags_feature, |
| 6421 | pch_feature, |
| 6422 | module_maps_feature, |
| 6423 | use_objc_modules_feature, |
| 6424 | no_enable_modules_feature, |
| 6425 | apply_default_warnings_feature, |
| 6426 | includes_feature, |
| 6427 | include_paths_feature, |
| 6428 | sysroot_feature, |
| 6429 | dependency_file_feature, |
| 6430 | pic_feature, |
| 6431 | per_object_debug_info_feature, |
| 6432 | preprocessor_defines_feature, |
| 6433 | framework_paths_feature, |
| 6434 | random_seed_feature, |
| 6435 | fdo_instrument_feature, |
| 6436 | fdo_optimize_feature, |
| 6437 | autofdo_feature, |
| 6438 | lipo_feature, |
| 6439 | coverage_feature, |
| 6440 | llvm_coverage_map_format_feature, |
| 6441 | gcc_coverage_map_format_feature, |
| 6442 | apply_default_compiler_flags_feature, |
| 6443 | include_system_dirs_feature, |
| 6444 | headerpad_feature, |
| 6445 | bitcode_embedded_feature, |
| 6446 | bitcode_embedded_markers_feature, |
| 6447 | objc_arc_feature, |
| 6448 | no_objc_arc_feature, |
| 6449 | apple_env_feature, |
Keith Smiley | 3d6d0c9 | 2020-10-22 05:18:51 -0700 | [diff] [blame] | 6450 | relative_ast_path_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6451 | user_link_flags_feature, |
| 6452 | default_link_flags_feature, |
| 6453 | version_min_feature, |
| 6454 | dead_strip_feature, |
| 6455 | cpp_linker_flags_feature, |
| 6456 | apply_implicit_frameworks_feature, |
| 6457 | link_cocoa_feature, |
| 6458 | apply_simulator_compiler_flags_feature, |
| 6459 | unfiltered_cxx_flags_feature, |
| 6460 | user_compile_flags_feature, |
| 6461 | unfiltered_compile_flags_feature, |
| 6462 | linker_param_file_feature, |
| 6463 | compiler_input_flags_feature, |
| 6464 | compiler_output_flags_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6465 | objcopy_embed_flags_feature, |
| 6466 | dynamic_linking_mode_feature, |
Yannic Bonenberger | cf47f90 | 2020-11-12 06:13:14 -0800 | [diff] [blame] | 6467 | set_install_name, |
Keith Smiley | 8959dff | 2021-01-18 21:08:43 -0800 | [diff] [blame] | 6468 | asan_feature, |
| 6469 | tsan_feature, |
| 6470 | ubsan_feature, |
| 6471 | default_sanitizer_flags_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6472 | ] |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6473 | elif (ctx.attr.cpu == "armeabi-v7a"): |
| 6474 | features = [ |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6475 | fastbuild_feature, |
| 6476 | no_legacy_features_feature, |
| 6477 | opt_feature, |
| 6478 | dbg_feature, |
| 6479 | link_libcpp_feature, |
| 6480 | compile_all_modules_feature, |
| 6481 | exclude_private_headers_in_module_maps_feature, |
| 6482 | has_configured_linker_path_feature, |
| 6483 | only_doth_headers_in_module_maps_feature, |
| 6484 | default_compile_flags_feature, |
| 6485 | debug_prefix_map_pwd_is_dot_feature, |
Keith Smiley | bc5883a | 2020-10-21 08:06:11 -0700 | [diff] [blame] | 6486 | remap_xcode_path_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6487 | generate_dsym_file_feature, |
Thi Doan | fa1740d | 2020-09-03 21:44:22 -0700 | [diff] [blame] | 6488 | generate_linkmap_feature, |
Keith Smiley | 930424b | 2020-07-14 02:50:15 -0700 | [diff] [blame] | 6489 | oso_prefix_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6490 | contains_objc_source_feature, |
| 6491 | objc_actions_feature, |
| 6492 | strip_debug_symbols_feature, |
| 6493 | symbol_counts_feature, |
| 6494 | shared_flag_feature, |
| 6495 | kernel_extension_feature, |
| 6496 | linkstamps_feature, |
| 6497 | output_execpath_flags_feature, |
| 6498 | archiver_flags_feature, |
| 6499 | runtime_root_flags_feature, |
| 6500 | input_param_flags_feature, |
| 6501 | force_pic_flags_feature, |
| 6502 | pch_feature, |
| 6503 | module_maps_feature, |
| 6504 | use_objc_modules_feature, |
| 6505 | no_enable_modules_feature, |
| 6506 | apply_default_warnings_feature, |
| 6507 | includes_feature, |
| 6508 | include_paths_feature, |
| 6509 | sysroot_feature, |
| 6510 | dependency_file_feature, |
| 6511 | pic_feature, |
| 6512 | per_object_debug_info_feature, |
| 6513 | preprocessor_defines_feature, |
| 6514 | framework_paths_feature, |
| 6515 | random_seed_feature, |
| 6516 | fdo_instrument_feature, |
| 6517 | fdo_optimize_feature, |
| 6518 | autofdo_feature, |
| 6519 | lipo_feature, |
| 6520 | coverage_feature, |
| 6521 | llvm_coverage_map_format_feature, |
| 6522 | gcc_coverage_map_format_feature, |
| 6523 | apply_default_compiler_flags_feature, |
| 6524 | include_system_dirs_feature, |
| 6525 | headerpad_feature, |
| 6526 | bitcode_embedded_feature, |
| 6527 | bitcode_embedded_markers_feature, |
| 6528 | objc_arc_feature, |
| 6529 | no_objc_arc_feature, |
| 6530 | apple_env_feature, |
Keith Smiley | 3d6d0c9 | 2020-10-22 05:18:51 -0700 | [diff] [blame] | 6531 | relative_ast_path_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6532 | user_link_flags_feature, |
| 6533 | default_link_flags_feature, |
| 6534 | version_min_feature, |
| 6535 | dead_strip_feature, |
| 6536 | cpp_linker_flags_feature, |
| 6537 | apply_implicit_frameworks_feature, |
| 6538 | link_cocoa_feature, |
| 6539 | apply_simulator_compiler_flags_feature, |
| 6540 | unfiltered_cxx_flags_feature, |
| 6541 | user_compile_flags_feature, |
| 6542 | unfiltered_compile_flags_feature, |
| 6543 | linker_param_file_feature, |
| 6544 | compiler_input_flags_feature, |
| 6545 | compiler_output_flags_feature, |
| 6546 | supports_pic_feature, |
| 6547 | objcopy_embed_flags_feature, |
Yannic Bonenberger | cf47f90 | 2020-11-12 06:13:14 -0800 | [diff] [blame] | 6548 | set_install_name, |
Keith Smiley | 8959dff | 2021-01-18 21:08:43 -0800 | [diff] [blame] | 6549 | asan_feature, |
| 6550 | tsan_feature, |
| 6551 | ubsan_feature, |
| 6552 | default_sanitizer_flags_feature, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6553 | ] |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6554 | else: |
| 6555 | fail("Unreachable") |
| 6556 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6557 | artifact_name_patterns = [] |
| 6558 | |
| 6559 | make_variables = [ |
| 6560 | make_variable( |
| 6561 | name = "STACK_FRAME_UNLIMITED", |
| 6562 | value = "-Wframe-larger-than=100000000 -Wno-vla", |
| 6563 | ), |
| 6564 | ] |
| 6565 | |
plf | ba2ccb1 | 2020-03-12 11:07:56 -0700 | [diff] [blame] | 6566 | tool_paths = dict() |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6567 | if (ctx.attr.cpu == "armeabi-v7a"): |
plf | ba2ccb1 | 2020-03-12 11:07:56 -0700 | [diff] [blame] | 6568 | tool_paths = { |
| 6569 | "ar": "/bin/false", |
| 6570 | "compat-ld": "/bin/false", |
| 6571 | "cpp": "/bin/false", |
| 6572 | "dwp": "/bin/false", |
| 6573 | "gcc": "/bin/false", |
| 6574 | "gcov": "/bin/false", |
| 6575 | "ld": "/bin/false", |
| 6576 | "nm": "/bin/false", |
| 6577 | "objcopy": "/bin/false", |
| 6578 | "objdump": "/bin/false", |
| 6579 | "strip": "/bin/false", |
| 6580 | } |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6581 | elif (ctx.attr.cpu == "darwin_x86_64" or |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 6582 | ctx.attr.cpu == "darwin_arm64" or |
| 6583 | ctx.attr.cpu == "darwin_arm64e" or |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6584 | ctx.attr.cpu == "ios_arm64" or |
| 6585 | ctx.attr.cpu == "ios_arm64e" or |
| 6586 | ctx.attr.cpu == "ios_armv7" or |
| 6587 | ctx.attr.cpu == "ios_i386" or |
| 6588 | ctx.attr.cpu == "ios_x86_64" or |
| 6589 | ctx.attr.cpu == "tvos_arm64" or |
| 6590 | ctx.attr.cpu == "tvos_x86_64" or |
| 6591 | ctx.attr.cpu == "watchos_arm64_32" or |
| 6592 | ctx.attr.cpu == "watchos_armv7k" or |
| 6593 | ctx.attr.cpu == "watchos_i386" or |
| 6594 | ctx.attr.cpu == "watchos_x86_64"): |
plf | ba2ccb1 | 2020-03-12 11:07:56 -0700 | [diff] [blame] | 6595 | tool_paths = { |
| 6596 | "ar": "libtool", |
| 6597 | "compat-ld": "/usr/bin/ld", |
| 6598 | "cpp": "/usr/bin/cpp", |
| 6599 | "dwp": "/usr/bin/dwp", |
| 6600 | "gcc": "cc_wrapper.sh", |
| 6601 | "gcov": "/usr/bin/gcov", |
| 6602 | "ld": "/usr/bin/ld", |
| 6603 | "nm": "/usr/bin/nm", |
| 6604 | "objcopy": "/usr/bin/objcopy", |
| 6605 | "objdump": "/usr/bin/objdump", |
| 6606 | "strip": "/usr/bin/strip", |
| 6607 | } |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6608 | else: |
| 6609 | fail("Unreachable") |
| 6610 | |
plf | ba2ccb1 | 2020-03-12 11:07:56 -0700 | [diff] [blame] | 6611 | tool_paths.update(ctx.attr.tool_paths_overrides) |
| 6612 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6613 | out = ctx.actions.declare_file(ctx.label.name) |
| 6614 | ctx.actions.write(out, "Fake executable") |
| 6615 | return [ |
| 6616 | cc_common.create_cc_toolchain_config_info( |
| 6617 | ctx = ctx, |
| 6618 | features = features, |
| 6619 | action_configs = action_configs, |
| 6620 | artifact_name_patterns = artifact_name_patterns, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6621 | cxx_builtin_include_directories = ctx.attr.cxx_builtin_include_directories, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6622 | toolchain_identifier = toolchain_identifier, |
| 6623 | host_system_name = host_system_name, |
| 6624 | target_system_name = target_system_name, |
| 6625 | target_cpu = target_cpu, |
| 6626 | target_libc = target_libc, |
| 6627 | compiler = compiler, |
| 6628 | abi_version = abi_version, |
| 6629 | abi_libc_version = abi_libc_version, |
plf | ba2ccb1 | 2020-03-12 11:07:56 -0700 | [diff] [blame] | 6630 | tool_paths = [tool_path(name = name, path = path) for (name, path) in tool_paths.items()], |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6631 | make_variables = make_variables, |
| 6632 | builtin_sysroot = builtin_sysroot, |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6633 | cc_target_os = cc_target_os, |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6634 | ), |
| 6635 | DefaultInfo( |
| 6636 | executable = out, |
| 6637 | ), |
| 6638 | ] |
| 6639 | |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6640 | cc_toolchain_config = rule( |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6641 | implementation = _impl, |
| 6642 | attrs = { |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6643 | "cpu": attr.string(mandatory = True), |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6644 | "compiler": attr.string(), |
rosica | ac3d06b | 2019-06-25 04:08:00 -0700 | [diff] [blame] | 6645 | "cxx_builtin_include_directories": attr.string_list(), |
plf | ba2ccb1 | 2020-03-12 11:07:56 -0700 | [diff] [blame] | 6646 | "tool_paths_overrides": attr.string_dict(), |
Daniel Wagner-Hall | ec1ace4 | 2020-10-22 07:07:45 -0700 | [diff] [blame] | 6647 | "extra_env": attr.string_dict(), |
steinman | 33b5680 | 2020-01-03 15:25:11 -0800 | [diff] [blame] | 6648 | "_xcode_config": attr.label(default = configuration_field( |
| 6649 | fragment = "apple", |
| 6650 | name = "xcode_config_label", |
| 6651 | )), |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 6652 | }, |
| 6653 | provides = [CcToolchainConfigInfo], |
| 6654 | executable = True, |
Yannic Bonenberger | cf47f90 | 2020-11-12 06:13:14 -0800 | [diff] [blame] | 6655 | fragments = ["cpp"], |
Keith Smiley | f8e38d1 | 2019-02-13 13:33:36 -0800 | [diff] [blame] | 6656 | ) |