No public description
PiperOrigin-RevId: 560652313
This commit is contained in:
parent
d0bf0dd021
commit
b22dcf9ce6
230
mediapipe/BUILD
230
mediapipe/BUILD
|
@ -14,81 +14,155 @@
|
||||||
|
|
||||||
licenses(["notice"]) # Apache 2.0
|
licenses(["notice"]) # Apache 2.0
|
||||||
|
|
||||||
# Note: yes, these need to use "//external:android/crosstool", not
|
load("@mediapipe//mediapipe:platforms.bzl", "config_setting_and_platform")
|
||||||
# @androidndk//:default_crosstool.
|
|
||||||
|
|
||||||
|
# Generic Android
|
||||||
config_setting(
|
config_setting(
|
||||||
name = "android",
|
name = "android",
|
||||||
values = {"crosstool_top": "//external:android/crosstool"},
|
constraint_values = [
|
||||||
|
"@platforms//os:android",
|
||||||
|
],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
config_setting(
|
# Android x86 32-bit.
|
||||||
|
config_setting_and_platform(
|
||||||
name = "android_x86",
|
name = "android_x86",
|
||||||
values = {
|
constraint_values = [
|
||||||
"crosstool_top": "//external:android/crosstool",
|
"@platforms//os:android",
|
||||||
"cpu": "x86",
|
"@platforms//cpu:x86_32",
|
||||||
},
|
],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
config_setting(
|
# Android x86 64-bit.
|
||||||
|
config_setting_and_platform(
|
||||||
name = "android_x86_64",
|
name = "android_x86_64",
|
||||||
values = {
|
constraint_values = [
|
||||||
"crosstool_top": "//external:android/crosstool",
|
"@platforms//os:android",
|
||||||
"cpu": "x86_64",
|
"@platforms//cpu:x86_64",
|
||||||
},
|
],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
config_setting(
|
# Android ARMv7.
|
||||||
name = "android_armeabi",
|
config_setting_and_platform(
|
||||||
values = {
|
|
||||||
"crosstool_top": "//external:android/crosstool",
|
|
||||||
"cpu": "armeabi",
|
|
||||||
},
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
config_setting(
|
|
||||||
name = "android_arm",
|
name = "android_arm",
|
||||||
values = {
|
constraint_values = [
|
||||||
"crosstool_top": "//external:android/crosstool",
|
"@platforms//os:android",
|
||||||
"cpu": "armeabi-v7a",
|
"@platforms//cpu:armv7",
|
||||||
},
|
],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
config_setting(
|
# Android ARM64.
|
||||||
|
config_setting_and_platform(
|
||||||
name = "android_arm64",
|
name = "android_arm64",
|
||||||
values = {
|
constraint_values = [
|
||||||
"crosstool_top": "//external:android/crosstool",
|
"@platforms//os:android",
|
||||||
"cpu": "arm64-v8a",
|
"@platforms//cpu:arm64",
|
||||||
},
|
],
|
||||||
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_and_platform(
|
||||||
|
name = "macos_x86_64",
|
||||||
|
constraint_values = [
|
||||||
|
"@platforms//os:macos",
|
||||||
|
"@platforms//cpu:x86_64",
|
||||||
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
# MacOS ARM64.
|
||||||
|
config_setting_and_platform(
|
||||||
|
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"],
|
||||||
|
)
|
||||||
|
|
||||||
|
# iOS device ARM32.
|
||||||
|
config_setting_and_platform(
|
||||||
|
name = "ios_armv7",
|
||||||
|
constraint_values = [
|
||||||
|
"@platforms//os:ios",
|
||||||
|
"@platforms//cpu:arm",
|
||||||
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
# iOS device ARM64.
|
||||||
|
config_setting_and_platform(
|
||||||
|
name = "ios_arm64",
|
||||||
|
constraint_values = [
|
||||||
|
"@platforms//os:ios",
|
||||||
|
"@platforms//cpu:arm64",
|
||||||
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
# iOS device ARM64E.
|
||||||
|
config_setting_and_platform(
|
||||||
|
name = "ios_arm64e",
|
||||||
|
constraint_values = [
|
||||||
|
"@platforms//os:ios",
|
||||||
|
"@platforms//cpu:arm64e",
|
||||||
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
# iOS simulator x86 32-bit.
|
||||||
|
config_setting_and_platform(
|
||||||
|
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_and_platform(
|
||||||
|
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_and_platform(
|
||||||
|
name = "ios_sim_arm64",
|
||||||
|
constraint_values = [
|
||||||
|
"@platforms//os:ios",
|
||||||
|
"@platforms//cpu:arm64",
|
||||||
|
"@build_bazel_apple_support//constraints:simulator",
|
||||||
|
],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -102,52 +176,24 @@ alias(
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
config_setting(
|
# Windows 64-bit.
|
||||||
name = "macos_i386",
|
config_setting_and_platform(
|
||||||
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(
|
|
||||||
name = "windows",
|
name = "windows",
|
||||||
values = {"cpu": "x64_windows"},
|
constraint_values = [
|
||||||
|
"@platforms//os:windows",
|
||||||
|
"@platforms//cpu:x86_64",
|
||||||
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
# Linux 64-bit.
|
||||||
|
config_setting_and_platform(
|
||||||
|
name = "linux",
|
||||||
|
constraint_values = [
|
||||||
|
"@platforms//os:linux",
|
||||||
|
"@platforms//cpu:x86_64",
|
||||||
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
exports_files(
|
exports_files(
|
||||||
|
|
|
@ -197,7 +197,6 @@ def _mediapipe_jni(name, gen_libmediapipe, calculators = []):
|
||||||
name = name + "_opencv_cc_lib",
|
name = name + "_opencv_cc_lib",
|
||||||
srcs = select({
|
srcs = select({
|
||||||
"//mediapipe:android_arm64": ["@android_opencv//:libopencv_java3_so_arm64-v8a"],
|
"//mediapipe:android_arm64": ["@android_opencv//:libopencv_java3_so_arm64-v8a"],
|
||||||
"//mediapipe:android_armeabi": ["@android_opencv//:libopencv_java3_so_armeabi-v7a"],
|
|
||||||
"//mediapipe:android_arm": ["@android_opencv//:libopencv_java3_so_armeabi-v7a"],
|
"//mediapipe:android_arm": ["@android_opencv//:libopencv_java3_so_armeabi-v7a"],
|
||||||
"//mediapipe:android_x86": ["@android_opencv//:libopencv_java3_so_x86"],
|
"//mediapipe:android_x86": ["@android_opencv//:libopencv_java3_so_x86"],
|
||||||
"//mediapipe:android_x86_64": ["@android_opencv//:libopencv_java3_so_x86_64"],
|
"//mediapipe:android_x86_64": ["@android_opencv//:libopencv_java3_so_x86_64"],
|
||||||
|
|
38
mediapipe/platforms.bzl
Normal file
38
mediapipe/platforms.bzl
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
# Copyright 2023 The MediaPipe Authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
"""Build rule to generate 'config_setting' and 'platform' with the same constraints."""
|
||||||
|
|
||||||
|
def config_setting_and_platform(
|
||||||
|
name,
|
||||||
|
constraint_values = [],
|
||||||
|
visibility = None):
|
||||||
|
"""Defines a 'config_setting' and 'platform' with the same constraints.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name: the name for the 'config_setting'. The platform will be suffixed with '_platform'.
|
||||||
|
constraint_values: the constraints to meet.
|
||||||
|
visibility: the target visibility.
|
||||||
|
"""
|
||||||
|
native.config_setting(
|
||||||
|
name = name,
|
||||||
|
constraint_values = constraint_values,
|
||||||
|
visibility = visibility,
|
||||||
|
)
|
||||||
|
|
||||||
|
native.platform(
|
||||||
|
name = name + "_platform",
|
||||||
|
constraint_values = constraint_values,
|
||||||
|
visibility = visibility,
|
||||||
|
)
|
|
@ -300,7 +300,6 @@ def _mediapipe_tasks_aar(name, srcs, manifest, java_proto_lite_targets, native_l
|
||||||
name = name + "_jni_opencv_cc_lib",
|
name = name + "_jni_opencv_cc_lib",
|
||||||
srcs = select({
|
srcs = select({
|
||||||
"//mediapipe:android_arm64": ["@android_opencv//:libopencv_java3_so_arm64-v8a"],
|
"//mediapipe:android_arm64": ["@android_opencv//:libopencv_java3_so_arm64-v8a"],
|
||||||
"//mediapipe:android_armeabi": ["@android_opencv//:libopencv_java3_so_armeabi-v7a"],
|
|
||||||
"//mediapipe:android_arm": ["@android_opencv//:libopencv_java3_so_armeabi-v7a"],
|
"//mediapipe:android_arm": ["@android_opencv//:libopencv_java3_so_armeabi-v7a"],
|
||||||
"//mediapipe:android_x86": ["@android_opencv//:libopencv_java3_so_x86"],
|
"//mediapipe:android_x86": ["@android_opencv//:libopencv_java3_so_x86"],
|
||||||
"//mediapipe:android_x86_64": ["@android_opencv//:libopencv_java3_so_x86_64"],
|
"//mediapipe:android_x86_64": ["@android_opencv//:libopencv_java3_so_x86_64"],
|
||||||
|
|
61
platform_mappings
Normal file
61
platform_mappings
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# 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
|
||||||
|
|
||||||
|
flags:
|
||||||
|
--cpu=x86
|
||||||
|
--crosstool_top=//external:android/crosstool
|
||||||
|
@mediapipe//mediapipe:android_x86_platform
|
||||||
|
|
||||||
|
--cpu=x86_64
|
||||||
|
--crosstool_top=//external:android/crosstool
|
||||||
|
@mediapipe//mediapipe:android_x86_64_platform
|
||||||
|
|
||||||
|
--cpu=armeabi-v7a
|
||||||
|
--crosstool_top=//external:android/crosstool
|
||||||
|
@mediapipe//mediapipe:android_arm_platform
|
||||||
|
|
||||||
|
--cpu=arm64-v8a
|
||||||
|
--crosstool_top=//external:android/crosstool
|
||||||
|
@mediapipe//mediapipe:android_arm64_platform
|
||||||
|
|
||||||
|
--cpu=darwin_x86_64
|
||||||
|
--apple_platform_type=macos
|
||||||
|
@@mediapipe//mediapipe:macos_x86_64_platform
|
||||||
|
|
||||||
|
--cpu=darwin_arm64
|
||||||
|
--apple_platform_type=macos
|
||||||
|
@@mediapipe//mediapipe:macos_arm64_platform
|
||||||
|
|
||||||
|
--cpu=ios_i386
|
||||||
|
--apple_platform_type=ios
|
||||||
|
@@mediapipe//mediapipe:ios_i386_platform
|
||||||
|
|
||||||
|
--cpu=ios_x86_64
|
||||||
|
--apple_platform_type=ios
|
||||||
|
@@mediapipe//mediapipe:ios_x86_64_platform
|
||||||
|
|
||||||
|
--cpu=ios_sim_arm64
|
||||||
|
--apple_platform_type=ios
|
||||||
|
@@mediapipe//mediapipe:ios_sim_arm64_platform
|
||||||
|
|
||||||
|
--cpu=ios_armv7
|
||||||
|
--apple_platform_type=ios
|
||||||
|
@@mediapipe//mediapipe:ios_armv7_platform
|
||||||
|
|
||||||
|
--cpu=ios_arm64
|
||||||
|
--apple_platform_type=ios
|
||||||
|
@@mediapipe//mediapipe:ios_arm64_platform
|
||||||
|
|
||||||
|
--cpu=ios_arm64e
|
||||||
|
--apple_platform_type=ios
|
||||||
|
@@mediapipe//mediapipe:ios_arm64e_platform
|
||||||
|
|
||||||
|
--cpu=x64_windows
|
||||||
|
@mediapipe//mediapipe:windows_platform
|
||||||
|
|
||||||
|
--cpu=k8
|
||||||
|
@mediapipe//mediapipe:linux_platform
|
5
third_party/BUILD
vendored
5
third_party/BUILD
vendored
|
@ -32,9 +32,6 @@ cc_library(
|
||||||
"//mediapipe:android_x86_64": [
|
"//mediapipe:android_x86_64": [
|
||||||
"@com_github_glog_glog_no_gflags//:glog",
|
"@com_github_glog_glog_no_gflags//:glog",
|
||||||
],
|
],
|
||||||
"//mediapipe:android_armeabi": [
|
|
||||||
"@com_github_glog_glog_no_gflags//:glog",
|
|
||||||
],
|
|
||||||
"//mediapipe:android_arm": [
|
"//mediapipe:android_arm": [
|
||||||
"@com_github_glog_glog_no_gflags//:glog",
|
"@com_github_glog_glog_no_gflags//:glog",
|
||||||
],
|
],
|
||||||
|
@ -249,7 +246,6 @@ alias(
|
||||||
actual = select({
|
actual = select({
|
||||||
"//mediapipe:android_x86": "@android_opencv//:libopencv_x86",
|
"//mediapipe:android_x86": "@android_opencv//:libopencv_x86",
|
||||||
"//mediapipe:android_x86_64": "@android_opencv//:libopencv_x86_64",
|
"//mediapipe:android_x86_64": "@android_opencv//:libopencv_x86_64",
|
||||||
"//mediapipe:android_armeabi": "@android_opencv//:libopencv_armeabi-v7a",
|
|
||||||
"//mediapipe:android_arm": "@android_opencv//:libopencv_armeabi-v7a",
|
"//mediapipe:android_arm": "@android_opencv//:libopencv_armeabi-v7a",
|
||||||
"//mediapipe:android_arm64": "@android_opencv//:libopencv_arm64-v8a",
|
"//mediapipe:android_arm64": "@android_opencv//:libopencv_arm64-v8a",
|
||||||
"//mediapipe:ios": "@ios_opencv//:opencv",
|
"//mediapipe:ios": "@ios_opencv//:opencv",
|
||||||
|
@ -265,7 +261,6 @@ cc_library(
|
||||||
deps = select({
|
deps = select({
|
||||||
"//mediapipe:android_x86": [],
|
"//mediapipe:android_x86": [],
|
||||||
"//mediapipe:android_x86_64": [],
|
"//mediapipe:android_x86_64": [],
|
||||||
"//mediapipe:android_armeabi": [],
|
|
||||||
"//mediapipe:android_arm": [],
|
"//mediapipe:android_arm": [],
|
||||||
"//mediapipe:android_arm64": [],
|
"//mediapipe:android_arm64": [],
|
||||||
"//mediapipe:ios": [],
|
"//mediapipe:ios": [],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user