Defaults( this C.ICommonWinResourceCompilerSettings settings, Bam.Core.Module module) { settings.Verbose = false; settings.IncludePaths = new Bam.Core.TokenizedStringArray(); }
Convert( this C.ICommonWinResourceCompilerSettings settings, Bam.Core.StringArray commandLine) { if (settings.Verbose.HasValue && settings.Verbose.Value) { commandLine.Add("-v"); } foreach (var path in settings.IncludePaths) { commandLine.Add(System.String.Format("-i{0}", path.ParseAndQuoteIfNecessary())); } foreach (var define in settings.PreprocessorDefines) { if (System.String.IsNullOrEmpty(define.Value)) { commandLine.Add(System.String.Format("-D{0}", define.Key)); } else { var value = define.Value; if (value.Contains("\"")) { value = value.Replace("\"", "\\\""); } commandLine.Add(System.String.Format("-D{0}={1}", define.Key, value)); } } var resource = (settings as Bam.Core.Settings).Module as C.WinResource; commandLine.Add(System.String.Format("-Fo{0}", resource.GeneratedPaths[C.ObjectFile.Key].ParseAndQuoteIfNecessary())); }
Convert( this C.ICommonWinResourceCompilerSettings settings, Bam.Core.StringArray commandLine) { if (settings.Verbose.HasValue && settings.Verbose.Value) { commandLine.Add("-v"); } foreach (var path in settings.IncludePaths) { var realpath = path.Parse(); if (path.ContainsSpace) { // windres cannot cope with paths with spaces, even when quoted // https://sourceware.org/bugzilla/show_bug.cgi?id=4356 var shortPath = GetShortPathName(realpath); commandLine.Add(System.String.Format("--include-dir={0}", shortPath)); } else { commandLine.Add(System.String.Format("--include-dir={0}", realpath)); } } var resource = (settings as Bam.Core.Settings).Module as C.WinResource; commandLine.Add("--use-temp-file"); // avoiding a popen error, see https://amindlost.wordpress.com/2012/06/09/mingw-windres-exe-cant-popen-error/ commandLine.Add(System.String.Format("-o {0}", resource.GeneratedPaths[C.ObjectFile.Key].ParseAndQuoteIfNecessary())); }
Convert( this C.ICommonWinResourceCompilerSettings settings, Bam.Core.Module module, VSSolutionBuilder.VSSettingsGroup vsSettingsGroup, string condition) { if (settings.Verbose.HasValue) { vsSettingsGroup.AddSetting("ShowProgress", settings.Verbose.Value, condition); } vsSettingsGroup.AddSetting("ResourceOutputFileName", module.GeneratedPaths[C.ObjectFile.Key].Parse(), condition); }
Convert( this C.ICommonWinResourceCompilerSettings settings, Bam.Core.StringArray commandLine) { if (settings.Verbose.HasValue && settings.Verbose.Value) { commandLine.Add("-v"); } var resource = (settings as Bam.Core.Settings).Module as C.WinResource; commandLine.Add(System.String.Format("-Fo{0}", resource.GeneratedPaths[C.ObjectFile.Key].ParseAndQuoteIfNecessary())); }
Convert( this C.ICommonWinResourceCompilerSettings settings, Bam.Core.StringArray commandLine) { if (settings.Verbose.HasValue && settings.Verbose.Value) { commandLine.Add("-v"); } foreach (var path in settings.IncludePaths.ToEnumerableWithoutDuplicates()) { path.Parse(); var realpath = path.ToString(); if (path.ContainsSpace) { // windres cannot cope with paths with spaces, even when quoted // https://sourceware.org/bugzilla/show_bug.cgi?id=4356 var shortPath = GetShortPathName(realpath); commandLine.Add(System.String.Format("--include-dir={0}", shortPath)); } else { commandLine.Add(System.String.Format("--include-dir={0}", realpath)); } } foreach (var define in settings.PreprocessorDefines) { if (null == define.Value) { commandLine.Add(System.String.Format("-D{0}", define.Key)); } else { var defineValue = define.Value.ToString(); if (defineValue.Contains("\"")) { defineValue = defineValue.Replace("\"", "\\\""); } defineValue = Bam.Core.IOWrapper.EncloseSpaceContainingPathWithDoubleQuotes(defineValue); commandLine.Add(System.String.Format("-D{0}={1}", define.Key, defineValue)); } } var resource = (settings as Bam.Core.Settings).Module as C.WinResource; commandLine.Add("--use-temp-file"); // avoiding a popen error, see https://amindlost.wordpress.com/2012/06/09/mingw-windres-exe-cant-popen-error/ // if there is a space in the output path, windres has no chance really // since you cannot get the short name of a file that doesn't yet exist commandLine.Add(System.String.Format("-o {0}", resource.GeneratedPaths[C.ObjectFile.Key].ToStringQuoteIfNecessary())); }
Convert( this C.ICommonWinResourceCompilerSettings settings, Bam.Core.StringArray commandLine) { if (settings.Verbose.HasValue && settings.Verbose.Value) { commandLine.Add("-v"); } var resource = (settings as Bam.Core.Settings).Module as C.WinResource; commandLine.Add("--use-temp-file"); // avoiding a popen error, see https://amindlost.wordpress.com/2012/06/09/mingw-windres-exe-cant-popen-error/ commandLine.Add(System.String.Format("-o {0}", resource.GeneratedPaths[C.ObjectFile.Key].ParseAndQuoteIfNecessary())); }
Convert( this C.ICommonWinResourceCompilerSettings settings, Bam.Core.Module module, VSSolutionBuilder.VSSettingsGroup vsSettingsGroup, string condition) { if (settings.Verbose.HasValue) { vsSettingsGroup.AddSetting("ShowProgress", settings.Verbose.Value, condition); } if (settings.IncludePaths.Count > 0) { vsSettingsGroup.AddSetting("AdditionalIncludeDirectories", settings.IncludePaths, condition, inheritExisting: true, arePaths: true); } vsSettingsGroup.AddSetting("ResourceOutputFileName", module.GeneratedPaths[C.ObjectFile.Key], condition, isPath: true); }
Convert( this C.ICommonWinResourceCompilerSettings settings, Bam.Core.StringArray commandLine) { if (settings.Verbose.HasValue && settings.Verbose.Value) { commandLine.Add("-v"); } foreach (var path in settings.IncludePaths.ToEnumerableWithoutDuplicates()) { commandLine.Add(System.String.Format("-i{0}", path.ToStringQuoteIfNecessary())); } foreach (var define in settings.PreprocessorDefines) { if (null == define.Value) { commandLine.Add(System.String.Format("-D{0}", define.Key)); } else { var defineValue = define.Value.ToString(); if (defineValue.Contains("\"")) { defineValue = defineValue.Replace("\"", "\\\""); } defineValue = Bam.Core.IOWrapper.EncloseSpaceContainingPathWithDoubleQuotes(defineValue); commandLine.Add(System.String.Format("-D{0}={1}", define.Key, defineValue)); } } var resource = (settings as Bam.Core.Settings).Module as C.WinResource; commandLine.Add(System.String.Format("-Fo{0}", resource.GeneratedPaths[C.ObjectFile.Key].ToStringQuoteIfNecessary())); }
Defaults( this C.ICommonWinResourceCompilerSettings settings, Bam.Core.Module module) { settings.Verbose = false; }