FindFileOptions() public method

public FindFileOptions ( string path ) : FileOptions
path string
return FileOptions
Exemplo n.º 1
0
        private void CreateLinkTarget(Link link, IList<LogQueueItem> messages)
        {
            Target target = new Target();
            //Установка опций по умолчанию
            target.SeTLPC2478DefaultOptions();

            target.Name = Path.GetFileNameWithoutExtension(link.Name);

            target.Options.GenApp = TWO_STATE_BOOL.ENABLED;
            target.Options.GenLib = TWO_STATE_BOOL.DISABLED;

            target.Options.ADSFLGA = "226,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0";

            //target.Options.OCR_RVCT = "1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,8,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,1,0,0,0,0,224,127,0,64,0,0";
            target.Options.ADSCCFLG.ARM_Thumb_Interworking = uVision.Project.THREE_STATE_BOOL.DISABLED;
            target.Options.ADSASFLG = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0";
            
            target.Options.ADSLDFG = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0";

            target.Options.ADSLDTA = "";
            target.Options.ADSLDDA = "";
            target.Options.Debug = "1";
            target.Options.Browse = "1";


            //Исключаем все файлы из построения
            foreach (PKStudio.uVision.Project.File f in uVisionProject.FileList.Values)
            {
                //if ((f.Type == uVision.Project.File.FILE_TYPE.C_FILE) || (f.Type == uVision.Project.File.FILE_TYPE.CPP_FILE) || (f.Type == uVision.Project.File.FILE_TYPE.ASM_FILE))
                //{
                PKStudio.uVision.Project.FileOptions fileopt = new uVision.Project.FileOptions(f);
                fileopt.IncBld = THREE_STATE_BOOL.DISABLED;
                target.FilesOpton.Add(fileopt);
                //}
            }

            target.Options.OutDir = Path.GetDirectoryName(link.OutputFileMSBuild) + "\\";
            target.Options.OutName = Path.GetFileNameWithoutExtension(link.OutputFileMSBuild);
            link.OutputFileuVision = link.OutputFileMSBuild;

            foreach (RequiredObject obj in link.InputObjects.Values)
            {
                this.AddCompileFile(obj, target);
            }


            foreach (RequiredLibrary lib in link.InputLibraries.Values)
            {
                PKStudio.uVision.Project.FileOptions fileOpt = target.FindFileOptions(lib.OutputFileuVision);
                fileOpt.IncBld = THREE_STATE_BOOL.ENABLED;
            }

            //string LinkString = ARMLINKPath;

            foreach (ArgCollection arg in link.ParamCollection.Values)
            {
                if (arg.Tag == "options")
                {
                    switch (arg.Name)
                    {
                        //Ничего не надо записывать, так ккак все пути будут содержаться в файл листе
                        case "--userlibpath":
                            break;
                        case "--scatter":
                            target.Options.ADSLDSC = arg[0];
                            break;
                        case "--device":
                            break;
                        default:
                            if (arg.Count > 0)
                            {
                                foreach (string s in arg)
                                {
                                    //LinkString += " " + arg.Name + " " + s;
                                    target.Options.ADSLDMC.Add(arg.Name + " " + s);
                                }
                            }
                            //else LinkString += " " + arg.Name;
                            else target.Options.ADSLDMC.Add(arg.Name);
                            break;
                    }
                }
            }

            //foreach (BuildBase bb in link.AllInputs.Values)
            //{
            //    LinkString += " " + bb.OutputFileuVision;
            //}

            //target.AfterBuild.Add(LinkString);


            //Добавляем fromelf
            foreach (LogQueueItem item in messages)
            {
                if (item.Message.ToLower().Contains(ARMFROMELFPath))
                {
                    target.AfterBuild.Add(item.Message);
                }
            }

            target.Num = uVisionProject.TargetList.Count + 1;
            uVisionProject.TargetList.Add(target.Num, target);

            if (target.BeforeBuild.Count > 0)
            {
                target.Options.BrunUsr_0.Run = TWO_STATE_BOOL.ENABLED;
                target.Options.BrunUsr_0.Command = ".\\BatFiles\\Prebuild" + @"\" + target.Name + ".bat";
            }

            if (target.AfterBuild.Count > 0)
            {
                target.Options.RunUsr_0.Run = TWO_STATE_BOOL.ENABLED;
                target.Options.RunUsr_0.Command = ".\\BatFiles\\Postbuild" + @"\" + target.Name + ".bat";
            }

        }
