static framework build now working correctly
This commit is contained in:
parent
81557e0590
commit
2c01e84955
6
.bazelrc
6
.bazelrc
|
@ -69,6 +69,12 @@ build:android_arm64 --cpu=arm64-v8a
|
|||
build:android_arm64 --fat_apk_cpu=arm64-v8a
|
||||
|
||||
# iOS configs.
|
||||
|
||||
build:ios --apple_bitcode=embedded
|
||||
build:ios --copt=-fembed-bitcode
|
||||
build:ios --cxxopt=-std=c++17 # enables c++ 17
|
||||
|
||||
|
||||
build:ios --apple_platform_type=ios
|
||||
build:ios --copt=-fno-aligned-allocation
|
||||
|
||||
|
|
Binary file not shown.
|
@ -2,10 +2,10 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>Processing Camera Feed</string>
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
<dict>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>This app uses the camera to demonstrate live video processing.</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
|
|
|
@ -383,7 +383,7 @@ class GlobalFactoryRegistry {
|
|||
|
||||
#define REGISTER_FACTORY_FUNCTION_QUALIFIED(RegistryType, var_name, name, ...) \
|
||||
static auto* REGISTRY_STATIC_VAR(var_name, __LINE__) = \
|
||||
new mediapipe::RegistrationToken( \
|
||||
new ::mediapipe::RegistrationToken( \
|
||||
RegistryType::Register(#name, __VA_ARGS__))
|
||||
|
||||
} // namespace mediapipe
|
||||
|
|
|
@ -130,7 +130,7 @@ class Subgraph {
|
|||
using SubgraphRegistry = GlobalFactoryRegistry<std::unique_ptr<Subgraph>>;
|
||||
|
||||
#define REGISTER_MEDIAPIPE_GRAPH(name) \
|
||||
REGISTER_FACTORY_FUNCTION_QUALIFIED(mediapipe::SubgraphRegistry, \
|
||||
REGISTER_FACTORY_FUNCTION_QUALIFIED(::mediapipe::SubgraphRegistry, \
|
||||
subgraph_registration, name, \
|
||||
absl::make_unique<name>)
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@ static const char binary_graph[] =
|
|||
#include "{{SUBGRAPH_INC_FILE_PATH}}"
|
||||
; // NOLINT(whitespace/semicolon)
|
||||
|
||||
class {{SUBGRAPH_CLASS_NAME}} : public Subgraph {
|
||||
class {{SUBGRAPH_CLASS_NAME}} : public ::mediapipe::Subgraph {
|
||||
public:
|
||||
absl::StatusOr<CalculatorGraphConfig> GetConfig(
|
||||
absl::StatusOr<::mediapipe::CalculatorGraphConfig> GetConfig(
|
||||
const SubgraphOptions& /*options*/) {
|
||||
CalculatorGraphConfig config;
|
||||
::mediapipe::CalculatorGraphConfig config;
|
||||
// Note: this is a binary protobuf serialization, and may include NUL
|
||||
// bytes. The trailing NUL added to the string literal should be excluded.
|
||||
if (config.ParseFromArray(binary_graph, sizeof(binary_graph) - 1)) {
|
||||
|
|
|
@ -1,4 +1,16 @@
|
|||
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_framework", "ios_static_framework", "ios_unit_test")
|
||||
load(
|
||||
"@build_bazel_rules_apple//apple:ios.bzl",
|
||||
"ios_application",
|
||||
"ios_dynamic_framework",
|
||||
"ios_framework",
|
||||
"ios_static_framework",
|
||||
"ios_unit_test",
|
||||
)
|
||||
load(
|
||||
"//mediapipe/examples/ios:bundle_id.bzl",
|
||||
"BUNDLE_ID_PREFIX",
|
||||
"example_provisioning",
|
||||
)
|
||||
|
||||
MPP_HEADERS = [
|
||||
"PoseTracking.h",
|
||||
|
@ -49,6 +61,7 @@ ios_static_framework(
|
|||
# "--no-whole-archive",
|
||||
# "-all_load",
|
||||
# "-Wl",
|
||||
"-force_load",
|
||||
],
|
||||
minimum_os_version = "12.0",
|
||||
visibility = ["//visibility:public"],
|
||||
|
@ -57,10 +70,52 @@ ios_static_framework(
|
|||
"//mediapipe/calculators/core:flow_limiter_calculator",
|
||||
|
||||
# "//third_party:opencv",
|
||||
# "@ios_opencv//:OpencvFramework",
|
||||
"@ios_opencv//:OpencvFramework",
|
||||
],
|
||||
)
|
||||
|
||||
ios_framework(
|
||||
name = "MPPoseTrackingDynamic",
|
||||
hdrs = MPP_HEADERS + MP_GEN_IOS_HEADERS + ["MPPoseTracking.h"],
|
||||
bundle_id = BUNDLE_ID_PREFIX + ".MPPPoseTracking",
|
||||
bundle_name = "MPPoseTracking",
|
||||
families = [
|
||||
"iphone",
|
||||
"ipad",
|
||||
],
|
||||
infoplists = ["Info.plist"],
|
||||
linkopts = [
|
||||
# "--no-whole-archive",
|
||||
# "-all_load",
|
||||
# "-Wl",
|
||||
# "-force_load",
|
||||
],
|
||||
minimum_os_version = "10.0",
|
||||
resources = ["modulemap/module.modulemap"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//mediapipe/objc/solutions/posetracking_gpu:posetracking_gpu_solution",
|
||||
# "//mediapipe/calculators/core:flow_limiter_calculator",
|
||||
|
||||
# "//third_party:opencv",
|
||||
"@ios_opencv//:OpencvFramework",
|
||||
],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "PatchedMPPosetrackingDynamic",
|
||||
srcs = [":MPPoseTrackingDynamic"],
|
||||
outs = [
|
||||
"MPPoseTracking.framework",
|
||||
"MPPoseTracking.framework.dSYM",
|
||||
],
|
||||
cmd = """
|
||||
bash $(location patch_ios_framework.sh) "$(SRCS)" "$(OUTS)"
|
||||
""",
|
||||
output_to_bindir = 1,
|
||||
tools = ["patch_ios_framework.sh"],
|
||||
)
|
||||
|
||||
# Custom Bazel Rule that patches headers of framework to flatten header imports
|
||||
genrule(
|
||||
name = "MPPoseTrackingHeaderPatched",
|
||||
|
@ -97,27 +152,44 @@ objc_library(
|
|||
linkopts = [
|
||||
# "--no-whole-archive",
|
||||
# "-all_load",
|
||||
# "-force_load",
|
||||
# "-Wl",
|
||||
],
|
||||
module_name = "MPPoseTracking",
|
||||
sdk_frameworks = ["Accelerate"],
|
||||
sdk_frameworks = [
|
||||
"Accelerate",
|
||||
"AVFoundation",
|
||||
"CoreGraphics",
|
||||
"CoreMedia",
|
||||
"UIKit",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//mediapipe/objc:mediapipe_framework_ios",
|
||||
"//mediapipe/objc:mediapipe_input_sources_ios",
|
||||
"//mediapipe/objc:mediapipe_layer_renderer",
|
||||
"//mediapipe/calculators/core:flow_limiter_calculator",
|
||||
] + select({
|
||||
"//mediapipe:ios_i386": [],
|
||||
"//mediapipe:ios_x86_64": [],
|
||||
"//conditions:default": [
|
||||
"//mediapipe/graphs/pose_tracking:pose_tracking_gpu_deps",
|
||||
"//mediapipe/framework/formats:landmark_cc_proto",
|
||||
"calculator_registry",
|
||||
],
|
||||
}),
|
||||
alwayslink = True,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "calculator_registry",
|
||||
srcs = [
|
||||
"registry/calculator_registry.cpp",
|
||||
"registry/calculator_registry.h",
|
||||
],
|
||||
deps = ["//mediapipe/graphs/pose_tracking:pose_tracking_gpu_deps"],
|
||||
alwayslink = True,
|
||||
)
|
||||
|
||||
exports_files(
|
||||
MPP_HEADERS,
|
||||
visibility = ["//visibility:public"],
|
||||
|
|
27
mediapipe/objc/solutions/posetracking_gpu/Info.plist
Normal file
27
mediapipe/objc/solutions/posetracking_gpu/Info.plist
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>This app uses the camera to demonstrate live video processing.</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,3 @@
|
|||
#import "PoseTracking.h"
|
||||
#import "PoseTrackingOptions.h"
|
||||
#import "PoseTrackingResults.h"
|
|
@ -3,14 +3,21 @@
|
|||
#import "mediapipe/objc/MPPGraph.h"
|
||||
#import "mediapipe/objc/MPPTimestampConverter.h"
|
||||
#include "mediapipe/framework/packet.h"
|
||||
#include "mediapipe/calculators/core/flow_limiter_calculator.h"
|
||||
#include "mediapipe/calculators/core/constant_side_packet_calculator.h"
|
||||
#include "mediapipe/modules/pose_landmark/pose_landmark_gpu_linked.h"
|
||||
#include "registry/calculator_registry.h"
|
||||
|
||||
//#include "mediapipe/calculators/core/flow_limiter_calculator.h"
|
||||
//#include "mediapipe/calculators/core/constant_side_packet_calculator.h"
|
||||
//#include "mediapipe/modules/pose_landmark/pose_landmark_gpu_linked.h"
|
||||
//#include "mediapipe/graphs/pose_tracking/subgraphs/pose_renderer_gpu_linked.h"
|
||||
//#include "mediapipe/modules/pose_detection/pose_detection_gpu_linked.h"
|
||||
|
||||
void registerCalculators(){
|
||||
typeid(::mediapipe::FlowLimiterCalculator);
|
||||
typeid(::mediapipe::ConstantSidePacketCalculator);
|
||||
typeid(::mediapipe::PoseLandmarkGpu);
|
||||
// typeid(::mediapipe::FlowLimiterCalculator);
|
||||
// typeid(::mediapipe::ConstantSidePacketCalculator);
|
||||
// typeid(::mediapipe::PoseLandmarkGpu);
|
||||
// typeid(::mediapipe::PoseRendererGpu);
|
||||
// typeid(::mediapipe::PoseDetectionGpu);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -139,6 +146,7 @@ static const char* kLandmarksOutputStream = "pose_landmarks";
|
|||
- (instancetype) initWithPoseTrackingOptions: (PoseTrackingOptions*) poseTrackingOptions{
|
||||
|
||||
registerCalculators();
|
||||
MPPCalculator();
|
||||
self.renderer = [[MPPLayerRenderer alloc] init];
|
||||
self.renderer.frameScaleMode = MPPFrameScaleModeFillAndCrop;
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
framework module MPPoseTracking {
|
||||
umbrella header "MPPoseTracking.h"
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022 Baracoda. All rights reserved
|
||||
#
|
||||
# Copying this file via any medium without the prior written consent of Baracoda is strictly
|
||||
# prohibited
|
||||
#
|
||||
# Proprietary and confidential
|
||||
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
for outputPath in $2
|
||||
do
|
||||
fileName=$(basename "$outputPath" .framework)
|
||||
outputPath=$(dirname $outputPath)
|
||||
|
||||
for inputPath in $1
|
||||
do
|
||||
if [[ $inputPath == *"$fileName"*.zip ]]; then
|
||||
fullPath=$(dirname "$inputPath")
|
||||
|
||||
frameworkPath="$fullPath"/"$fileName".framework
|
||||
|
||||
rm -rf "$fullPath"/"$fileName".framework
|
||||
unzip "$inputPath" -d "$fullPath"
|
||||
|
||||
if [ -d "$frameworkPath".dSYM ]; then
|
||||
cp -R "$frameworkPath".dSYM "$outputPath"/"$fileName".framework.dSYM
|
||||
fi
|
||||
|
||||
if [ -f "$frameworkPath"/module.modulemap ]; then
|
||||
mkdir "$frameworkPath"/Modules
|
||||
mv "$frameworkPath"/module.modulemap "$frameworkPath"/Modules
|
||||
fi
|
||||
|
||||
cp -R "$frameworkPath" "$outputPath"/"$fileName".framework
|
||||
fi
|
||||
done;
|
||||
done;
|
|
@ -0,0 +1,68 @@
|
|||
//
|
||||
// Created by Mautisim Munir on 05/11/2022.
|
||||
//
|
||||
|
||||
#include "calculator_registry.h"
|
||||
#include "mediapipe/calculators/core/flow_limiter_calculator.h"
|
||||
#include "mediapipe/calculators/core/constant_side_packet_calculator.h"
|
||||
|
||||
// We need namespaces for subgraphs because of the static variables inside the files
|
||||
namespace PLG {
|
||||
|
||||
#include "mediapipe/modules/pose_landmark/pose_landmark_gpu_linked.h"
|
||||
|
||||
}
|
||||
|
||||
namespace PDROI{
|
||||
#include "mediapipe/modules/pose_landmark/pose_detection_to_roi_linked.h"
|
||||
|
||||
}
|
||||
|
||||
namespace PRG {
|
||||
|
||||
#include "mediapipe/graphs/pose_tracking/subgraphs/pose_renderer_gpu_linked.h"
|
||||
|
||||
}
|
||||
namespace PDG {
|
||||
#include "mediapipe/modules/pose_detection/pose_detection_gpu_linked.h"
|
||||
}
|
||||
|
||||
namespace PLROIG{
|
||||
#include "mediapipe/modules/pose_landmark/pose_landmark_by_roi_gpu_linked.h"
|
||||
|
||||
}
|
||||
namespace PLF{
|
||||
#include "mediapipe/modules/pose_landmark/pose_landmark_filtering_linked.h"
|
||||
}
|
||||
namespace PLTOROI{
|
||||
#include "mediapipe/modules/pose_landmark/pose_landmarks_to_roi_linked.h"
|
||||
}
|
||||
namespace PSF{
|
||||
#include "mediapipe/modules/pose_landmark/pose_segmentation_filtering_linked.h"
|
||||
}
|
||||
namespace PLML{
|
||||
#include "mediapipe/modules/pose_landmark/pose_landmark_model_loader_linked.h"
|
||||
}
|
||||
namespace PLSIP{
|
||||
#include "mediapipe/modules/pose_landmark/pose_landmarks_and_segmentation_inverse_projection_linked.h"
|
||||
}
|
||||
namespace TPLS{
|
||||
#include "mediapipe/modules/pose_landmark/tensors_to_pose_landmarks_and_segmentation_linked.h"
|
||||
}
|
||||
|
||||
MPPCalculator::MPPCalculator() {
|
||||
typeid(TPLS::mediapipe::TensorsToPoseLandmarksAndSegmentation);
|
||||
typeid(::mediapipe::FlowLimiterCalculator);
|
||||
typeid(::mediapipe::ConstantSidePacketCalculator);
|
||||
typeid(PLG::mediapipe::PoseLandmarkGpu);
|
||||
typeid(PRG::mediapipe::PoseRendererGpu);
|
||||
typeid(PDG::mediapipe::PoseDetectionGpu);
|
||||
typeid(PDROI::mediapipe::PoseDetectionToRoi);
|
||||
typeid(PLROIG::mediapipe::PoseLandmarkByRoiGpu);
|
||||
typeid(PLF::mediapipe::PoseLandmarkFiltering);
|
||||
typeid(PLTOROI::mediapipe::PoseLandmarksToRoi);
|
||||
typeid(PSF::mediapipe::PoseSegmentationFiltering);
|
||||
typeid(PLML::mediapipe::PoseLandmarkModelLoader);
|
||||
typeid(PLSIP::mediapipe::PoseLandmarksAndSegmentationInverseProjection);
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// Created by Mautisim Munir on 05/11/2022.
|
||||
//
|
||||
|
||||
#ifndef MEDIAPIPE_CALCULATOR_REGISTRY_H
|
||||
#define MEDIAPIPE_CALCULATOR_REGISTRY_H
|
||||
|
||||
class MPPCalculator{
|
||||
public:
|
||||
MPPCalculator();
|
||||
};
|
||||
|
||||
#endif //MEDIAPIPE_CALCULATOR_REGISTRY_H
|
|
@ -128,7 +128,7 @@ Pod::Spec.new do |spec|
|
|||
# spec.requires_arc = true
|
||||
|
||||
# spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
|
||||
# spec.dependency "OpenCV", "~> 3.4"
|
||||
spec.dependency "OpenCV", "3.2"
|
||||
spec.static_framework = true
|
||||
|
||||
spec.ios.vendored_frameworks = 'frameworks/*.framework'
|
||||
|
|
Loading…
Reference in New Issue
Block a user