コード例 #1
0
        //end

        #endregion

        #region Mods
        public void ApplyMod(string pbxmod)
        {
            XCMod mod = new XCMod(pbxmod);

            foreach (var lib in mod.libs)
            {
                Debug.Log("Library: " + lib);
            }
            ApplyMod(mod);
        }
コード例 #2
0
ファイル: XUPEMod.cs プロジェクト: Peng-Zhiyuan/mylib
        public XUPEMod(string path)
        {
            path = Path.GetFullPath(path);
            DirectoryInfo di = new DirectoryInfo(path);

            if (!di.Exists)
            {
                throw new IOException(path + " not exsits!");
            }


            this.path       = path;
            this.name       = System.IO.Path.GetFileNameWithoutExtension(path);
            this.parentPath = System.IO.Path.GetDirectoryName(path);
            this.xcmod      = new XCMod(Path.Combine(path, "xupe.projmods"));
            vars.Add("version", UnityEditor.PlayerSettings.bundleVersion);
        }
コード例 #3
0
        public void ApplyMod(XCMod mod)
        {
            PBXGroup modGroup = this.GetGroup(mod.group);

            Debug.Log("Adding libraries...");
            PBXGroup frameworkGroup = this.GetGroup("Frameworks");

            foreach (XCModFile libRef in mod.libs)
            {
                string completeLibPath = System.IO.Path.Combine("/usr/lib", libRef.filePath);
                //Debug.LogError ("Adding library " + completeLibPath);
                this.AddFile(completeLibPath, frameworkGroup, "SDKROOT", true, libRef.isWeak);
                //this.AddFile( completeLibPath, frameworkGroup, "SDKROOT", true, libRef.isWeak);
            }

            Debug.Log("Adding frameworks...");
            //PBXGroup frameworkGroup = this.GetGroup( "Frameworks" );
            foreach (string framework in mod.frameworks)
            {
                string[] filename     = framework.Split(':');
                bool     isWeak       = (filename.Length > 1) ? true : false;
                string   completePath = System.IO.Path.Combine("System/Library/Frameworks", filename[0]);
                //Debug.LogError ("Adding framework " + completePath);
                this.AddFile(completePath, frameworkGroup, "SDKROOT", true, isWeak);
            }

            Debug.Log("Adding files...");
            foreach (string filePath in mod.files)
            {
                string absoluteFilePath = System.IO.Path.Combine(mod.path, filePath);
                this.AddFile(absoluteFilePath, modGroup);
            }

            Debug.Log("Adding embed binaries...");
            if (mod.embed_binaries != null)
            {
                //1. Add LD_RUNPATH_SEARCH_PATHS for embed framework
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "Release");
                this.overwriteBuildSetting("LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks", "Debug");

                foreach (string binary in mod.embed_binaries)
                {
                    //string absoluteFilePath = System.IO.Path.Combine( mod.path, binary );
                    this.AddEmbedFramework(binary);
                }
            }

            Debug.Log("Adding folders...");
            foreach (string folderPath in mod.folders)
            {
                // zhiyuan.peng :
                // change "foler" root dir "Application.dataPath" to  "mod.path"
                // delet:
                //string absoluteFolderPath = System.IO.Path.Combine( Application.dataPath, folderPath );
                // add:
                string absoluteFolderPath = mod.path + "/" + folderPath;
                // end

                Debug.Log("Adding folder " + absoluteFolderPath);
                this.AddFolder(absoluteFolderPath, modGroup, (string[])mod.excludes.ToArray(typeof(string)));
            }

            Debug.Log("Adding headerpaths...");
            foreach (string headerpath in mod.headerpaths)
            {
                if (headerpath.Contains("$(inherited)"))
                {
                    Debug.Log("not prepending a path to " + headerpath);
                    this.AddHeaderSearchPaths(headerpath);
                }
                else
                {
                    string absoluteHeaderPath = System.IO.Path.Combine(mod.path, headerpath);
                    this.AddHeaderSearchPaths(absoluteHeaderPath);
                }
            }

            Debug.Log("Adding compiler flags...");
            foreach (string flag in mod.compiler_flags)
            {
                this.AddOtherCFlags(flag);
            }

            Debug.Log("Adding linker flags...");
            foreach (string flag in mod.linker_flags)
            {
                this.AddOtherLinkerFlags(flag);
            }

            Debug.Log("Adding plist items...");
            string  plistPath = this.projectRootPath + "/Info.plist";
            XCPlist plist     = new XCPlist(plistPath);

            plist.Process(mod.plist);

            this.Consolidate();
        }