Convert( this C.ICommonAssemblerSettings settings, Bam.Core.Module module, VSSolutionBuilder.VSSettingsGroup vsSettingsGroup, string condition) { vsSettingsGroup.AddSetting("GenerateDebugInformation", settings.DebugSymbols, condition); switch (settings.OutputType) { case C.ECompilerOutput.CompileOnly: vsSettingsGroup.AddSetting("GeneratePreprocessedSourceListing", false, condition); break; case C.ECompilerOutput.Preprocess: vsSettingsGroup.AddSetting("GeneratePreprocessedSourceListing", true, condition); break; } vsSettingsGroup.AddSetting("TreatWarningsAsErrors", settings.WarningsAsErrors, condition); if (settings.IncludePaths.Any()) { vsSettingsGroup.AddSetting("IncludePaths", settings.IncludePaths, condition, inheritExisting: true, arePaths: true); } if (settings.PreprocessorDefines.Any()) { vsSettingsGroup.AddSetting("PreprocessorDefinitions", settings.PreprocessorDefines, condition, inheritExisting: true); } }
Defaults( this C.ICommonAssemblerSettings settings, Bam.Core.Module module) { settings.DebugSymbols = (0 != (module.BuildEnvironment.Configuration & (Bam.Core.EConfiguration.Debug | Bam.Core.EConfiguration.Profile))); settings.OutputType = ECompilerOutput.CompileOnly; settings.WarningsAsErrors = true; settings.IncludePaths = new Bam.Core.TokenizedStringArray(); settings.PreprocessorDefines = new PreprocessorDefinitions(); }
Convert( this C.ICommonAssemblerSettings settings, Bam.Core.StringArray commandLine) { var module = (settings as Bam.Core.Settings).Module; if (settings.DebugSymbols) { commandLine.Add("-g"); } switch (settings.OutputType) { case C.ECompilerOutput.CompileOnly: commandLine.Add(System.String.Format("-c -o {0}", module.GeneratedPaths[C.ObjectFile.Key].ToString())); break; case C.ECompilerOutput.Preprocess: commandLine.Add(System.String.Format("-E -o {0}", module.GeneratedPaths[C.ObjectFile.Key].ToString())); break; default: throw new Bam.Core.Exception("Unknown output type, {0}", settings.OutputType.ToString()); } if (settings.WarningsAsErrors) { commandLine.Add("-Werror"); } else { commandLine.Add("-Wno-error"); } 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)); } } }
Convert( this C.ICommonAssemblerSettings settings, Bam.Core.StringArray commandLine) { var module = (settings as Bam.Core.Settings).Module; if (settings.DebugSymbols) { commandLine.Add("-Zi"); } switch (settings.OutputType) { case C.ECompilerOutput.CompileOnly: commandLine.Add(System.String.Format("-c -Fo{0}", module.GeneratedPaths[C.ObjectFile.Key].ToStringQuoteIfNecessary())); break; case C.ECompilerOutput.Preprocess: commandLine.Add(System.String.Format("-EP -Fo{0}", module.GeneratedPaths[C.ObjectFile.Key].ToStringQuoteIfNecessary())); break; default: throw new Bam.Core.Exception("Unknown output type, {0}", settings.OutputType.ToString()); } if (settings.WarningsAsErrors) { commandLine.Add("-WX"); } 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)); } } }
Convert( this C.ICommonAssemblerSettings settings, Bam.Core.Module module, XcodeBuilder.Configuration configuration) { configuration["GCC_GENERATE_DEBUGGING_SYMBOLS"] = new XcodeBuilder.UniqueConfigurationValue(settings.DebugSymbols ? "YES" : "NO"); if (settings.IncludePaths.Count > 0) { var paths = new XcodeBuilder.MultiConfigurationValue(); foreach (var path in settings.IncludePaths) { var fullPath = path.Parse(); var relPath = Bam.Core.RelativePathUtilities.GetPath(fullPath, configuration.Project.SourceRoot); if (Bam.Core.RelativePathUtilities.IsPathAbsolute(relPath)) { paths.Add(fullPath); } else { paths.Add(System.String.Format("$(SRCROOT)/{0}", relPath)); } } configuration["USER_HEADER_SEARCH_PATHS"] = paths; } if (settings.PreprocessorDefines.Count > 0) { var defines = new XcodeBuilder.MultiConfigurationValue(); foreach (var define in settings.PreprocessorDefines) { if (System.String.IsNullOrEmpty(define.Value)) { defines.Add(define.Key); } else { var value = define.Value; if (value.Contains("\"")) { // note the number of back slashes here // required to get \\\" for each " in the original value value = value.Replace("\"", "\\\\\\\""); } defines.Add(System.String.Format("{0}={1}", define.Key, value)); } } configuration["GCC_PREPROCESSOR_DEFINITIONS"] = defines; } configuration["GCC_TREAT_WARNINGS_AS_ERRORS"] = new XcodeBuilder.UniqueConfigurationValue(settings.WarningsAsErrors ? "YES" : "NO"); }
Convert( this C.ICommonAssemblerSettings settings, Bam.Core.Module module, XcodeBuilder.Configuration configuration) { switch (settings.Bits.Value) { case C.EBit.ThirtyTwo: { configuration["VALID_ARCHS"] = new XcodeBuilder.UniqueConfigurationValue("i386"); configuration["ARCHS"] = new XcodeBuilder.UniqueConfigurationValue("$(ARCHS_STANDARD_32_BIT)"); } break; case C.EBit.SixtyFour: { configuration["VALID_ARCHS"] = new XcodeBuilder.UniqueConfigurationValue("x86_64"); configuration["ARCHS"] = new XcodeBuilder.UniqueConfigurationValue("$(ARCHS_STANDARD_64_BIT)"); } break; default: throw new Bam.Core.Exception("Unknown bit depth, {0}", settings.Bits.Value); } configuration["GCC_GENERATE_DEBUGGING_SYMBOLS"] = new XcodeBuilder.UniqueConfigurationValue(settings.DebugSymbols ? "YES" : "NO"); if (settings.IncludePaths.Count > 0) { var paths = new XcodeBuilder.MultiConfigurationValue(); foreach (var path in settings.IncludePaths.ToEnumerableWithoutDuplicates()) { path.Parse(); var fullPath = path.ToString(); var relPath = Bam.Core.RelativePathUtilities.GetPath(fullPath, configuration.Project.SourceRoot); if (Bam.Core.RelativePathUtilities.IsPathAbsolute(relPath)) { paths.Add(fullPath); } else { paths.Add(System.String.Format("$(SRCROOT)/{0}", relPath)); } } configuration["USER_HEADER_SEARCH_PATHS"] = paths; } if (settings.PreprocessorDefines.Count > 0) { var defines = new XcodeBuilder.MultiConfigurationValue(); foreach (var define in settings.PreprocessorDefines) { if (null == define.Value) { defines.Add(define.Key); } else { var defineValue = define.Value.ToString(); if (defineValue.Contains("\"")) { // note the number of back slashes here // required to get \\\" for each " in the original value defineValue = defineValue.Replace("\"", "\\\\\\\""); } defineValue = Bam.Core.IOWrapper.EncloseSpaceContainingPathWithDoubleQuotes(defineValue); defines.Add(System.String.Format("{0}={1}", define.Key, defineValue)); } } configuration["GCC_PREPROCESSOR_DEFINITIONS"] = defines; } configuration["GCC_TREAT_WARNINGS_AS_ERRORS"] = new XcodeBuilder.UniqueConfigurationValue(settings.WarningsAsErrors ? "YES" : "NO"); }