Skip to content

Commit 9c1c622

Browse files
[apple] support watchos_arm64 in toolchain (bazelbuild#14527)
The watch-only changes from bazelbuild#14439 Closes bazelbuild#14512. PiperOrigin-RevId: 420296580 (cherry picked from commit b341802) Co-authored-by: Dan Fleming <[email protected]>
1 parent 7c7f102 commit 9c1c622

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

tools/osx/crosstool/BUILD.toolchains

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ OSX_TOOLS_CONSTRAINTS = {
5252
"@platforms//os:ios",
5353
"@platforms//cpu:x86_64",
5454
],
55+
"watchos_arm64": [
56+
"@platforms//os:ios",
57+
"@platforms//cpu:aarch64",
58+
],
5559
"watchos_arm64_32": [
5660
"@platforms//os:ios",
5761
"@platforms//cpu:aarch64",

tools/osx/crosstool/cc_toolchain_config.bzl

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def _impl(ctx):
7575
target_system_name = "x86_64-apple-ios"
7676
elif (ctx.attr.cpu == "ios_sim_arm64"):
7777
target_system_name = "arm64-apple-ios-simulator"
78+
elif (ctx.attr.cpu == "watchos_arm64"):
79+
target_system_name = "arm64-apple-watchos-simulator"
7880
elif (ctx.attr.cpu == "darwin_x86_64"):
7981
target_system_name = "x86_64-apple-macosx"
8082
elif (ctx.attr.cpu == "darwin_arm64"):
@@ -743,7 +745,8 @@ def _impl(ctx):
743745
ctx.attr.cpu == "watchos_arm64_32" or
744746
ctx.attr.cpu == "watchos_armv7k" or
745747
ctx.attr.cpu == "watchos_i386" or
746-
ctx.attr.cpu == "watchos_x86_64"):
748+
ctx.attr.cpu == "watchos_x86_64" or
749+
ctx.attr.cpu == "watchos_arm64"):
747750
apply_default_compiler_flags_feature = feature(
748751
name = "apply_default_compiler_flags",
749752
flag_sets = [
@@ -927,7 +930,8 @@ def _impl(ctx):
927930
ctx.attr.cpu == "ios_sim_arm64" or
928931
ctx.attr.cpu == "tvos_x86_64" or
929932
ctx.attr.cpu == "watchos_i386" or
930-
ctx.attr.cpu == "watchos_x86_64"):
933+
ctx.attr.cpu == "watchos_x86_64" or
934+
ctx.attr.cpu == "watchos_arm64"):
931935
apply_simulator_compiler_flags_feature = feature(
932936
name = "apply_simulator_compiler_flags",
933937
flag_sets = [
@@ -999,7 +1003,8 @@ def _impl(ctx):
9991003
ctx.attr.cpu == "watchos_arm64_32" or
10001004
ctx.attr.cpu == "watchos_armv7k" or
10011005
ctx.attr.cpu == "watchos_i386" or
1002-
ctx.attr.cpu == "watchos_x86_64"):
1006+
ctx.attr.cpu == "watchos_x86_64" or
1007+
ctx.attr.cpu == "watchos_arm64"):
10031008
contains_objc_source_feature = feature(
10041009
name = "contains_objc_source",
10051010
flag_sets = [
@@ -1311,7 +1316,9 @@ def _impl(ctx):
13111316
),
13121317
],
13131318
)
1314-
elif (ctx.attr.cpu == "watchos_i386" or ctx.attr.cpu == "watchos_x86_64"):
1319+
elif (ctx.attr.cpu == "watchos_i386" or
1320+
ctx.attr.cpu == "watchos_x86_64" or
1321+
ctx.attr.cpu == "watchos_arm64"):
13151322
version_min_feature = feature(
13161323
name = "version_min",
13171324
flag_sets = [
@@ -1761,7 +1768,8 @@ def _impl(ctx):
17611768
ctx.attr.cpu == "watchos_arm64_32" or
17621769
ctx.attr.cpu == "watchos_armv7k" or
17631770
ctx.attr.cpu == "watchos_i386" or
1764-
ctx.attr.cpu == "watchos_x86_64"):
1771+
ctx.attr.cpu == "watchos_x86_64" or
1772+
ctx.attr.cpu == "watchos_arm64"):
17651773
apply_implicit_frameworks_feature = feature(
17661774
name = "apply_implicit_frameworks",
17671775
flag_sets = [
@@ -2845,7 +2853,8 @@ def _impl(ctx):
28452853
ctx.attr.cpu == "watchos_arm64_32" or
28462854
ctx.attr.cpu == "watchos_armv7k" or
28472855
ctx.attr.cpu == "watchos_i386" or
2848-
ctx.attr.cpu == "watchos_x86_64"):
2856+
ctx.attr.cpu == "watchos_x86_64" or
2857+
ctx.attr.cpu == "watchos_arm64"):
28492858
features = [
28502859
fastbuild_feature,
28512860
no_legacy_features_feature,

tools/osx/crosstool/osx_archs.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ OSX_TOOLS_NON_DEVICE_ARCHS = [
2121
"ios_i386",
2222
"ios_x86_64",
2323
"ios_sim_arm64",
24+
"watchos_arm64",
2425
"watchos_i386",
2526
"watchos_x86_64",
2627
"tvos_x86_64",

0 commit comments

Comments
 (0)