Exemple #1
0
        public EngineNS.IO.XmlHolder LoadProject(string ProjectDirectory, string projFileName, string[] cfgList)
        {
            var xml         = EngineNS.IO.XmlHolder.LoadXML(ProjectDirectory + projFileName);
            var moduleNames = GetModules(xml.RootNode);

            foreach (var i in moduleNames)
            {
                var tmp = new NativeModule();
                tmp.Name = i;
                Modules.Add(tmp);
            }
            foreach (var i in cfgList)
            {
                var cfg = new CompileConfig();
                cfg.Name = i;
                GetCompileConfig(xml.RootNode, cfg);
                PlatformProject.Configs.Add(i, cfg);
            }
            return(xml);
        }
Exemple #2
0
        public void Command(string[] args)
        {
            var proFile = args[1];

            var xml = EngineNS.IO.XmlHolder.LoadXML(proFile);

            string ProjectDirectory = EngineNS.CEngine.Instance.FileManager.GetPathFromFullName(proFile);

            if (xml.RootNode.Name != "NativeProject")
            {
                System.Console.WriteLine($"{proFile} is not a native project");
                return;
            }

            var modules = xml.RootNode.FindNode("Modules");

            if (modules == null)
            {
                System.Console.WriteLine($"{proFile} don't have modules");
                return;
            }

            var moduleList = new List <NativeModule>();

            foreach (var i in modules.GetNodes())
            {
                var module = i.FindAttrib("Module");
                if (module == null || System.IO.File.Exists(ProjectDirectory + module.Value) == false)
                {
                    System.Console.WriteLine($"[{module.Name}] is not found");
                    continue;
                }

                var t = new NativeModule();
                if (t.LoadModuleInfo(ProjectDirectory, module.Value))
                {
                    moduleList.Add(t);
                }
                else
                {
                    System.Console.WriteLine($"[{module.Name}] load failed");
                }
            }

            var winNode = GetPlatform("Windows", xml);

            if (winNode != null)
            {
                var pltf = new NativePlatform();
                if (pltf.LoadInfo(winNode) == false)
                {
                    System.Console.WriteLine($"Windows Platform project load failed");
                }
                else
                {
                    foreach (var i in WindowsProjectConfigList)
                    {
                        var cfg = pltf.CreateConfig(i);
                        foreach (var j in moduleList)
                        {
                            var cfg_module = j.FindConfig(i);
                            if (cfg_module != null)
                            {
                                cfg.Merge(cfg_module);
                            }
                        }
                    }
                }

                VCProject winProj = new VCProject();
                winProj.PlatformType = ENativePlatformType.Windows;
                winProj.LoadProject(ProjectDirectory, "Execute/Core.Windows/Core.Windows.vcxproj", WindowsProjectConfigList);
            }

            var droidNode = GetPlatform("Android", xml);

            if (droidNode != null)
            {
                var pltf = new NativePlatform();
                if (pltf.LoadInfo(droidNode) == false)
                {
                    System.Console.WriteLine($"Android Platform project load failed");
                }
                else
                {
                    foreach (var i in AndroidProjectConfigList)
                    {
                        var cfg = pltf.CreateConfig(i);
                        foreach (var j in moduleList)
                        {
                            var cfg_module = j.FindConfig(i);
                            if (cfg_module != null)
                            {
                                cfg.Merge(cfg_module);
                            }
                        }
                    }
                }

                VCProject droidProj = new VCProject();
                droidProj.PlatformType = ENativePlatformType.Android;
                droidProj.LoadProject(ProjectDirectory, "Execute/Core.Droid/Core.Droid.vcxproj", AndroidProjectConfigList);

                //VCProject iosProj = new VCProject();
                //iosProj.LoadProject(ProjectDirectory, "Execute/Core.IOS/Core.IOS.vcxproj");
            }
        }