Ejemplo n.º 1
0
        public ClConfig Copy()
        {
            ClConfig tmp = (ClConfig)this.MemberwiseClone();

            tmp.cmd     = this.cmd;
            tmp.include = this.include.ToList();
            tmp.input   = this.input.ToList();
            tmp.flag    = this.flag.ToList();
            tmp.zc      = this.zc.ToList();

            tmp.define = this.define.ToDictionary(kv => kv.Key, kv => kv.Value);
            tmp.file   = this.file.ToDictionary(kv => kv.Key, kv => kv.Value);
            tmp.warn   = this.warn.ToDictionary(kv => kv.Key, kv => kv.Value);
            return(tmp);
        }
Ejemplo n.º 2
0
        static CppCompilation Do(String file, ClConfig cfg)
        {
            var options = new CppParserOptions()
            {
                // Pass the defines -DMYDEFINE to the C++ parser
                Defines        = { },
                IncludeFolders = { },
                TargetCpu      = CppTargetCpu.X86_64,
            };

            options.ParseSystemIncludes = false;
            options.ParseComments       = false;
            options.AdditionalArguments.Add("-fno-complete-member-pointers");
            options.AdditionalArguments.Add("/TC");
            options.AdditionalArguments.Add("-std c99");
            options.AdditionalArguments.Add("/c");
            options.AdditionalArguments.Add("-fms-extensions");
            options.AdditionalArguments.Add("-fms-compatibility");
            options.AdditionalArguments.Add(" -fms-compatibility-version=19");
            options.ParseAsCpp = false;

            options.EnableFunctionBodies();

            foreach (KeyValuePair <string, string> kv in cfg.define)
            {
                String d = kv.Value == null ? (kv.Key) : (kv.Key + "=" + kv.Value);
                options.Defines.Add(d);
            }
            options.Defines.Add("CPP_AST_FIXED");

            foreach (String include in cfg.include)
            {
                options.IncludeFolders.Add(include);
            }

            options.ConfigureForWindowsMsvc();

            var compilation = CppParser.ParseFile(file, options);

            return(compilation);
        }
Ejemplo n.º 3
0
        static List <ClConfig> SplitCfgByInput(List <ClConfig> cfgs, List <String> sInput)
        {
            List <ClConfig> appends = new List <ClConfig>();

            foreach (ClConfig cfg in cfgs)
            {
                foreach (String input in sInput)
                {
                    if (cfg.input.Contains(input))
                    {
                        ClConfig tmp = cfg.Copy();
                        tmp.input = new List <String> {
                            input
                        };
                        appends.Add(tmp);

                        cfg.input = cfg.input.Except(tmp.input).ToList();
                    }
                }
            }
            return(cfgs.Concat(appends).ToList());
        }