Create Build Rules for Apple Frameworks

PiperOrigin-RevId: 493426040
This commit is contained in:
Sebastian Schmidt 2022-12-06 15:16:42 -08:00 committed by Copybara-Service
parent 9bc7b120de
commit fca0f5806b
5 changed files with 134 additions and 91 deletions

View File

@ -29,12 +29,6 @@ objc_library(
"Base.lproj/LaunchScreen.storyboard", "Base.lproj/LaunchScreen.storyboard",
"Base.lproj/Main.storyboard", "Base.lproj/Main.storyboard",
], ],
sdk_frameworks = [
"AVFoundation",
"CoreGraphics",
"CoreMedia",
"UIKit",
],
visibility = [ visibility = [
"//mediapipe:__subpackages__", "//mediapipe:__subpackages__",
], ],
@ -42,6 +36,10 @@ objc_library(
"//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_framework_ios",
"//mediapipe/objc:mediapipe_input_sources_ios", "//mediapipe/objc:mediapipe_input_sources_ios",
"//mediapipe/objc:mediapipe_layer_renderer", "//mediapipe/objc:mediapipe_layer_renderer",
"//third_party/apple_frameworks:AVFoundation",
"//third_party/apple_frameworks:CoreGraphics",
"//third_party/apple_frameworks:CoreMedia",
"//third_party/apple_frameworks:UIKit",
], ],
) )

View File

