From b341802700484d11c775bf02d80f43ba3f33b218 Mon Sep 17 00:00:00 2001 From: Dan Fleming Date: Fri, 7 Jan 2022 08:17:14 -0800 Subject: [PATCH] [apple] support watchos_arm64 in toolchain The watch-only changes from #14439 Closes #14512. PiperOrigin-RevId: 420296580 --- 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 d5ec734d81a453..3a280d7f1bc189 100644 --- a/tools/osx/crosstool/cc_toolchain_config.bzl +++ b/tools/osx/crosstool/cc_toolchain_config.bzl @@ -76,6 +76,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"): @@ -744,7 +746,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 = [ @@ -928,7 +931,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 = [ @@ -1000,7 +1004,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 = [ @@ -1312,7 +1317,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 = [ @@ -1762,7 +1769,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 = [ @@ -2846,7 +2854,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",