Skip to content

Commit

Permalink
feat: build for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
homuler committed Oct 5, 2020
1 parent cc6879b commit d058ddd
Show file tree
Hide file tree
Showing 11 changed files with 226 additions and 27 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ obj/
*.csproj
*.sln

*.dll
*.so
*.aar

bazel-*

Assets/Mediapipe/SDK/Models/*
!Assets/Mediapipe/SDK/Models/.gitkeep
Assets/Mediapipe/SDK/Plugins/*
Assets/Mediapipe/SDK/Plugins/Protobuf*

Assets/Mediapipe/SDK/Scripts/Protobuf/**/*.cs
7 changes: 6 additions & 1 deletion Assets/Mediapipe/Examples/Scripts/SceneDirector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ public class SceneDirector : MonoBehaviour {

void OnEnable() {
var nameForGlog = Path.Combine(Application.dataPath, "MediapipePlugin");
var logDir = Path.Combine(Application.dataPath.Replace("/Assets", ""), "Logs", "Mediapipe");

#if UNITY_EDITOR || UNITY_STANDALONE
var logDir = Path.Combine(Application.dataPath.Replace("/Assets", ""), "Logs", "Mediapipe");
#else
var logDir = Path.Combine(Application.persistentDataPath, "Logs", "Mediapipe");
#endif

if (!Directory.Exists(logDir)) {
Directory.CreateDirectory(logDir);
Expand Down
8 changes: 8 additions & 0 deletions Assets/Mediapipe/SDK/Plugins/Android.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions Assets/Mediapipe/SDK/Plugins/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- sample AndroidManifest.xml -->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="org.homuler.mediapipe.unity"
xmlns:tools="http://schemas.android.com/tools">
<application>
<activity android:name="org.homuler.mediapipe.unity.MediaPipeUnityPlayerActivity"
android:label="@string/app_name"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
</manifest>
7 changes: 7 additions & 0 deletions Assets/Mediapipe/SDK/Plugins/Android/AndroidManifest.xml.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions Assets/Mediapipe/SDK/Plugins/Android/mediapipe_android.aar.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions Assets/Mediapipe/SDK/Plugins/libmediapipe_c.so.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Assets/Mediapipe/SDK/Scripts/UnsafeNativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
namespace Mediapipe {
[SuppressUnmanagedCodeSecurityAttribute]
internal static class UnsafeNativeMethods {
private const string MediapipeLibrary = "mediapipe_c";
#if UNITY_ANDROID
private const string MediapipeLibrary = "mediapipe_jni";
#else
private const string MediapipeLibrary = "mediapipe_c";
#endif

/// CalculatorGraph API
[DllImport (MediapipeLibrary)]
Expand Down
7 changes: 5 additions & 2 deletions ProjectSettings/EditorBuildSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 0
path:
guid: 00000000000000000000000000000000
- enabled: 1
path: Assets/Mediapipe/Examples/PoseTracking/Scenes/PoseTrackingOnGPU.unity
guid: 0b3fe43c47e9be53589aa7c8a61eb89c
path: Assets/Mediapipe/Examples/Scenes/DesktopGPU.unity
guid: 01636efed5795b70caad55b3515b23ac
m_configObjects: {}
127 changes: 106 additions & 21 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PlayerSettings:
useOnDemandResources: 0
accelerometerFrequency: 60
companyName: DefaultCompany
productName: MediapipePlugin
productName: MediaPipePlugin
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
Expand Down Expand Up @@ -111,8 +111,13 @@ PlayerSettings:
switchNVNShaderPoolsGranularity: 33554432
switchNVNDefaultPoolsGranularity: 16777216
switchNVNOtherPoolsGranularity: 16777216
switchNVNMaxPublicTextureIDCount: 0
switchNVNMaxPublicSamplerIDCount: 0
stadiaPresentMode: 0
stadiaTargetFramerate: 0
vulkanNumSwapchainBuffers: 3
vulkanEnableSetSRGBWrite: 0
vulkanEnableLateAcquireNextImage: 0
m_SupportedAspectRatios:
4:3: 1
5:4: 1
Expand Down Expand Up @@ -162,10 +167,11 @@ PlayerSettings:
resolutionScalingMode: 0
androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1
applicationIdentifier: {}
applicationIdentifier:
Android: org.homuler.mediapipe.unity.MediaPipePlugin
buildNumber: {}
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 19
AndroidMinSdkVersion: 21
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1
aotOptions:
Expand All @@ -190,22 +196,6 @@ PlayerSettings:
uIStatusBarHidden: 1
uIExitOnSuspend: 0
uIStatusBarStyle: 0
iPhoneSplashScreen: {fileID: 0}
iPhoneHighResSplashScreen: {fileID: 0}
iPhoneTallHighResSplashScreen: {fileID: 0}
iPhone47inSplashScreen: {fileID: 0}
iPhone55inPortraitSplashScreen: {fileID: 0}
iPhone55inLandscapeSplashScreen: {fileID: 0}
iPhone58inPortraitSplashScreen: {fileID: 0}
iPhone58inLandscapeSplashScreen: {fileID: 0}
iPadPortraitSplashScreen: {fileID: 0}
iPadHighResPortraitSplashScreen: {fileID: 0}
iPadLandscapeSplashScreen: {fileID: 0}
iPadHighResLandscapeSplashScreen: {fileID: 0}
iPhone65inPortraitSplashScreen: {fileID: 0}
iPhone65inLandscapeSplashScreen: {fileID: 0}
iPhone61inPortraitSplashScreen: {fileID: 0}
iPhone61inLandscapeSplashScreen: {fileID: 0}
appleTVSplashScreen: {fileID: 0}
appleTVSplashScreen2x: {fileID: 0}
tvOSSmallIconLayers: []
Expand Down Expand Up @@ -272,9 +262,101 @@ PlayerSettings:
banner: {fileID: 0}
androidGamepadSupportLevel: 0
AndroidValidateAppBundleSize: 1
AndroidAppBundleSizeToValidate: 150
AndroidAppBundleSizeToValidate: 200
m_BuildTargetIcons: []
m_BuildTargetPlatformIcons: []
m_BuildTargetPlatformIcons:
- m_BuildTarget: Android
m_Icons:
- m_Textures: []
m_Width: 432
m_Height: 432
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 324
m_Height: 324
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 216
m_Height: 216
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 162
m_Height: 162
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 108
m_Height: 108
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 81
m_Height: 81
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 192
m_Height: 192
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 144
m_Height: 144
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 96
m_Height: 96
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 72
m_Height: 72
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 48
m_Height: 48
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 36
m_Height: 36
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 192
m_Height: 192
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 144
m_Height: 144
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 96
m_Height: 96
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 72
m_Height: 72
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 48
m_Height: 48
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 36
m_Height: 36
m_Kind: 1
m_SubKind:
m_BuildTargetBatching: []
m_BuildTargetGraphicsJobs:
- m_BuildTarget: MacStandaloneSupport
Expand Down Expand Up @@ -491,6 +573,7 @@ PlayerSettings:
ps4ShareFilePath:
ps4ShareOverlayImagePath:
ps4PrivacyGuardImagePath:
ps4ExtraSceSysFile:
ps4NPtitleDatPath:
ps4RemotePlayKeyAssignment: -1
ps4RemotePlayKeyMappingDir:
Expand Down Expand Up @@ -533,6 +616,8 @@ PlayerSettings:
ps4disableAutoHideSplash: 0
ps4videoRecordingFeaturesUsed: 0
ps4contentSearchFeaturesUsed: 0
ps4CompatibilityPS5: 0
ps4GPU800MHz: 1
ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []
ps4attribVROutputEnabled: 0
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Mediapipe Unity Plugin
This is a sample Unity (2019.4.10f1) Plugin to use Mediapipe (only tested on Linux).
This is a sample Unity (2019.4.10f1) Plugin to use Mediapipe.

## Platforms
- [x] Linux Desktop (tested on ArchLinux)
- [ ] Android (under construction)
- [ ] OS X
- [ ] iOS

## Prerequisites
### MediaPipe
Expand Down

0 comments on commit d058ddd

Please sign in to comment.