Skip to content

Commit ad585d5

Browse files
committed
Update ToF AR Samples Basic V1.5.0
1 parent e8d3c1a commit ad585d5

File tree

336 files changed

+13458
-1521
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

336 files changed

+13458
-1521
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only)
3+
*
4+
* Copyright 2024 Sony Semiconductor Solutions Corporation.
5+
*
6+
*/
7+
8+
#if UNITY_EDITOR && UNITY_ANDROID
9+
using UnityEditor;
10+
using UnityEditor.Android;
11+
using UnityEditor.Build;
12+
using UnityEditor.Build.Reporting;
13+
14+
public class AndroidSettingsPreProcess : IPreprocessBuildWithReport
15+
{
16+
public int callbackOrder => 0;
17+
18+
public void OnPreprocessBuild(BuildReport report)
19+
{
20+
if (report.summary.platform == BuildTarget.Android)
21+
{
22+
var libCppSharedSoPlugin = AssetImporter.GetAtPath("Assets/TofAr/TofAr/Plugins/Android/arm64-v8a/libc++_shared.so") as PluginImporter;
23+
if (libCppSharedSoPlugin != null)
24+
{
25+
#if UNITY_6000_0_OR_NEWER
26+
if (libCppSharedSoPlugin.GetAndroidSharedLibraryType() != AndroidSharedLibraryType.Symbol)
27+
{
28+
libCppSharedSoPlugin.SetAndroidSharedLibraryType(AndroidSharedLibraryType.Symbol);
29+
}
30+
#else
31+
if (libCppSharedSoPlugin.GetAndroidSharedLibraryType() != AndroidSharedLibraryType.Executable)
32+
{
33+
libCppSharedSoPlugin.SetAndroidSharedLibraryType(AndroidSharedLibraryType.Executable);
34+
}
35+
#endif
36+
}
37+
}
38+
}
39+
}
40+
41+
#endif

Assets/Editor/AndroidSettingsPreProcess.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only)
3+
*
4+
* Copyright 2022,2023 Sony Semiconductor Solutions Corporation.
5+
*
6+
*/
7+
8+
using System.Collections.Generic;
9+
using System.IO;
10+
using System.Linq;
11+
using UnityEditor;
12+
using UnityEngine;
13+
using Debug = UnityEngine.Debug;
14+
15+
public class ExternalCommandLineBuild
16+
{
17+
static void PerformBuild()
18+
{
19+
#if UNITY_ANDROID
20+
PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Android, ApiCompatibilityLevel.NET_4_6);
21+
#elif UNITY_IOS
22+
PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.iOS, ApiCompatibilityLevel.NET_4_6);
23+
#elif UNITY_STANDALONE_WIN
24+
PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Standalone, ApiCompatibilityLevel.NET_4_6);
25+
#endif
26+
27+
string definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
28+
List<string> allDefines = definesString.Split(';').ToList();
29+
30+
Debug.Log("allDefines " + string.Join(";", allDefines.ToArray()));
31+
32+
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, string.Join(";", allDefines.ToArray()));
33+
34+
var scenes = new List<string>();
35+
foreach (var scene in EditorBuildSettings.scenes)
36+
{
37+
scenes.Add(scene.path);
38+
}
39+
40+
#if UNITY_ANDROID
41+
EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle;
42+
BuildPipeline.BuildPlayer(scenes.ToArray(), GetArg("-apkOutputPath"), BuildTarget.Android, BuildOptions.None);
43+
#elif UNITY_IOS
44+
BuildPipeline.BuildPlayer(scenes.ToArray(), GetArg("-apkOutputPath"), BuildTarget.iOS, BuildOptions.None);
45+
#elif UNITY_STANDALONE_WIN
46+
BuildPipeline.BuildPlayer(scenes.ToArray(), GetArg("-locationPathName"), BuildTarget.StandaloneWindows64, BuildOptions.None);
47+
#endif
48+
}
49+
50+
private static string GetArg(string name)
51+
{
52+
var args = System.Environment.GetCommandLineArgs();
53+
for (int i = 0; i < args.Length; i++)
54+
{
55+
if (args[i] == name && args.Length > i + 1)
56+
{
57+
return args[i + 1];
58+
}
59+
}
60+
return null;
61+
}
62+
}

Assets/Editor/ExternalCommandLineBuild.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)