/// <summary> /// Initializes all commands and arguments (also debug&release args!) with default values depending on given target compiler type /// </summary> public static DCompilerConfiguration CreateWithDefaults(DCompilerVendor Compiler) { var cfg = new DCompilerConfiguration { Vendor = Compiler }; ResetToDefaults(cfg, Compiler); return(cfg); }
public DCompilerConfiguration GetCompiler(DCompilerVendor type) { switch (type) { case DCompilerVendor.GDC: return(Gdc); case DCompilerVendor.LDC: return(Ldc); } return(Dmd); }
public ICustomXmlSerializer ReadFrom(XmlReader x) { if (!x.Read()) { return(this); } while (x.Read()) { switch (x.LocalName) { case "DefaultCompiler": if (x.MoveToAttribute("Name")) { DefaultCompiler = (DCompilerVendor)Enum.Parse(typeof(DCompilerVendor), x.ReadContentAsString()); } break; case "Compiler": var vendor = DCompilerVendor.DMD; if (x.MoveToAttribute("Name")) { vendor = (DCompilerVendor)Enum.Parse(typeof(DCompilerVendor), x.ReadContentAsString()); x.MoveToElement(); } var cmp = GetCompiler(vendor); cmp.Vendor = vendor; cmp.ReadFrom(x.ReadSubtree()); break; case "ResCmp": Win32ResourceCompiler.Instance.Load(x.ReadSubtree()); break; } } return(this); }
public static void ResetToDefaults(DCompilerConfiguration cfg, DCompilerVendor Compiler) { CompilerDefaultArgumentProvider cmp = null; switch (Compiler) { case DCompilerVendor.DMD: cmp = new Dmd(cfg); break; case DCompilerVendor.GDC: cmp = new Gdc(cfg); break; case DCompilerVendor.LDC: cmp = new Ldc(cfg); break; } // Reset arguments BEFORE reset compiler commands - only then, the 4 link target config objects will be created. cmp.ResetBuildArguments(); cmp.ResetCompilerConfiguration(); }
/// <summary> /// Initializes all commands and arguments (also debug&release args!) with default values depending on given target compiler type /// </summary> public static DCompilerConfiguration CreateWithDefaults(DCompilerVendor Compiler) { var cfg = new DCompilerConfiguration { Vendor=Compiler }; ResetToDefaults(cfg, Compiler); return cfg; }
public ICustomXmlSerializer ReadFrom(XmlReader x) { if (!x.Read()) return this; while (x.Read()) { switch (x.LocalName) { case "DefaultCompiler": if (x.MoveToAttribute("Name")) DefaultCompiler = (DCompilerVendor)Enum.Parse(typeof(DCompilerVendor), x.ReadContentAsString()); break; case "Compiler": var vendor = DCompilerVendor.DMD; if (x.MoveToAttribute("Name")) { vendor = (DCompilerVendor)Enum.Parse(typeof(DCompilerVendor), x.ReadContentAsString()); x.MoveToElement(); } var cmp=GetCompiler(vendor); cmp.Vendor = vendor; cmp.ReadFrom(x.ReadSubtree()); break; case "ResCmp": Win32ResourceCompiler.Instance.Load( x.ReadSubtree()); break; } } return this; }
public DCompilerConfiguration GetCompiler(DCompilerVendor type) { switch (type) { case DCompilerVendor.GDC: return Gdc; case DCompilerVendor.LDC: return Ldc; } return Dmd; }
public DProject(ProjectCreateInformation info, XmlElement projectOptions) { Init(); string binPath = "."; if (info != null) { Name = info.ProjectName; binPath = info.BinPath; } var libs = projectOptions.GetElementsByTagName("Lib"); foreach (XmlNode lib in libs) if (!string.IsNullOrWhiteSpace(lib.InnerText)) ExtraLibraries.Add(lib.InnerText); // Create a debug configuration var cfg = CreateConfiguration("Debug") as DProjectConfiguration; cfg.DebugMode = true; Configurations.Add(cfg); // Create a release configuration cfg = CreateConfiguration("Release") as DProjectConfiguration; cfg.DebugMode = false; cfg.ExtraCompilerArguments = "-o"; Configurations.Add(cfg); // Prepare all configurations foreach (DProjectConfiguration c in Configurations) { c.OutputDirectory = Path.Combine(binPath, c.Id); c.Output = Name; if (projectOptions != null) { // Set project's target type to the one which has been defined in the project template if (projectOptions.Attributes["Target"] != null) { CompileTarget = (DCompileTarget)Enum.Parse( typeof(DCompileTarget), projectOptions.Attributes["Target"].InnerText); } // Set project's compiler if (projectOptions.Attributes["Compiler"] != null) { UsedCompilerVendor = (DCompilerVendor)Enum.Parse( typeof(DCompilerVendor), projectOptions.Attributes["Compiler"].InnerText); } // Set extra compiler&linker args if (projectOptions.Attributes["CompilerArgs"].InnerText != null) { c.ExtraCompilerArguments = projectOptions.Attributes["CompilerArgs"].InnerText; } if (projectOptions.Attributes["LinkerArgs"].InnerText != null) { c.ExtraLinkerArguments = projectOptions.Attributes["LinkerArgs"].InnerText; } if (projectOptions.GetAttribute("ExternalConsole") == "True") { c.ExternalConsole = true; c.PauseConsoleOutput = true; } if (projectOptions.Attributes["PauseConsoleOutput"] != null) { c.PauseConsoleOutput = bool.Parse( projectOptions.Attributes["PauseConsoleOutput"].InnerText); } } } }
public DProject(ProjectCreateInformation info, XmlElement projectOptions) { Init(); string binPath = "."; if (info != null) { Name = info.ProjectName; binPath = info.BinPath; } var libs = projectOptions.GetElementsByTagName("Lib"); foreach (XmlNode lib in libs) { if (!string.IsNullOrWhiteSpace(lib.InnerText)) { ExtraLibraries.Add(lib.InnerText); } } // Create a debug configuration var cfg = CreateConfiguration("Debug") as DProjectConfiguration; cfg.DebugMode = true; Configurations.Add(cfg); // Create a release configuration cfg = CreateConfiguration("Release") as DProjectConfiguration; cfg.DebugMode = false; cfg.ExtraCompilerArguments = "-o"; Configurations.Add(cfg); // Prepare all configurations foreach (DProjectConfiguration c in Configurations) { c.OutputDirectory = Path.Combine(binPath, c.Id); c.Output = Name; if (projectOptions != null) { // Set project's target type to the one which has been defined in the project template if (projectOptions.Attributes["Target"] != null) { CompileTarget = (DCompileTarget)Enum.Parse( typeof(DCompileTarget), projectOptions.Attributes["Target"].InnerText); } // Set project's compiler if (projectOptions.Attributes["Compiler"] != null) { UsedCompilerVendor = (DCompilerVendor)Enum.Parse( typeof(DCompilerVendor), projectOptions.Attributes["Compiler"].InnerText); } // Set extra compiler&linker args if (projectOptions.Attributes["CompilerArgs"].InnerText != null) { c.ExtraCompilerArguments = projectOptions.Attributes["CompilerArgs"].InnerText; } if (projectOptions.Attributes["LinkerArgs"].InnerText != null) { c.ExtraLinkerArguments = projectOptions.Attributes["LinkerArgs"].InnerText; } if (projectOptions.GetAttribute("ExternalConsole") == "True") { c.ExternalConsole = true; c.PauseConsoleOutput = true; } if (projectOptions.Attributes["PauseConsoleOutput"] != null) { c.PauseConsoleOutput = bool.Parse( projectOptions.Attributes["PauseConsoleOutput"].InnerText); } } } }