Ejemplo n.º 1
0
    private static void AddEmbedFramework(string absoluteFilePath)
    {
        string projPath =
            UnityEditor.iOS.Xcode.Custom.PBXProject.GetPBXProjectPath(AutoPackageManager.BuiltProjectPath);

        UnityEditor.iOS.Xcode.Custom.PBXProject proj = new UnityEditor.iOS.Xcode.Custom.PBXProject();
        proj.ReadFromString(File.ReadAllText(projPath));
        string targetGuid = proj.TargetGuidByName("Unity-iPhone");
        string fileGuid   = proj.AddFile(absoluteFilePath, "Frameworks/" + absoluteFilePath,
                                         UnityEditor.iOS.Xcode.Custom.PBXSourceTree.Build);

        UnityEditor.iOS.Xcode.Custom.Extensions.PBXProjectExtensions.AddFileToEmbedFrameworks(proj, targetGuid,
                                                                                              fileGuid);
        proj.SetBuildProperty(targetGuid, "LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks");
        proj.WriteToFile(projPath);
    }
Ejemplo n.º 2
0
    private static void EditEmbedFramework(BuildTarget target, string pathToBuiltProject)
    {
        packageManager.EditEmbedFramework();
        string projPath =
            UnityEditor.iOS.Xcode.Custom.PBXProject.GetPBXProjectPath(pathToBuiltProject);

        UnityEditor.iOS.Xcode.Custom.PBXProject proj = new UnityEditor.iOS.Xcode.Custom.PBXProject();
        proj.ReadFromString(File.ReadAllText(projPath));
        string targetGuid = proj.TargetGuidByName("Unity-iPhone");

        foreach (var embedFrameworks in packageManager.getEmbedFrameworks)
        {
            foreach (var framework in embedFrameworks)
            {
                string fileGuid = proj.AddFile(framework, "Frameworks/" + framework,
                                               UnityEditor.iOS.Xcode.Custom.PBXSourceTree.Build);
                UnityEditor.iOS.Xcode.Custom.Extensions.PBXProjectExtensions.AddFileToEmbedFrameworks(proj, targetGuid,
                                                                                                      fileGuid);
                proj.SetBuildProperty(targetGuid, "LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks");
            }
        }

        proj.WriteToFile(projPath);
    }