Beispiel #1
0
        private void FillClCompile(EngineNS.IO.XmlNode node, CompileConfig cfg)
        {
            var inc = node.FindNode("AdditionalIncludeDirectories");

            if (inc != null)
            {
                var segs = inc.Value.Trim().Split(';');
                foreach (var i in segs)
                {
                    var dir = i.Substring(GenProject.ProjToRoot.Length).Replace('\\', '/');
                    if (cfg.IncludeDirs.Contains(dir) == false)
                    {
                        cfg.IncludeDirs.Add(dir);
                    }
                }
            }
            var defines = node.FindNode("PreprocessorDefinitions");

            if (defines != null)
            {
                var segs = defines.Value.Trim().Split(';');
                foreach (var i in segs)
                {
                    if (cfg.Definitions.Contains(i) == false)
                    {
                        cfg.Definitions.Add(i);
                    }
                }
            }
        }
Beispiel #2
0
 public void Merge(CompileConfig cfg)
 {
     foreach (var i in cfg.Definitions)
     {
         if (Definitions.Contains(i))
         {
             continue;
         }
         Definitions.Add(i);
     }
     foreach (var i in cfg.IncludeDirs)
     {
         if (IncludeDirs.Contains(i))
         {
             continue;
         }
         IncludeDirs.Add(i);
     }
     foreach (var i in cfg.LinkDirs)
     {
         if (LinkDirs.Contains(i))
         {
             continue;
         }
         LinkDirs.Add(i);
     }
     foreach (var i in cfg.LinkLibs)
     {
         if (LinkLibs.Contains(i))
         {
             continue;
         }
         LinkLibs.Add(i);
     }
 }
Beispiel #3
0
        public CompileConfig CreateConfig(string name)
        {
            var result = new CompileConfig();

            foreach (var i in Definitions)
            {
                if (result.Definitions.Contains(i) == false)
                {
                    result.Definitions.Add(i);
                }
            }
            result.Name   = name;
            Configs[name] = result;
            return(result);
        }
Beispiel #4
0
        private void FillLink(EngineNS.IO.XmlNode node, CompileConfig cfg)
        {
            var libDir = node.FindNode("AdditionalLibraryDirectories");

            if (libDir != null)
            {
                var segs = libDir.Value.Trim().Split(';');
                foreach (var i in segs)
                {
                    var dir = i.Substring(GenProject.ProjToRoot.Length).Replace('\\', '/');
                    if (cfg.LinkDirs.Contains(dir) == false)
                    {
                        cfg.LinkDirs.Add(dir);
                    }
                }
            }
            string libsName = "AdditionalDependencies";

            switch (PlatformType)
            {
            case ENativePlatformType.Windows:
                libsName = "AdditionalDependencies";
                break;

            case ENativePlatformType.Android:
                libsName = "LibraryDependencies";
                break;
            }
            var libs = node.FindNode(libsName);

            if (libs != null)
            {
                var segs = libs.Value.Trim().Split(';');
                foreach (var i in segs)
                {
                    if (cfg.LinkLibs.Contains(i) == false)
                    {
                        cfg.LinkLibs.Add(i);
                    }
                }
            }
        }
Beispiel #5
0
        private void GetCompileConfig(EngineNS.IO.XmlNode node, CompileConfig cfg)
        {
            var condiName = $"'$(Configuration)|$(Platform)'=='{cfg.Name}'";

            node.FindNodes("ItemDefinitionGroup", (EngineNS.IO.XmlNode nd, ref bool bCancel) =>
            {
                var attr = nd.FindAttrib("Condition");
                if (attr != null)
                {
                    if (attr.Value == condiName)
                    {
                        this.FillClCompile(nd.FindNode("ClCompile"), cfg);
                        this.FillLink(nd.FindNode("Link"), cfg);
                        bCancel = true;
                        return(true);
                    }
                }
                return(false);
            });
        }
Beispiel #6
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);
        }
Beispiel #7
0
        public bool LoadModuleInfo(string dir, string file)
        {
            Name = file;
            Configs.Clear();
            var xml = EngineNS.IO.XmlHolder.LoadXML(dir + file);

            foreach (var i in xml.RootNode.GetNodes())
            {
                var attr = i.FindAttrib("Name");
                if (attr == null)
                {
                    continue;
                }

                var cfg = new CompileConfig();
                Configs.Add(attr.Value, cfg);

                var node = i.FindNode("Defines");
                if (node != null)
                {
                    foreach (var j in node.GetNodes())
                    {
                        cfg.Definitions.Add(j.Name);
                    }
                }

                node = i.FindNode("Includes");
                if (node != null)
                {
                    foreach (var j in node.GetNodes())
                    {
                        attr = j.FindAttrib("Dir");
                        if (attr == null)
                        {
                            continue;
                        }

                        cfg.IncludeDirs.Add(attr.Value.ToLower());
                    }
                }
                node = i.FindNode("Links");
                if (node != null)
                {
                    attr = node.FindAttrib("Libs");
                    if (attr != null)
                    {
                        var segs = attr.Value.Split(';');
                        foreach (var j in segs)
                        {
                            if (string.IsNullOrEmpty(j))
                            {
                                continue;
                            }
                            if (cfg.LinkLibs.Contains(j.ToLower()) == false)
                            {
                                cfg.LinkLibs.Add(j.ToLower());
                            }
                        }
                    }
                    foreach (var j in node.GetNodes())
                    {
                        attr = j.FindAttrib("Dir");
                        if (attr == null)
                        {
                            continue;
                        }

                        cfg.LinkDirs.Add(attr.Value.ToLower());
                    }
                }
            }
            return(true);
        }