Internal change

PiperOrigin-RevId: 547735699
This commit is contained in:
MediaPipe Team 2023-07-13 02:51:29 -07:00 committed by Copybara-Service
parent 450c933cb5
commit 251c5421f6
2 changed files with 157 additions and 58 deletions

View File

@ -68,30 +68,108 @@ config_setting(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
# Note: this cannot just match "apple_platform_type": "macos" because that option # Generic MacOS.
# defaults to "macos" even when building on Linux! config_setting(
alias(
name = "macos", name = "macos",
actual = select({ constraint_values = [
":macos_i386": ":macos_i386", "@platforms//os:macos",
":macos_x86_64": ":macos_x86_64", ],
":macos_arm64": ":macos_arm64",
"//conditions:default": ":macos_i386", # Arbitrarily chosen from above.
}),
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
# Note: this also matches on crosstool_top so that it does not produce ambiguous # MacOS x86 64-bit.
# selectors when used together with "android". config_setting(
name = "macos_x86_64",
constraint_values = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
visibility = ["//visibility:public"],
)
# MacOS ARM64.
config_setting(
name = "macos_arm64",
constraint_values = [
"@platforms//os:macos",
"@platforms//cpu:arm64",
],
visibility = ["//visibility:public"],
)
# Generic iOS.
config_setting( config_setting(
name = "ios", name = "ios",
values = { constraint_values = [
"crosstool_top": "@bazel_tools//tools/cpp:toolchain", "@platforms//os:ios",
"apple_platform_type": "ios", ],
},
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
# iOS device ARM32.
config_setting(
name = "ios_armv7",
constraint_values = [
"@platforms//os:ios",
"@platforms//cpu:arm",
],
visibility = ["//visibility:public"],
)
# iOS device ARM64.
config_setting(
name = "ios_arm64",
constraint_values = [
"@platforms//os:ios",
"@platforms//cpu:arm64",
],
visibility = ["//visibility:public"],
)
# iOS device ARM64E.
config_setting(
name = "ios_arm64e",
constraint_values = [
"@platforms//os:ios",
"@platforms//cpu:arm64e",
],
visibility = ["//visibility:public"],
)
# iOS simulator x86 32-bit.
config_setting(
name = "ios_i386",
constraint_values = [
"@platforms//os:ios",
"@platforms//cpu:x86_32",
"@build_bazel_apple_support//constraints:simulator",
],
visibility = ["//visibility:public"],
)
# iOS simulator x86 64-bit.
config_setting(
name = "ios_x86_64",
constraint_values = [
"@platforms//os:ios",
"@platforms//cpu:x86_64",
"@build_bazel_apple_support//constraints:simulator",
],
visibility = ["//visibility:public"],
)
# iOS simulator ARM64.
config_setting(
name = "ios_sim_arm64",
constraint_values = [
"@platforms//os:ios",
"@platforms//cpu:arm64",
"@build_bazel_apple_support//constraints:simulator",
],
visibility = ["//visibility:public"],
)
# Generic Apple.
alias( alias(
name = "apple", name = "apple",
actual = select({ actual = select({
@ -102,49 +180,6 @@ alias(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
config_setting(
name = "macos_i386",
values = {
"apple_platform_type": "macos",
"cpu": "darwin",
},
visibility = ["//visibility:public"],
)
config_setting(
name = "macos_x86_64",
values = {
"apple_platform_type": "macos",
"cpu": "darwin_x86_64",
},
visibility = ["//visibility:public"],
)
config_setting(
name = "macos_arm64",
values = {
"apple_platform_type": "macos",
"cpu": "darwin_arm64",
},
visibility = ["//visibility:public"],
)
[
config_setting(
name = arch,
values = {"cpu": arch},
visibility = ["//visibility:public"],
)
for arch in [
"ios_i386",
"ios_x86_64",
"ios_armv7",
"ios_arm64",
"ios_arm64e",
"ios_sim_arm64",
]
]
config_setting( config_setting(
name = "windows", name = "windows",
values = {"cpu": "x64_windows"}, values = {"cpu": "x64_windows"},

64
platform_mappings Normal file
View File

@ -0,0 +1,64 @@
# This file allows automatically mapping flags such as '--cpu' to the more
# modern Bazel platforms (https://bazel.build/concepts/platforms).
# In particular, Bazel platforms lack support for Apple for now if no such
# mapping is put into place. It's inspired from:
# https://github.com/bazelbuild/rules_apple/issues/1764
platforms:
@build_bazel_apple_support//platforms:macos_x86_64
--cpu=darwin_x86_64
@build_bazel_apple_support//platforms:macos_arm64
--cpu=darwin_arm64
@build_bazel_apple_support//platforms:ios_i386
--cpu=ios_i386
@build_bazel_apple_support//platforms:ios_x86_64
--cpu=ios_x86_64
@build_bazel_apple_support//platforms:ios_sim_arm64
--cpu=ios_sim_arm64
@build_bazel_apple_support//platforms:ios_armv7
--cpu=ios_armv7
@build_bazel_apple_support//platforms:ios_arm64
--cpu=ios_arm64
@build_bazel_apple_support//platforms:ios_arm64e
--cpu=ios_arm64e
flags:
--cpu=darwin_x86_64
--apple_platform_type=macos
@build_bazel_apple_support//platforms:macos_x86_64
--cpu=darwin_arm64
--apple_platform_type=macos
@build_bazel_apple_support//platforms:macos_arm64
--cpu=ios_i386
--apple_platform_type=ios
@build_bazel_apple_support//platforms:ios_i386
--cpu=ios_x86_64
--apple_platform_type=ios
@build_bazel_apple_support//platforms:ios_x86_64
--cpu=ios_sim_arm64
--apple_platform_type=ios
@build_bazel_apple_support//platforms:ios_sim_arm64
--cpu=ios_armv7
--apple_platform_type=ios
@build_bazel_apple_support//platforms:ios_armv7
--cpu=ios_arm64
--apple_platform_type=ios
@build_bazel_apple_support//platforms:ios_arm64
--cpu=ios_arm64e
--apple_platform_type=ios
@build_bazel_apple_support//platforms:ios_arm64e