Skip to content

Commit

Permalink
[apple] support watchos_arm64 in toolchain (bazelbuild#14527)
Browse files Browse the repository at this point in the history
The watch-only changes from bazelbuild#14439

Closes bazelbuild#14512.

PiperOrigin-RevId: 420296580
(cherry picked from commit b341802)

Co-authored-by: Dan Fleming <dflems@spotify.com>
  • Loading branch information
brentleyjones and dflems authored Jan 8, 2022
1 parent 7c7f102 commit 9c1c622
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
4 changes: 4 additions & 0 deletions tools/osx/crosstool/BUILD.toolchains
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ OSX_TOOLS_CONSTRAINTS = {
"@platforms//os:ios",
"@platforms//cpu:x86_64",
],
"watchos_arm64": [
"@platforms//os:ios",
"@platforms//cpu:aarch64",
],
"watchos_arm64_32": [
"@platforms//os:ios",
"@platforms//cpu:aarch64",
Expand Down
21 changes: 15 additions & 6 deletions tools/osx/crosstool/cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def _impl(ctx):
target_system_name = "x86_64-apple-ios"
elif (ctx.attr.cpu == "ios_sim_arm64"):
target_system_name = "arm64-apple-ios-simulator"
elif (ctx.attr.cpu == "watchos_arm64"):
target_system_name = "arm64-apple-watchos-simulator"
elif (ctx.attr.cpu == "darwin_x86_64"):
target_system_name = "x86_64-apple-macosx"
elif (ctx.attr.cpu == "darwin_arm64"):
Expand Down Expand Up @@ -743,7 +745,8 @@ def _impl(ctx):
ctx.attr.cpu == "watchos_arm64_32" or
ctx.attr.cpu == "watchos_armv7k" or
ctx.attr.cpu == "watchos_i386" or
ctx.attr.cpu == "watchos_x86_64"):
ctx.attr.cpu == "watchos_x86_64" or
ctx.attr.cpu == "watchos_arm64"):
apply_default_compiler_flags_feature = feature(
name = "apply_default_compiler_flags",
flag_sets = [
Expand Down Expand Up @@ -927,7 +930,8 @@ def _impl(ctx):
ctx.attr.cpu == "ios_sim_arm64" or
ctx.attr.cpu == "tvos_x86_64" or
ctx.attr.cpu == "watchos_i386" or
ctx.attr.cpu == "watchos_x86_64"):
ctx.attr.cpu == "watchos_x86_64" or
ctx.attr.cpu == "watchos_arm64"):
apply_simulator_compiler_flags_feature = feature(
name = "apply_simulator_compiler_flags",
flag_sets = [
Expand Down Expand Up @@ -999,7 +1003,8 @@ def _impl(ctx):
ctx.attr.cpu == "watchos_arm64_32" or
ctx.attr.cpu == "watchos_armv7k" or
ctx.attr.cpu == "watchos_i386" or
ctx.attr.cpu == "watchos_x86_64"):
ctx.attr.cpu == "watchos_x86_64" or
ctx.attr.cpu == "watchos_arm64"):
contains_objc_source_feature = feature(
name = "contains_objc_source",
flag_sets = [
Expand Down Expand Up @@ -1311,7 +1316,9 @@ def _impl(ctx):
),
],
)
elif (ctx.attr.cpu == "watchos_i386" or ctx.attr.cpu == "watchos_x86_64"):
elif (ctx.attr.cpu == "watchos_i386" or
ctx.attr.cpu == "watchos_x86_64" or
ctx.attr.cpu == "watchos_arm64"):
version_min_feature = feature(
name = "version_min",
flag_sets = [
Expand Down Expand Up @@ -1761,7 +1768,8 @@ def _impl(ctx):
ctx.attr.cpu == "watchos_arm64_32" or
ctx.attr.cpu == "watchos_armv7k" or
ctx.attr.cpu == "watchos_i386" or
ctx.attr.cpu == "watchos_x86_64"):
ctx.attr.cpu == "watchos_x86_64" or
ctx.attr.cpu == "watchos_arm64"):
apply_implicit_frameworks_feature = feature(
name = "apply_implicit_frameworks",
flag_sets = [
Expand Down Expand Up @@ -2845,7 +2853,8 @@ def _impl(ctx):
ctx.attr.cpu == "watchos_arm64_32" or
ctx.attr.cpu == "watchos_armv7k" or
ctx.attr.cpu == "watchos_i386" or
ctx.attr.cpu == "watchos_x86_64"):
ctx.attr.cpu == "watchos_x86_64" or
ctx.attr.cpu == "watchos_arm64"):
features = [
fastbuild_feature,
no_legacy_features_feature,
Expand Down
1 change: 1 addition & 0 deletions tools/osx/crosstool/osx_archs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ OSX_TOOLS_NON_DEVICE_ARCHS = [
"ios_i386",
"ios_x86_64",
"ios_sim_arm64",
"watchos_arm64",
"watchos_i386",
"watchos_x86_64",
"tvos_x86_64",
Expand Down

0 comments on commit 9c1c622

Please sign in to comment.