@ -73,13 +73,11 @@ objc_library(
"//mediapipe/modules/face_landmark:face_landmark.tflite", "//mediapipe/modules/face_landmark:face_landmark.tflite",
], ],
features = ["-layering_check"], features = ["-layering_check"],
sdk_frameworks = [
"AVFoundation",
"CoreGraphics",
"CoreMedia",
"UIKit",
],
deps = [ deps = [
"//third_party/apple_frameworks:AVFoundation",
"//third_party/apple_frameworks:CoreGraphics",
"//third_party/apple_frameworks:CoreMedia",
"//third_party/apple_frameworks:UIKit",
"//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_framework_ios",
"//mediapipe/objc:mediapipe_input_sources_ios", "//mediapipe/objc:mediapipe_input_sources_ios",
"//mediapipe/objc:mediapipe_layer_renderer", "//mediapipe/objc:mediapipe_layer_renderer",

View File

@ -472,13 +472,13 @@ objc_library(
copts = [ copts = [
"-Wno-shorten-64-to-32", "-Wno-shorten-64-to-32",
], ],
sdk_frameworks = [
"Accelerate",
"CoreGraphics",
"CoreVideo",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = ["//mediapipe/objc:util"], deps = [
"//mediapipe/objc:util",
"//third_party/apple_frameworks:Accelerate",
"//third_party/apple_frameworks:CoreGraphics",
"//third_party/apple_frameworks:CoreVideo",
],
) )
objc_library( objc_library(
@ -510,13 +510,11 @@ objc_library(
"-x objective-c++", "-x objective-c++",
"-Wno-shorten-64-to-32", "-Wno-shorten-64-to-32",
], ],
sdk_frameworks = [
"CoreVideo",
"Metal",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_framework_ios",
"//third_party/apple_frameworks:CoreVideo",
"//third_party/apple_frameworks:Metal",
"@com_google_absl//absl/time", "@com_google_absl//absl/time",
"@google_toolbox_for_mac//:GTM_Defines", "@google_toolbox_for_mac//:GTM_Defines",
], ],
@ -808,15 +806,13 @@ objc_library(
"-Wno-shorten-64-to-32", "-Wno-shorten-64-to-32",
], ],
features = ["-layering_check"], features = ["-layering_check"],
sdk_frameworks = [
"CoreVideo",
"Metal",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":gpu_shared_data_internal", ":gpu_shared_data_internal",
":graph_support", ":graph_support",
"//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_framework_ios",
"//third_party/apple_frameworks:CoreVideo",
"//third_party/apple_frameworks:Metal",
"@google_toolbox_for_mac//:GTM_Defines", "@google_toolbox_for_mac//:GTM_Defines",
], ],
) )
@ -1020,16 +1016,14 @@ objc_library(
name = "metal_copy_calculator", name = "metal_copy_calculator",
srcs = ["MetalCopyCalculator.mm"], srcs = ["MetalCopyCalculator.mm"],
features = ["-layering_check"], features = ["-layering_check"],
sdk_frameworks = [
"CoreVideo",
"Metal",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":MPPMetalHelper", ":MPPMetalHelper",
":simple_shaders_mtl", ":simple_shaders_mtl",
"//mediapipe/gpu:copy_calculator_cc_proto", "//mediapipe/gpu:copy_calculator_cc_proto",
"//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_framework_ios",
"//third_party/apple_frameworks:CoreVideo",
"//third_party/apple_frameworks:Metal",
], ],
alwayslink = 1, alwayslink = 1,
) )
@ -1038,15 +1032,13 @@ objc_library(
name = "metal_rgb_weight_calculator", name = "metal_rgb_weight_calculator",
srcs = ["MetalRgbWeightCalculator.mm"], srcs = ["MetalRgbWeightCalculator.mm"],
features = ["-layering_check"], features = ["-layering_check"],
sdk_frameworks = [
"CoreVideo",
"Metal",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":MPPMetalHelper", ":MPPMetalHelper",
":simple_shaders_mtl", ":simple_shaders_mtl",
"//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_framework_ios",
"//third_party/apple_frameworks:CoreVideo",
"//third_party/apple_frameworks:Metal",
], ],
alwayslink = 1, alwayslink = 1,
) )
@ -1055,15 +1047,13 @@ objc_library(
name = "metal_sobel_calculator", name = "metal_sobel_calculator",
srcs = ["MetalSobelCalculator.mm"], srcs = ["MetalSobelCalculator.mm"],
features = ["-layering_check"], features = ["-layering_check"],
sdk_frameworks = [
"CoreVideo",
"Metal",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":MPPMetalHelper", ":MPPMetalHelper",
":simple_shaders_mtl", ":simple_shaders_mtl",
"//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_framework_ios",
"//third_party/apple_frameworks:CoreVideo",
"//third_party/apple_frameworks:Metal",
], ],
alwayslink = 1, alwayslink = 1,
) )
@ -1072,15 +1062,13 @@ objc_library(
name = "metal_sobel_compute_calculator", name = "metal_sobel_compute_calculator",
srcs = ["MetalSobelComputeCalculator.mm"], srcs = ["MetalSobelComputeCalculator.mm"],
features = ["-layering_check"], features = ["-layering_check"],
sdk_frameworks = [
"CoreVideo",
"Metal",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":MPPMetalHelper", ":MPPMetalHelper",
":simple_shaders_mtl", ":simple_shaders_mtl",
"//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_framework_ios",
"//third_party/apple_frameworks:CoreVideo",
"//third_party/apple_frameworks:Metal",
], ],
alwayslink = 1, alwayslink = 1,
) )
@ -1090,15 +1078,13 @@ objc_library(
srcs = ["MPSSobelCalculator.mm"], srcs = ["MPSSobelCalculator.mm"],
copts = ["-std=c++17"], copts = ["-std=c++17"],
features = ["-layering_check"], features = ["-layering_check"],
sdk_frameworks = [
"CoreVideo",
"Metal",
"MetalPerformanceShaders",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":MPPMetalHelper", ":MPPMetalHelper",
"//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_framework_ios",
"//third_party/apple_frameworks:CoreVideo",
"//third_party/apple_frameworks:Metal",
"//third_party/apple_frameworks:MetalPerformanceShaders",
], ],
alwayslink = 1, alwayslink = 1,
) )
@ -1106,15 +1092,13 @@ objc_library(
objc_library( objc_library(
name = "mps_threshold_calculator", name = "mps_threshold_calculator",
srcs = ["MPSThresholdCalculator.mm"], srcs = ["MPSThresholdCalculator.mm"],
sdk_frameworks = [
"CoreVideo",
"Metal",
"MetalPerformanceShaders",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":MPPMetalHelper", ":MPPMetalHelper",
"//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_framework_ios",
"//third_party/apple_frameworks:CoreVideo",
"//third_party/apple_frameworks:Metal",
"//third_party/apple_frameworks:MetalPerformanceShaders",
], ],
alwayslink = 1, alwayslink = 1,
) )

