Exemplo n.º 1
0
        public void AddDynamicFrameworkToProject(string targetGuid, string frameworkPathInProject)
        {
            var fileGuid = FindFileGuidByProjectPath(frameworkPathInProject);

            if (fileGuid == null)
            {
                Debug.LogError("Framework not found: " + frameworkPathInProject);
                return;
            }
            // add file reference as embed framework
            var embedFrameworkFileData = FindEmbeddedFramework(fileGuid);

            if (embedFrameworkFileData == null)
            {
                embedFrameworkFileData = PBXBuildFileData.CreateFromFramework(fileGuid);
                BuildFilesAdd(targetGuid, embedFrameworkFileData);
            }

            // add "Embed Frameworks" section
            var embedFrameworksSection = FindEmbeddedFrameworkSection();

            if (embedFrameworksSection == null)
            {
                embedFrameworksSection = PBXCopyFilesBuildPhaseData.Create("Embed Frameworks", "10");
                copyFiles.AddEntry(embedFrameworksSection);
            }

            var frameworkAlreadyAdded = false;

            foreach (var fileEntry in embedFrameworksSection.files)
            {
                if (fileEntry == embedFrameworkFileData.guid)
                {
                    frameworkAlreadyAdded = true;
                }
            }
            if (!frameworkAlreadyAdded)
            {
                embedFrameworksSection.files.AddGUID(embedFrameworkFileData.guid);
            }

            // add "Embed Frameworks" section to "Build phases"
            var targetPhases = nativeTargets[targetGuid].phases;

            if (!targetPhases.Contains(embedFrameworksSection.guid))
            {
                targetPhases.AddGUID(embedFrameworksSection.guid);
            }
            foreach (var buildConfigEntry in buildConfigs.GetEntries())
            {
                XCBuildConfigurationData configurationData = buildConfigEntry.Value;
                configurationData.AddProperty("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks");
            }
        }
Exemplo n.º 2
0
        public void AddDynamicFrameworkToProject(string targetGuid, string frameworkPathInProject)
        {
            var fileGuid = FindFileGuidByProjectPath(frameworkPathInProject);
            if (fileGuid == null)
            {
                Debug.LogError("Framework not found: " + frameworkPathInProject);
                return;
            }
            // add file reference as embed framework
            var embedFrameworkFileData = FindEmbeddedFramework(fileGuid);
            if (embedFrameworkFileData == null)
            {
                embedFrameworkFileData = PBXBuildFileData.CreateFromFramework(fileGuid);
                BuildFilesAdd(targetGuid, embedFrameworkFileData);
            }

            // add "Embed Frameworks" section
            var embedFrameworksSection = FindEmbeddedFrameworkSection(targetGuid);
            if (embedFrameworksSection == null)
            {
                embedFrameworksSection = PBXCopyFilesBuildPhaseData.Create("Embed Frameworks", "10");
                copyFiles.AddEntry(embedFrameworksSection);
            }

            var frameworkAlreadyAdded = false;
            foreach (var fileEntry in embedFrameworksSection.files)
            {
                if (fileEntry == embedFrameworkFileData.guid)
                {
                    frameworkAlreadyAdded = true;
                }
            }
            if (!frameworkAlreadyAdded)
            {
                embedFrameworksSection.files.AddGUID(embedFrameworkFileData.guid);
            }

            // add "Embed Frameworks" section to "Build phases"
            var targetPhases = nativeTargets[targetGuid].phases;
            if (!targetPhases.Contains(embedFrameworksSection.guid))
            {
                targetPhases.AddGUID(embedFrameworksSection.guid);
            }
            CheckRuntimeSearchPath();
        }