Exemplo n.º 2
0
        //private void CreateBrowseTarget(Link link)
        //{
        //    Target target = new Target();
        //    //Установка опций по умолчанию
        //    target.SeTLPC2478DefaultOptions();

        //    target.Name = "Browse";
        //    target.Options.OutDir += uVisionTargetsPath + "\\" + target.Name + "\\";
        //    target.Options.OutName = Path.GetFileNameWithoutExtension(target.Name);

        //    target.Options.GenApp = TWO_STATE_BOOL.DISABLED;
        //    target.Options.GenLib = TWO_STATE_BOOL.DISABLED;

        //    target.Options.ADSFLGA = "226,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0";

        //    target.Options.ADSCCFLG.ARM_Thumb_Interworking = uVision.Project.THREE_STATE_BOOL.DISABLED;
        //    target.Options.ADSASFLG = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0";

        //    target.Options.Debug = "0";
        //    target.Options.Browse = "0";


        //    //Исключаем все файлы из построения
        //    foreach (PKStudio.uVision.Project.File f in uVisionProject.FileList.Values)
        //    {
        //        PKStudio.uVision.Project.FileOptions fileopt = new uVision.Project.FileOptions(f);
        //        fileopt.IncBld = THREE_STATE_BOOL.DISABLED;
        //        target.FilesOpton.Add(fileopt);
        //    }

        //    SortedList<int, RequiredObject> ReqObjs = link.GetAllRequiredObjects();

        //    foreach (RequiredObject obj in ReqObjs.Values)
        //    {
        //        this.AddCompileFile(obj, target);
        //    }

        //    target.Num = uVisionProject.TargetList.Count + 1;
        //    uVisionProject.TargetList.Add(target.Num, target);
        //}

        //private void CreateLinkTarget(Link link, IList<LogQueueItem> messages)
        //{
        //    Target target = new Target();
        //    //Установка опций по умолчанию
        //    target.SeTLPC2478DefaultOptions();

        //    target.Name = "Link";

        //    target.Options.GenApp = TWO_STATE_BOOL.DISABLED;
        //    target.Options.GenLib = TWO_STATE_BOOL.DISABLED;

        //    target.Options.ADSFLGA = "226,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0";

        //    //target.Options.OCR_RVCT = "1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,8,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,1,0,0,0,0,224,127,0,64,0,0";

        //    //target.Options.ADSLDFG = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0";

        //    target.Options.ADSLDTA = "";
        //    target.Options.ADSLDDA = "";

        //    //Исключаем все файлы из построения
        //    foreach (PKStudio.uVision.Project.File f in uVisionProject.FileList.Values)
        //    {
        //        if ((f.Type == uVision.Project.File.FILE_TYPE.C_FILE) || (f.Type == uVision.Project.File.FILE_TYPE.CPP_FILE) || (f.Type == uVision.Project.File.FILE_TYPE.ASM_FILE))
        //        {
        //            PKStudio.uVision.Project.FileOptions fileopt = new uVision.Project.FileOptions(f);
        //            fileopt.IncBld = THREE_STATE_BOOL.DISABLED;
        //            target.FilesOpton.Add(fileopt);
        //        }
        //    }

        //    target.Options.OutDir = Path.GetDirectoryName(link.OutputFileMSBuild) + "\\";
        //    target.Options.OutName = Path.GetFileNameWithoutExtension(link.OutputFileMSBuild);
        //    link.OutputFileuVision = link.OutputFileMSBuild;

        //    string LinkString = ARMLINKPath;

        //    foreach (ArgCollection arg in link.ParamCollection.Values)
        //    {
        //        if (arg.Tag == "options")
        //        {
        //            switch (arg.Name)
        //            {
        //                //Ничего не надо записывать, так ккак все пути будут содержаться в файл листе
        //                case "--userlibpath":
        //                    break;
        //                default:
        //                    if (arg.Count > 0)
        //                    {
        //                        foreach (string s in arg)
        //                        {
        //                            LinkString += " " + arg.Name + " " + s;
        //                        }
        //                    }
        //                    else LinkString += " " + arg.Name;
        //                    break;
        //            }
        //        }
        //    }
        //    //foreach (RequiredLibrary lib in link.InputLibraries)
        //    //{
        //    //    LinkString += " --userlibpath " + Path.GetDirectoryName(lib.OutputFileuVision);
        //    //}

        //    //foreach (RequiredObject obj in link.InputObjects)
        //    //{
        //    //    LinkString += " --userlibpath " + Path.GetDirectoryName(obj.OutputFileuVision);
        //    //}

        //    //foreach (RequiredLibrary lib in link.InputLibraries)
        //    //{
        //    //    LinkString += " " + Path.GetFileName(lib.OutputFileuVision);
        //    //}

        //    //foreach (RequiredObject obj in link.InputObjects)
        //    //{
        //    //    LinkString += " " + Path.GetFileName(obj.OutputFileuVision);
        //    //}

        //    foreach (BuildBase bb in link.AllInputs.Values)
        //    {
        //        LinkString += " " + bb.OutputFileuVision;
        //    }

        //    //foreach (RequiredLibrary lib in link.InputLibraries)
        //    //{
        //    //    LinkString += " " + lib.OutputFileuVision;
        //    //}

        //    //foreach (RequiredObject obj in link.InputObjects)
        //    //{
        //    //    LinkString += " " + obj.OutputFileuVision;
        //    //}

        //    target.AfterBuild.Add(LinkString);


        //    //Добавляем fromelf
        //    foreach (LogQueueItem item in messages)
        //    {
        //        if (item.Message.ToLower().Contains(ARMFROMELFPath))
        //        {
        //            target.AfterBuild.Add(item.Message);
        //        }
        //    }

        //    target.Num = uVisionProject.TargetList.Count + 1;
        //    uVisionProject.TargetList.Add(target.Num, target);

        //    if (target.BeforeBuild.Count > 0)
        //    {
        //        target.Options.BrunUsr_0.Run = TWO_STATE_BOOL.ENABLED;
        //        target.Options.BrunUsr_0.Command = ".\\BatFiles\\Prebuild\\" + @"\" + target.Name + ".bat";
        //    }

        //    if (target.AfterBuild.Count > 0)
        //    {
        //        target.Options.RunUsr_0.Run = TWO_STATE_BOOL.ENABLED;
        //        target.Options.RunUsr_0.Command = ".\\BatFiles\\Postbuild\\" + @"\" + target.Name + ".bat";
        //    }

        //}

        private void AddCompileFile(RequiredObject obj, Target target)
        {
            string DefaultWorkingDir = Directory.GetCurrentDirectory();
            Directory.SetCurrentDirectory(obj.CurrentDir);
            foreach (string path in obj.ParamCollection.Files.Values)
            {
                PKStudio.uVision.Project.FileOptions fileOpt = target.FindFileOptions(Path.GetFullPath(ExpandPath(path)));
                if (fileOpt == null) throw new Exception("Can't find file options");


                fileOpt.IncBld = THREE_STATE_BOOL.ENABLED;

                foreach (ArgCollection arg in obj.ParamCollection.Values)
                {
                    if (arg.Tag != "options") continue;
                    switch (arg.Name)
                    {
                        case "-I":
                            foreach (string include in arg)
                            {
                                fileOpt.Include.Add(include);
                            }
                            break;
                        case "-D":

                            foreach (string def in arg)
                            {
                                if (!def.Contains("="))
                                    fileOpt.Define.Add(def);
                                else
                                    fileOpt.Misc.Add("-D" + def);
                            }

                            break;
                        case "--PD":
                            foreach (string def in arg)
                            {
                                if (fileOpt.File.Type == uVision.Project.File.FILE_TYPE.ASM_FILE)
                                    fileOpt.Misc.Add("--PD " + def);
                            }
                            break;
                        case "--split_sections":
                            fileOpt.ADSCCFLG.One_EFL_Section_per_Function = uVision.Project.THREE_STATE_BOOL.ENABLED;
                            break;
                        //case "--fpu":
                        //    fileOpt.Misc.Add("--fpu " + arg[0]);
                        //    break;
                        case "--littleend":
                            fileOpt.Misc.Add("--littleend");
                            break;
                        case "-c":
                            break;
                        case "--cpp":
                            fileOpt.Misc.Add("--cpp");
                            break;
                        case "-O":
                            PKStudio.uVision.Project.OPTIMIZATION tmp = PKStudio.uVision.Project.OPTIMIZATION.Default;
                            switch (arg[0])
                            {
                                case "0":
                                    tmp = PKStudio.uVision.Project.OPTIMIZATION.Level0;
                                    break;
                                case "1":
                                    tmp = PKStudio.uVision.Project.OPTIMIZATION.Level1;
                                    break;
                                case "2":
                                    tmp = PKStudio.uVision.Project.OPTIMIZATION.Level2;
                                    break;
                                case "3":
                                    tmp = PKStudio.uVision.Project.OPTIMIZATION.Level3;
                                    break;
                                default:
                                    break;
                            }
                            fileOpt.ADSCCFLG.Optimisation = tmp;
                            break;
                        case "--diag_suppress":
                            foreach (string item in arg)
                            {
                                //if (!target.Options.ADSCMISC.Contains("--diag_suppress " + item))
                                //{
                                fileOpt.Misc.Add("--diag_suppress " + item);
                                //}
                            }

                            break;
                        //Этот параметр игнорируем, така uVision IDE его подставляет по умолчанию
                        case "--device":
                            break;
                        //Этот параметр обраюатываем особо
                        case "-o":
                            //obj.OutputFileuVision = uVisionProjectPath + target.Options.OutDir.Replace(".", "") + Path.GetFileNameWithoutExtension(arg[0]) + ".o ";
                            break;
                        //case "--LIST":
                        //case "--list":
                        //s = "IF NOT EXIST " + Path.GetDirectoryName(arg[0]) + " md " + Path.GetDirectoryName(arg[0]);
                        //if (!target.BeforeBuild.Contains(s))
                        //    target.BeforeBuild.Add(s);
                        //break;
                        default:
                            string str = arg.Name;
                            foreach (string item in arg)
                            {
                                str += " " + item;
                            }
                            fileOpt.Misc.Add(str);
                            break;
                    }
                }
            }
            Directory.SetCurrentDirectory(DefaultWorkingDir);
        }
