42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System.IO;
|
||
using UnityEngine;
|
||
using UnityEditor;
|
||
using UnityEditor.Build.Reporting;
|
||
using UnityEditor.Callbacks;
|
||
#if UNITY_IPHONE || UNITY_IOS
|
||
using UnityEditor.iOS.Xcode;
|
||
#endif
|
||
|
||
namespace Facebook.Unity.PostProcess
|
||
{
|
||
/// <summary>
|
||
/// Automatically disables Bitcode on iOS builds
|
||
/// </summary>
|
||
public static class DisableBitcode
|
||
{
|
||
#if UNITY_IPHONE || UNITY_IOS
|
||
[PostProcessBuildAttribute(999)]
|
||
public static void OnPostProcessBuild(BuildTarget buildTarget, string pathToBuildProject)
|
||
{
|
||
if (buildTarget != BuildTarget.iOS) return;
|
||
string projectPath = pathToBuildProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
|
||
PBXProject pbxProject = new PBXProject();
|
||
pbxProject.ReadFromFile(projectPath);
|
||
|
||
//Disabling Bitcode on all targets
|
||
//Main
|
||
string target = pbxProject.GetUnityMainTargetGuid();
|
||
pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
|
||
//Unity Tests
|
||
target = pbxProject.TargetGuidByName(PBXProject.GetUnityTestTargetName());
|
||
pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
|
||
//Unity Framework
|
||
target = pbxProject.GetUnityFrameworkTargetGuid();
|
||
pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
|
||
|
||
pbxProject.WriteToFile(projectPath);
|
||
}
|
||
#endif
|
||
}
|
||
}
|