本文整理汇总了C#中Bam类的典型用法代码示例。如果您正苦于以下问题:C# Bam类的具体用法?C# Bam怎么用?C# Bam使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Bam类属于命名空间,在下文中一共展示了Bam类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
protected override void Init(
Bam.Core.Module parent)
{
base.Init(parent);
var qtPackage = Bam.Core.Graph.Instance.Packages.First(item => item.Name == "Qt");
var qtMeta = qtPackage.MetaData as IICUMeta;
this.Macros.Add("ICUVersion", Bam.Core.TokenizedString.CreateVerbatim(qtMeta.Version));
this.Macros["MajorVersion"] = this.Macros["ICUVersion"];
this.Macros["MinorVersion"] = Bam.Core.TokenizedString.CreateVerbatim("1");
this.Macros.Remove("PatchVersion"); // does not use this part of the version numbering system
this.Macros.Add("QtInstallPath", Configure.InstallPath);
if (this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows))
{
this.Macros.Add("ICUInstallPath", this.CreateTokenizedString("$(QtInstallPath)/bin"));
}
else if (this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Linux))
{
this.Macros.Add("ICUInstallPath", this.CreateTokenizedString("$(QtInstallPath)/lib"));
}
this.GeneratedPaths[C.DynamicLibrary.Key] = this.CreateTokenizedString("$(ICUInstallPath)/$(dynamicprefix)$(OutputName)$(dynamicext)");
}
示例2: GetConfiguration
GetConfiguration(
Bam.Core.Module module)
{
lock (this.Configurations)
{
var moduleConfig = module.BuildEnvironment.Configuration;
if (this.Configurations.ContainsKey(moduleConfig))
{
return this.Configurations[moduleConfig];
}
var platform = Bam.Core.EPlatform.Invalid;
var bitDepth = (module as C.CModule).BitDepth;
switch (bitDepth)
{
case C.EBit.ThirtyTwo:
platform = Bam.Core.EPlatform.Win32;
break;
case C.EBit.SixtyFour:
platform = Bam.Core.EPlatform.Win64;
break;
}
if (Bam.Core.EPlatform.Invalid == platform)
{
throw new Bam.Core.Exception("Platform cannot be extracted from the tool {0} for project {1}", module.Tool.ToString(), this.ProjectPath);
}
var configuration = new VSProjectConfiguration(this, module, platform);
this.Configurations.Add(moduleConfig, configuration);
return configuration;
}
}
示例3: VSProjectConfiguration
public VSProjectConfiguration(
VSProject project,
Bam.Core.Module module,
Bam.Core.EPlatform platform)
{
this.Project = project;
this.Module = module;
this.Configuration = module.BuildEnvironment.Configuration;
this.Platform = platform;
this.FullName = this.CombinedName;
this.Type = EType.NA;
var visualCMeta = Bam.Core.Graph.Instance.PackageMetaData<VisualC.MetaData>("VisualC");
this.PlatformToolset = visualCMeta.PlatformToolset;
this.UseDebugLibraries = false;
this.CharacterSet = C.ECharacterSet.NotSet;
this.WholeProgramOptimization = false;// TODO: false is consistent with Native builds (module.BuildEnvironment.Configuration != Bam.Core.EConfiguration.Debug);
this.SettingGroups = new Bam.Core.Array<VSSettingsGroup>();
this.Sources = new Bam.Core.Array<VSSettingsGroup>();
this.PreBuildCommands = new Bam.Core.StringArray();
this.PostBuildCommands = new Bam.Core.StringArray();
}
示例4: Convert
public static void Convert(
this C.ICommonLinkerSettings settings,
Bam.Core.StringArray commandLine)
{
var module = (settings as Bam.Core.Settings).Module;
switch (settings.OutputType)
{
case C.ELinkerOutput.Executable:
commandLine.Add(System.String.Format("-OUT:{0}", module.GeneratedPaths[C.ConsoleApplication.Key].ToString()));
break;
case C.ELinkerOutput.DynamicLibrary:
commandLine.Add("-DLL");
commandLine.Add(System.String.Format("-OUT:{0}", module.GeneratedPaths[C.ConsoleApplication.Key].ToString()));
break;
}
foreach (var path in settings.LibraryPaths)
{
commandLine.Add(System.String.Format("-LIBPATH:{0}", path.ParseAndQuoteIfNecessary()));
}
foreach (var path in settings.Libraries)
{
commandLine.Add(path);
}
if (settings.DebugSymbols)
{
commandLine.Add("-DEBUG");
if (null != module.GeneratedPaths[C.ConsoleApplication.PDBKey])
{
commandLine.Add(System.String.Format("-PDB:{0}", module.GeneratedPaths[C.ConsoleApplication.PDBKey].Parse()));
}
}
}
示例5: Convert
public static void Convert(
System.Type conversionClass,
Bam.Core.Settings toolSettings,
Bam.Core.Module module,
XcodeBuilder.Configuration configuration)
{
var moduleType = typeof(Bam.Core.Module);
var xcodeConfigurationType = typeof(XcodeBuilder.Configuration);
foreach (var i in toolSettings.Interfaces())
{
var method = conversionClass.GetMethod("Convert", new[] { i, moduleType, xcodeConfigurationType });
if (null == method)
{
throw new Bam.Core.Exception("Unable to locate method {0}.Convert({1}, {2}, {3})",
conversionClass.ToString(),
i.ToString(),
moduleType,
xcodeConfigurationType);
}
try
{
method.Invoke(null, new object[] { toolSettings, module, configuration });
}
catch (System.Reflection.TargetInvocationException exception)
{
throw new Bam.Core.Exception(exception.InnerException, "Xcode conversion error:");
}
}
}
示例6: Convert
Convert(
this C.ICxxOnlyCompilerSettings settings,
Bam.Core.StringArray commandLine)
{
if (settings.ExceptionHandler.HasValue)
{
switch (settings.ExceptionHandler.Value)
{
case C.Cxx.EExceptionHandler.Disabled:
commandLine.Add("-fno-exceptions");
break;
case C.Cxx.EExceptionHandler.Asynchronous:
case C.Cxx.EExceptionHandler.Synchronous:
commandLine.Add("-fexceptions");
break;
default:
throw new Bam.Core.Exception("Unrecognized exception handler option, {0}", settings.ExceptionHandler.Value.ToString());
}
}
if (settings.LanguageStandard.HasValue)
{
switch (settings.LanguageStandard.Value)
{
case C.Cxx.ELanguageStandard.Cxx98:
commandLine.Add("-std=c++98");
break;
case C.Cxx.ELanguageStandard.GnuCxx98:
commandLine.Add("-std=gnu++98");
break;
case C.Cxx.ELanguageStandard.Cxx11:
commandLine.Add("-std=c++11");
break;
default:
throw new Bam.Core.Exception("Invalid C++ language standard, {0}", settings.LanguageStandard.Value.ToString());
}
}
if (settings.StandardLibrary.HasValue)
{
switch (settings.StandardLibrary.Value)
{
case C.Cxx.EStandardLibrary.NotSet:
break;
case C.Cxx.EStandardLibrary.libstdcxx:
commandLine.Add("-stdlib=libstdc++");
break;
case C.Cxx.EStandardLibrary.libcxx:
commandLine.Add("-stdlib=libc++");
break;
default:
throw new Bam.Core.Exception("Invalid C++ standard library {0}", settings.StandardLibrary.Value.ToString());
}
}
}
示例7: SetType
protected static void SetType(
Bam.Core.IModule module,
Bam.Core.Target target)
{
var options = module.Options as IOptions;
options.Target = ETarget.WindowsExecutable;
}
示例8: Init
protected override void Init(
Bam.Core.Module parent)
{
base.Init (parent);
this.CreateCSourceContainer("$(packagedir)/source/library.c");
}
示例9:
ITarPolicy.CreateTarBall(
TarBall sender,
Bam.Core.ExecutionContext context,
Bam.Core.ICommandLineTool compiler,
Bam.Core.TokenizedString scriptPath,
Bam.Core.TokenizedString outputPath)
{
var tarPath = outputPath.ToString();
var tarDir = System.IO.Path.GetDirectoryName(tarPath);
if (!System.IO.Directory.Exists(tarDir))
{
System.IO.Directory.CreateDirectory(tarDir);
}
var commandLine = new Bam.Core.StringArray();
(sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);
commandLine.Add("-c");
commandLine.Add("-v");
commandLine.Add("-T");
commandLine.Add(scriptPath.Parse());
commandLine.Add("-f");
commandLine.Add(tarPath);
CommandLineProcessor.Processor.Execute(context, compiler, commandLine);
}
示例10: Convert
public static void Convert(
this C.ICOnlyCompilerSettings settings,
Bam.Core.Module module,
XcodeBuilder.Configuration configuration)
{
if (settings.LanguageStandard.HasValue)
{
switch (settings.LanguageStandard.Value)
{
case C.ELanguageStandard.C89:
configuration["GCC_C_LANGUAGE_STANDARD"] = new XcodeBuilder.UniqueConfigurationValue("c89");
break;
case C.ELanguageStandard.GNU89:
configuration["GCC_C_LANGUAGE_STANDARD"] = new XcodeBuilder.UniqueConfigurationValue("gnu89");
break;
case C.ELanguageStandard.C99:
configuration["GCC_C_LANGUAGE_STANDARD"] = new XcodeBuilder.UniqueConfigurationValue("c99");
break;
case C.ELanguageStandard.GNU99:
configuration["GCC_C_LANGUAGE_STANDARD"] = new XcodeBuilder.UniqueConfigurationValue("gnu99");
break;
default:
throw new Bam.Core.Exception("Invalid C language standard, {0}", settings.LanguageStandard.Value.ToString());
}
}
}
示例11: Convert
public static void Convert(
System.Type conversionClass,
Bam.Core.Settings settings,
Bam.Core.Module module,
VSSolutionBuilder.VSSettingsGroup vsSettingsGroup,
string condition)
{
var moduleType = typeof(Bam.Core.Module);
var vsSettingsGroupType = typeof(VSSolutionBuilder.VSSettingsGroup);
var stringType = typeof(string);
foreach (var i in settings.Interfaces())
{
var method = conversionClass.GetMethod("Convert", new[] { i, moduleType, vsSettingsGroupType, stringType });
if (null == method)
{
throw new Bam.Core.Exception("Unable to locate method {0}.Convert({1}, {2}, {3})",
conversionClass.ToString(),
i.ToString(),
moduleType,
vsSettingsGroupType,
stringType);
}
try
{
method.Invoke(null, new object[] { settings, module, vsSettingsGroup, condition });
}
catch (System.Reflection.TargetInvocationException exception)
{
throw new Bam.Core.Exception(exception.InnerException, "VisualStudio conversion error:");
}
}
}
示例12:
void IRccGenerationPolicy.Rcc(
RccGeneratedSource sender,
Bam.Core.ExecutionContext context,
Bam.Core.ICommandLineTool rccCompiler,
Bam.Core.TokenizedString generatedRccSource,
QRCFile source)
{
var encapsulating = sender.GetEncapsulatingReferencedModule();
var solution = Bam.Core.Graph.Instance.MetaData as VSSolutionBuilder.VSSolution;
var project = solution.EnsureProjectExists(encapsulating);
var config = project.GetConfiguration(encapsulating);
var output = generatedRccSource.Parse();
var args = new Bam.Core.StringArray();
args.Add(CommandLineProcessor.Processor.StringifyTool(rccCompiler));
(sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(args);
args.Add(System.String.Format("-o {0}", output));
args.Add("%(FullPath)");
config.AddOtherFile(source);
var customBuild = config.GetSettingsGroup(VSSolutionBuilder.VSSettingsGroup.ESettingsGroup.CustomBuild, include: source.InputPath, uniqueToProject: true);
customBuild.AddSetting("Command", args.ToString(' '), condition: config.ConditionText);
customBuild.AddSetting("Message", System.String.Format("Rccing {0}", System.IO.Path.GetFileName(source.InputPath.Parse())), condition: config.ConditionText);
customBuild.AddSetting("Outputs", output, condition: config.ConditionText);
}
示例13:
void IGeneratedSourcePolicy.GenerateSource(
GeneratedSourceModule sender,
Bam.Core.ExecutionContext context,
Bam.Core.ICommandLineTool compiler,
Bam.Core.TokenizedString generatedFilePath)
{
var encapsulating = sender.GetEncapsulatingReferencedModule();
var workspace = Bam.Core.Graph.Instance.MetaData as XcodeBuilder.WorkspaceMeta;
var target = workspace.EnsureTargetExists(encapsulating);
var configuration = target.GetConfiguration(encapsulating);
var command = new System.Text.StringBuilder();
// recode the executable path for Xcode
var xcodePath = encapsulating.CreateTokenizedString("$(packagebuilddir)/$(config)").Parse();
xcodePath += "/" + System.IO.Path.GetFileName(compiler.Executable.Parse());
command.AppendFormat(xcodePath);
// TODO: change this to a configuration directory really
command.AppendFormat(" {0}", Bam.Core.TokenizedString.Create("$(buildroot)", null).Parse());
command.AppendFormat(" {0}", "Generated");
var commands = new Bam.Core.StringArray();
commands.Add(command.ToString());
target.AddPreBuildCommands(commands, configuration);
var compilerTarget = workspace.EnsureTargetExists(compiler as Bam.Core.Module);
target.Requires(compilerTarget);
}
示例14: Convert
Convert(
this IObjCopyToolSettings settings,
Bam.Core.StringArray commandLine)
{
var objCopy = (settings as Bam.Core.Settings).Module as ObjCopyModule;
switch (settings.Mode)
{
case EObjCopyToolMode.OnlyKeepDebug:
commandLine.Add(System.String.Format("--only-keep-debug {0} {1}",
objCopy.SourceModule.GeneratedPaths[objCopy.SourceKey].Parse(),
objCopy.GeneratedPaths[ObjCopyModule.Key].Parse()));
break;
case EObjCopyToolMode.AddGNUDebugLink:
commandLine.Add(System.String.Format("--add-gnu-debuglink={0} {1}",
objCopy.GeneratedPaths[ObjCopyModule.Key].Parse(),
objCopy.SourceModule.GeneratedPaths[objCopy.SourceKey].Parse()));
break;
default:
throw new Bam.Core.Exception("Unrecognized objcopy mode, {0}", settings.Mode.ToString());
}
if (settings.Verbose)
{
commandLine.Add("-v");
}
}
示例15: SetDefaultOptionValues
SetDefaultOptionValues(
Bam.Core.DependencyNode node)
{
base.SetDefaultOptionValues(node);
// TODO: think I can move this to GccCommon, but it misses out the C++ include paths for some reason (see Test9-dev)
var target = node.Target;
var gccToolset = target.Toolset as GccCommon.Toolset;
var machineType = gccToolset.GccDetail.Target;
var cxxIncludePath = gccToolset.GccDetail.GxxIncludePath;
if (!System.IO.Directory.Exists(cxxIncludePath))
{
throw new Bam.Core.Exception("Gcc C++ include path '{0}' does not exist. Is g++ installed?", cxxIncludePath);
}
var cxxIncludePath2 = System.String.Format("{0}/{1}", cxxIncludePath, machineType);
if (!System.IO.Directory.Exists(cxxIncludePath2))
{
throw new Bam.Core.Exception("Gcc C++ include path '{0}' does not exist. Is g++ installed?", cxxIncludePath2);
}
var cCompilerOptions = this as C.ICCompilerOptions;
cCompilerOptions.SystemIncludePaths.Add(cxxIncludePath);
cCompilerOptions.SystemIncludePaths.Add(cxxIncludePath2);
GccCommon.CxxCompilerOptionCollection.ExportedDefaults(this, node);
}