Exemplo n.º 3
0
        private void CreateLibraryTartet(RequiredLibrary lib)
        {
            Target target = new Target();
            //Установка опций по умолчанию
            target.SeTLPC2478DefaultOptions();

            target.Name = Path.GetFileNameWithoutExtension(lib.Name);
            target.Options.OutDir += uVisionTargetsPath + "\\" + target.Name + "\\";
            target.Options.OutName = Path.GetFileNameWithoutExtension(lib.Name);

            target.Options.GenApp = TWO_STATE_BOOL.DISABLED;
            target.Options.GenLib = TWO_STATE_BOOL.ENABLED;

            target.Options.ADSFLGA = "226,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0";

            target.Options.ADSCCFLG.ARM_Thumb_Interworking = uVision.Project.THREE_STATE_BOOL.DISABLED;
            target.Options.ADSASFLG = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0";
            target.Options.Debug = "1";
            target.Options.Browse = "1";


            //Исключаем все файлы из построения
            foreach (PKStudio.uVision.Project.File f in uVisionProject.FileList.Values)
            {
                PKStudio.uVision.Project.FileOptions fileopt = new uVision.Project.FileOptions(f);
                fileopt.IncBld = THREE_STATE_BOOL.DISABLED;
                target.FilesOpton.Add(fileopt);
            }

            foreach (RequiredObject obj in lib.InputObjects.Values)
            {
                this.AddCompileFile(obj, target);
            }

            foreach (RequiredLibrary reqlib in lib.InputLibraries.Values)
            {
                PKStudio.uVision.Project.FileOptions fileOpt = target.FindFileOptions(reqlib.OutputFileuVision);
                if (fileOpt == null) throw new Exception("Can't find lib file options");
                fileOpt.IncBld = THREE_STATE_BOOL.ENABLED;
                this.CreateLibraryTartet(reqlib);
            }

            target.Num = uVisionProject.TargetList.Count + 1;
            uVisionProject.TargetList.Add(target.Num, target);

            if (target.BeforeBuild.Count > 0)
            {
                target.Options.BrunUsr_0.Run = TWO_STATE_BOOL.ENABLED;
                target.Options.BrunUsr_0.Command = ".\\BatFiles\\Prebuild" + @"\" + target.Name + ".bat";
            }

            if (target.AfterBuild.Count > 0)
            {
                target.Options.RunUsr_0.Run = TWO_STATE_BOOL.ENABLED;
                target.Options.RunUsr_0.Command = ".\\BatFiles\\Postbuild" + @"\" + target.Name + ".bat";
            }
        }