View File

@ -68,7 +68,6 @@ objc_library(
copts = [ copts = [
"-Wno-shorten-64-to-32", "-Wno-shorten-64-to-32",
], ],
sdk_frameworks = ["Accelerate"],
# This build rule is public to allow external customers to build their own iOS apps. # This build rule is public to allow external customers to build their own iOS apps.
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
@ -90,6 +89,7 @@ objc_library(
"//mediapipe/gpu:metal_shared_resources", "//mediapipe/gpu:metal_shared_resources",
"//mediapipe/gpu:pixel_buffer_pool_util", "//mediapipe/gpu:pixel_buffer_pool_util",
"//mediapipe/util:cpu_util", "//mediapipe/util:cpu_util",
"//third_party/apple_frameworks:Accelerate",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
@ -120,13 +120,13 @@ objc_library(
], ],
"//conditions:default": [], "//conditions:default": [],
}), }),
sdk_frameworks = [
"AVFoundation",
"CoreVideo",
"Foundation",
],
# This build rule is public to allow external customers to build their own iOS apps. # This build rule is public to allow external customers to build their own iOS apps.
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [
"//third_party/apple_frameworks:AVFoundation",
"//third_party/apple_frameworks:CoreVideo",
"//third_party/apple_frameworks:Foundation",
],
) )
objc_library( objc_library(
@ -140,16 +140,14 @@ objc_library(
copts = [ copts = [
"-Wno-shorten-64-to-32", "-Wno-shorten-64-to-32",
], ],
sdk_frameworks = [
"Foundation",
"GLKit",
],
visibility = ["//mediapipe/framework:mediapipe_internal"], visibility = ["//mediapipe/framework:mediapipe_internal"],
deps = [ deps = [
":mediapipe_framework_ios", ":mediapipe_framework_ios",
"//mediapipe/gpu:gl_calculator_helper", "//mediapipe/gpu:gl_calculator_helper",
"//mediapipe/gpu:gl_quad_renderer", "//mediapipe/gpu:gl_quad_renderer",
"//mediapipe/gpu:gl_simple_shaders", "//mediapipe/gpu:gl_simple_shaders",
"//third_party/apple_frameworks:Foundation",
"//third_party/apple_frameworks:GLKit",
], ],
) )
@ -164,16 +162,14 @@ objc_library(
copts = [ copts = [
"-Wno-shorten-64-to-32", "-Wno-shorten-64-to-32",
], ],
sdk_frameworks = [
"Foundation",
"GLKit",
],
# This build rule is public to allow external customers to build their own iOS apps. # This build rule is public to allow external customers to build their own iOS apps.
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":mediapipe_framework_ios", ":mediapipe_framework_ios",
":mediapipe_gl_view_renderer", ":mediapipe_gl_view_renderer",
"//mediapipe/gpu:gl_calculator_helper", "//mediapipe/gpu:gl_calculator_helper",
"//third_party/apple_frameworks:Foundation",
"//third_party/apple_frameworks:GLKit",
], ],
) )
@ -188,13 +184,11 @@ objc_library(
copts = [ copts = [
"-Wno-shorten-64-to-32", "-Wno-shorten-64-to-32",
], ],
sdk_frameworks = [
"CoreVideo",
"Foundation",
],
visibility = ["//mediapipe/framework:mediapipe_internal"], visibility = ["//mediapipe/framework:mediapipe_internal"],
deps = [ deps = [
":mediapipe_framework_ios", ":mediapipe_framework_ios",
"//third_party/apple_frameworks:CoreVideo",
"//third_party/apple_frameworks:Foundation",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
) )
@ -211,23 +205,21 @@ objc_library(
copts = [ copts = [
"-Wno-shorten-64-to-32", "-Wno-shorten-64-to-32",
], ],
sdk_frameworks = [
"AVFoundation",
"Accelerate",
"CoreGraphics",
"CoreMedia",
"CoreVideo",
"GLKit",
"OpenGLES",
"QuartzCore",
"UIKit",
],
visibility = ["//mediapipe/framework:mediapipe_internal"], visibility = ["//mediapipe/framework:mediapipe_internal"],
deps = [ deps = [
":CGImageRefUtils", ":CGImageRefUtils",
":Weakify", ":Weakify",
":mediapipe_framework_ios", ":mediapipe_framework_ios",
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//third_party/apple_frameworks:AVFoundation",
"//third_party/apple_frameworks:Accelerate",
"//third_party/apple_frameworks:CoreGraphics",
"//third_party/apple_frameworks:CoreMedia",
"//third_party/apple_frameworks:CoreVideo",
"//third_party/apple_frameworks:GLKit",
"//third_party/apple_frameworks:OpenGLES",
"//third_party/apple_frameworks:QuartzCore",
"//third_party/apple_frameworks:UIKit",
], ],
) )
@ -245,16 +237,6 @@ objc_library(
data = [ data = [
"testdata/googlelogo_color_272x92dp.png", "testdata/googlelogo_color_272x92dp.png",
], ],
sdk_frameworks = [
"AVFoundation",
"Accelerate",
"CoreGraphics",
"CoreMedia",
"CoreVideo",
"GLKit",
"QuartzCore",
"UIKit",
],
visibility = ["//mediapipe/framework:mediapipe_internal"], visibility = ["//mediapipe/framework:mediapipe_internal"],
deps = [ deps = [
":CGImageRefUtils", ":CGImageRefUtils",
@ -263,6 +245,14 @@ objc_library(
":mediapipe_framework_ios", ":mediapipe_framework_ios",
":mediapipe_input_sources_ios", ":mediapipe_input_sources_ios",
"//mediapipe/calculators/core:pass_through_calculator", "//mediapipe/calculators/core:pass_through_calculator",
"//third_party/apple_frameworks:AVFoundation",
"//third_party/apple_frameworks:Accelerate",
"//third_party/apple_frameworks:CoreGraphics",
"//third_party/apple_frameworks:CoreMedia",
"//third_party/apple_frameworks:CoreVideo",
"//third_party/apple_frameworks:GLKit",
"//third_party/apple_frameworks:QuartzCore",
"//third_party/apple_frameworks:UIKit",
], ],
) )

