From 9c1c622fed219cb6b9c0656ebe4a4f3c117029b9 Mon Sep 17 00:00:00 2001 From: Brentley Jones Date: Fri, 7 Jan 2022 20:03:46 -0600 Subject: [PATCH] [apple] support watchos_arm64 in toolchain (#14527) The watch-only changes from #14439 Closes #14512. PiperOrigin-RevId: 420296580 (cherry picked from commit b341802700484d11c775bf02d80f43ba3f33b218) Co-authored-by: Dan Fleming --- tools/osx/crosstool/BUILD.toolchains | 4 ++++ tools/osx/crosstool/cc_toolchain_config.bzl | 21 +++++++++++++++------ tools/osx/crosstool/osx_archs.bzl | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/tools/osx/crosstool/BUILD.toolchains b/tools/osx/crosstool/BUILD.toolchains index b8021bed31032c..0e2f7c09681527 100644 --- a/tools/osx/crosstool/BUILD.toolchains +++ b/tools/osx/crosstool/BUILD.toolchains @@ -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", diff --git a/tools/osx/crosstool/cc_toolchain_config.bzl b/tools/osx/crosstool/cc_toolchain_config.bzl index f3ae7e27a003cd..c23072e8109e3d 100644 --- a/tools/osx/crosstool/cc_toolchain_config.bzl +++ b/tools/osx/crosstool/cc_toolchain_config.bzl @@ -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"): @@ -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 = [ @@ -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 = [ @@ -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 = [ @@ -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 = [ @@ -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 = [ @@ -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, diff --git a/tools/osx/crosstool/osx_archs.bzl b/tools/osx/crosstool/osx_archs.bzl index 128c6eb5136f58..ec684eb3d1efb9 100644 --- a/tools/osx/crosstool/osx_archs.bzl +++ b/tools/osx/crosstool/osx_archs.bzl @@ -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",