73
third_party/apple_frameworks/BUILD vendored Normal file
View File

@ -0,0 +1,73 @@
# Build rules to inject Apple Frameworks
package(default_visibility = ["//visibility:public"])
cc_library(
name = "CoreGraphics",
linkopts = ["-framework CoreGraphics"],
)
cc_library(
name = "CoreMedia",
linkopts = ["-framework CoreMedia"],
)
cc_library(
name = "UIKit",
linkopts = ["-framework UIKit"],
)
cc_library(
name = "Accelerate",
linkopts = ["-framework Accelerate"],
)
cc_library(
name = "CoreVideo",
linkopts = ["-framework CoreVideo"],
)
cc_library(
name = "Metal",
linkopts = ["-framework Metal"],
)
cc_library(
name = "MetalPerformanceShaders",
linkopts = ["-framework MetalPerformanceShaders"],
)
cc_library(
name = "AVFoundation",
linkopts = ["-framework AVFoundation"],
)
cc_library(
name = "Foundation",
linkopts = ["-framework Foundation"],
)
cc_library(
name = "CoreImage",
linkopts = ["-framework CoreImage"],
)
cc_library(
name = "XCTest",
linkopts = ["-framework XCTest"],
)
cc_library(
name = "GLKit",
linkopts = ["-framework GLKit"],
)
cc_library(
name = "OpenGLES",
linkopts = ["-framework OpenGLES"],
)
cc_library(
name = "QuartzCore",
linkopts = ["-framework QuartzCore"],
)