本文整理汇总了C#中CBinding.CProjectConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# CProjectConfiguration类的具体用法?C# CProjectConfiguration怎么用?C# CProjectConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CProjectConfiguration类属于CBinding命名空间,在下文中一共展示了CProjectConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Compile
public override ICompilerResult Compile (
ProjectFileCollection projectFiles,
ProjectPackageCollection packages,
CProjectConfiguration configuration,
IProgressMonitor monitor)
{
CompilerResults cr = new CompilerResults (new TempFileCollection ());
bool res = true;
string args = GetCompilerFlags (configuration);
string outputName = Path.Combine (configuration.OutputDirectory,
configuration.CompiledOutputName);
// Precompile header files and place them in .prec/<config_name>/
string precdir = Path.Combine (configuration.SourceDirectory, ".prec");
if (!Directory.Exists (precdir))
Directory.CreateDirectory (precdir);
precdir = Path.Combine (precdir, configuration.Name);
if (!Directory.Exists (precdir))
Directory.CreateDirectory (precdir);
PrecompileHeaders (projectFiles, configuration, args);
foreach (ProjectFile f in projectFiles) {
if (f.Subtype == Subtype.Directory) continue;
if (f.BuildAction == BuildAction.Compile) {
if (configuration.UseCcache || NeedsCompiling (f))
res = DoCompilation (f, args, packages, monitor, cr, configuration.UseCcache);
}
else
res = true;
if (!res) break;
}
if (res) {
switch (configuration.CompileTarget)
{
case CBinding.CompileTarget.Bin:
MakeBin (
projectFiles, packages, configuration, cr, monitor, outputName);
break;
case CBinding.CompileTarget.StaticLibrary:
MakeStaticLibrary (
projectFiles, monitor, outputName);
break;
case CBinding.CompileTarget.SharedLibrary:
MakeSharedLibrary (
projectFiles, packages, configuration, cr, monitor, outputName);
break;
}
}
return new DefaultCompilerResult (cr, "");
}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:56,代码来源:GNUCompiler.cs
示例2: Load
public void Load (CProjectConfiguration config)
{
configuration = config;
switch (configuration.WarningLevel)
{
case WarningLevel.None:
noWarningRadio.Active = true;
break;
case WarningLevel.Normal:
normalWarningRadio.Active = true;
break;
case WarningLevel.All:
allWarningRadio.Active = true;
break;
}
warningsAsErrorsCheckBox.Active = configuration.WarningsAsErrors;
optimizationSpinButton.Value = configuration.OptimizationLevel;
switch (configuration.CompileTarget)
{
case CBinding.CompileTarget.Bin:
targetComboBox.Active = 0;
break;
case CBinding.CompileTarget.StaticLibrary:
targetComboBox.Active = 1;
break;
case CBinding.CompileTarget.SharedLibrary:
targetComboBox.Active = 2;
break;
}
extraCompilerTextView.Buffer.Text = configuration.ExtraCompilerArguments;
extraLinkerTextView.Buffer.Text = configuration.ExtraLinkerArguments;
defineSymbolsTextEntry.Text = configuration.DefineSymbols;
libStore.Clear ();
foreach (string lib in configuration.Libs)
libStore.AppendValues (lib);
libPathStore.Clear ();
foreach (string libPath in configuration.LibPaths)
libPathStore.AppendValues (libPath);
includePathStore.Clear ();
foreach (string includePath in configuration.Includes)
includePathStore.AppendValues (includePath);
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:52,代码来源:CodeGenerationPanel.cs
示例3: Load
public void Load (CProjectConfiguration configuration)
{
this.configuration = configuration;
outputNameTextEntry.Text = configuration.Output;
outputEntry.Path = configuration.OutputDirectory;
parametersTextEntry.Text = configuration.CommandLineParameters;
if (externalConsoleCheckbox.Active)
pauseCheckbox.Sensitive = true;
externalConsoleCheckbox.Active = configuration.ExternalConsole;
pauseCheckbox.Active = configuration.PauseConsoleOutput;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:14,代码来源:OutputOptionsPanel.cs
示例4: OutputOptionsPanel
public OutputOptionsPanel (Properties customizationObject)
{
this.Build ();
table1.RowSpacing = 3;
configuration = customizationObject.Get<CProjectConfiguration> ("Config");
outputNameTextEntry.Text = configuration.Output;
outputPathTextEntry.Text = configuration.OutputDirectory;
parametersTextEntry.Text = configuration.CommandLineParameters;
externalConsoleCheckbox.Active = configuration.ExternalConsole;
pauseCheckbox.Active = configuration.PauseConsoleOutput;
}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:15,代码来源:OutputOptionsPanel.cs
示例5: IsStandardLibrary
/// <summary>
/// Checks whether a library can be linked with -lbasename
/// </summary>
/// <remarks>
/// This should return true iff directory is empty or in
/// the configured library paths, and library is of the form blah
/// or libblah.(a|so|dll|dylib),
/// </remarks>
internal bool IsStandardLibrary(CProjectConfiguration configuration,
string directory, string library,
ref string std_lib)
{
std_lib = library;
if(!(String.IsNullOrEmpty(directory) ||
configuration.LibPaths.Contains(directory)))
return false;
string libraryExtension = Path.GetExtension (library);
foreach (string extension in libraryExtensions)
{
if (libraryExtension.Equals (extension, StringComparison.OrdinalIgnoreCase)) {
if (library.StartsWith("lib", StringComparison.OrdinalIgnoreCase)) {
std_lib = std_lib.Substring(3);
return true;
} else {
return false;
}
}
}
return true;
}
开发者ID:thild,项目名称:monodevelop,代码行数:34,代码来源:GNUCompiler.cs
示例6: PrecompileHeaders
private bool PrecompileHeaders (ProjectFileCollection projectFiles,
CProjectConfiguration configuration,
string args,
IProgressMonitor monitor,
CompilerResults cr)
{
monitor.BeginTask (GettextCatalog.GetString ("Precompiling headers"), 1);
bool success = true;
foreach (ProjectFile file in projectFiles) {
if (file.Subtype == Subtype.Code && CProject.IsHeaderFile (file.Name)) {
string precomp = Path.Combine (configuration.SourceDirectory, ".prec");
precomp = Path.Combine (precomp, configuration.Id);
precomp = Path.Combine (precomp, Path.GetFileName (file.Name) + ".ghc");
if (file.BuildAction == BuildAction.Compile) {
if (!File.Exists (precomp) || configuration.UseCcache || File.GetLastWriteTime (file.Name) > File.GetLastWriteTime (precomp)) {
if (DoPrecompileHeader (file, precomp, args, monitor, cr) == false) {
success = false;
break;
}
}
} else {
//remove old files or they'll interfere with the build
if (File.Exists (precomp))
File.Delete (precomp);
}
}
}
if (success)
monitor.Step (1);
monitor.EndTask ();
return success;
}
开发者ID:thild,项目名称:monodevelop,代码行数:34,代码来源:GNUCompiler.cs
示例7: GetCompilerFlags
public override string GetCompilerFlags (CProjectConfiguration configuration)
{
StringBuilder args = new StringBuilder ();
string precdir = Path.Combine (configuration.SourceDirectory, ".prec");
CCompilationParameters cp =
(CCompilationParameters)configuration.CompilationParameters;
if (configuration.DebugMode)
args.Append ("-g ");
if (configuration.CompileTarget == CBinding.CompileTarget.SharedLibrary)
args.Append ("-fPIC ");
switch (cp.WarningLevel)
{
case WarningLevel.None:
args.Append ("-w ");
break;
case WarningLevel.Normal:
// nothing
break;
case WarningLevel.All:
args.Append ("-Wall ");
break;
}
args.Append ("-O" + cp.OptimizationLevel + " ");
if (cp.ExtraCompilerArguments != null && cp.ExtraCompilerArguments.Length > 0) {
string extraCompilerArgs = cp.ExtraCompilerArguments.Replace ('\n', ' ');
args.Append (extraCompilerArgs + " ");
}
if (cp.DefineSymbols != null && cp.DefineSymbols.Length > 0)
args.Append (ProcessDefineSymbols (cp.DefineSymbols) + " ");
if (configuration.Includes != null)
foreach (string inc in configuration.Includes)
args.Append ("-I" + inc + " ");
args.Append ("-I" + precdir);
return args.ToString ();
}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:45,代码来源:GNUCompiler.cs
示例8: Compile
public abstract BuildResult Compile (
Project project,
ProjectFileCollection projectFiles,
ProjectPackageCollection packages,
CProjectConfiguration configuration,
IProgressMonitor monitor);
开发者ID:riverans,项目名称:monodevelop,代码行数:6,代码来源:CCompiler.cs
示例9: GetCompilerFlags
public abstract string GetCompilerFlags (Project project, CProjectConfiguration configuration);
开发者ID:riverans,项目名称:monodevelop,代码行数:1,代码来源:CCompiler.cs
示例10: MakeSharedLibrary
private void MakeSharedLibrary(ProjectFileCollection projectFiles,
ProjectPackageCollection packages,
CProjectConfiguration configuration,
CompilerResults cr,
IProgressMonitor monitor, string outputName)
{
if (!NeedsUpdate (projectFiles, outputName)) return;
string objectFiles = StringArrayToSingleString (ObjectFiles (projectFiles));
string pkgargs = GeneratePkgLinkerArgs (packages);
StringBuilder args = new StringBuilder ();
CCompilationParameters cp =
(CCompilationParameters)configuration.CompilationParameters;
if (cp.ExtraLinkerArguments != null && cp.ExtraLinkerArguments.Length > 0) {
string extraLinkerArgs = cp.ExtraLinkerArguments.Replace ('\n', ' ');
args.Append (extraLinkerArgs + " ");
}
if (configuration.LibPaths != null)
foreach (string libpath in configuration.LibPaths)
args.Append ("-L" + libpath + " ");
if (configuration.Libs != null)
foreach (string lib in configuration.Libs)
args.Append ("-l" + lib + " ");
monitor.Log.WriteLine ("Generating shared object...");
string linker_args = string.Format ("-shared -o {0} {1} {2} {3}",
outputName, objectFiles, args.ToString (), pkgargs);
monitor.Log.WriteLine ("using: " + linkerCommand + " " + linker_args);
ProcessWrapper p = Runtime.ProcessService.StartProcess (linkerCommand, linker_args, null, null);
p.WaitForExit ();
string line;
StringWriter error = new StringWriter ();
while ((line = p.StandardError.ReadLine ()) != null)
error.WriteLine (line);
monitor.Log.WriteLine (error.ToString ());
ParseCompilerOutput (error.ToString (), cr);
error.Close ();
p.Close ();
ParseLinkerOutput (error.ToString (), cr);
}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:53,代码来源:GNUCompiler.cs
示例11: Compile
public override BuildResult Compile (
Project project,
ProjectFileCollection projectFiles,
ProjectPackageCollection packages,
CProjectConfiguration configuration,
IProgressMonitor monitor)
{
if (!appsChecked) {
appsChecked = true;
compilerFound = CheckApp (compilerCommand);
linkerFound = CheckApp (linkerCommand);
}
if (!compilerFound) {
BuildResult cres = new BuildResult ();
cres.AddError ("Compiler not found: " + compilerCommand);
return cres;
}
if (!linkerFound) {
BuildResult cres = new BuildResult ();
cres.AddError ("Linker not found: " + linkerCommand);
return cres;
}
CompilerResults cr = new CompilerResults (new TempFileCollection ());
bool success = true;
string compilerArgs = GetCompilerFlags (project, configuration) + " " + GeneratePkgCompilerArgs (packages);
string outputName = Path.Combine (configuration.OutputDirectory,
configuration.CompiledOutputName);
// Precompile header files and place them in .prec/<config_name>/
if (configuration.PrecompileHeaders) {
string precDir = Path.Combine (configuration.SourceDirectory, ".prec");
string precConfigDir = Path.Combine (precDir, configuration.Id);
if (!Directory.Exists (precDir))
Directory.CreateDirectory (precDir);
if (!Directory.Exists (precConfigDir))
Directory.CreateDirectory (precConfigDir);
if (!PrecompileHeaders (projectFiles, configuration, compilerArgs, monitor, cr))
success = false;
} else {
//old headers could interfere with the build
CleanPrecompiledHeaders (configuration);
}
//compile source to object files
monitor.BeginTask (GettextCatalog.GetString ("Compiling source to object files"), 1);
foreach (ProjectFile f in projectFiles) {
if (!success) break;
if (f.Subtype == Subtype.Directory || f.BuildAction != BuildAction.Compile || CProject.IsHeaderFile (f.FilePath))
continue;
if (configuration.UseCcache || NeedsCompiling (f, configuration))
success = DoCompilation (f, configuration, compilerArgs, monitor, cr, configuration.UseCcache);
}
if (success)
monitor.Step (1);
monitor.EndTask ();
if (success) {
switch (configuration.CompileTarget)
{
case CBinding.CompileTarget.Bin:
MakeBin (project, projectFiles, configuration, packages, cr, monitor, outputName);
break;
case CBinding.CompileTarget.StaticLibrary:
MakeStaticLibrary (project, projectFiles, configuration, packages, cr, monitor, outputName);
break;
case CBinding.CompileTarget.SharedLibrary:
MakeSharedLibrary (project, projectFiles, configuration, packages, cr, monitor, outputName);
break;
}
}
return new BuildResult (cr, "");
}
开发者ID:thild,项目名称:monodevelop,代码行数:79,代码来源:GNUCompiler.cs
示例12: CreateConfiguration
public override SolutionItemConfiguration CreateConfiguration (string name)
{
CProjectConfiguration conf = new CProjectConfiguration ();
conf.Name = name;
return conf;
}
开发者ID:telebovich,项目名称:monodevelop,代码行数:8,代码来源:CProject.cs
示例13: CreateExecutionCommand
protected virtual ExecutionCommand CreateExecutionCommand (CProjectConfiguration conf)
{
string app = Path.Combine (conf.OutputDirectory, conf.Output);
NativeExecutionCommand cmd = new NativeExecutionCommand (app);
cmd.Arguments = conf.CommandLineParameters;
cmd.WorkingDirectory = Path.GetFullPath (conf.OutputDirectory);
cmd.EnvironmentVariables = conf.EnvironmentVariables;
return cmd;
}
开发者ID:telebovich,项目名称:monodevelop,代码行数:9,代码来源:CProject.cs
示例14: WriteDeployablePgkPackage
/// <summary>
/// This is the pkg-config package that gets deployed.
/// <returns>The pkg-config package's filename</returns>
/// </summary>
private string WriteDeployablePgkPackage (Project project, CProjectConfiguration config)
{
// FIXME: This should probably be grabed from somewhere.
string prefix = "/usr/local";
string pkgfile = Path.Combine (BaseDirectory, Name + ".pc");
using (StreamWriter writer = new StreamWriter (pkgfile)) {
writer.WriteLine ("prefix={0}", prefix);
writer.WriteLine ("exec_prefix=${prefix}");
writer.WriteLine ("libdir=${exec_prefix}/lib");
writer.WriteLine ("includedir=${prefix}/include");
writer.WriteLine ();
writer.WriteLine ("Name: {0}", Name);
writer.WriteLine ("Description: {0}", Description);
writer.WriteLine ("Version: {0}", Version);
writer.WriteLine ("Requires: {0}", string.Join (" ", Packages.ToStringArray ()));
// TODO: How should I get this?
writer.WriteLine ("Conflicts: {0}", string.Empty);
writer.Write ("Libs: -L${libdir} ");
writer.WriteLine ("-l{0}", config.Output.StartsWith ("lib", StringComparison.OrdinalIgnoreCase)?
config.Output.Substring (3):
config.Output);
writer.Write ("Cflags: -I${includedir}/");
writer.WriteLine ("{0} {1}", Name, Compiler.GetDefineFlags (project, config));
}
return pkgfile;
}
开发者ID:telebovich,项目名称:monodevelop,代码行数:32,代码来源:CProject.cs
示例15: CreateConfiguration
public override IConfiguration CreateConfiguration (string name)
{
CProjectConfiguration conf = new CProjectConfiguration ();
conf.Name = name;
conf.CompilationParameters = new CCompilationParameters ();
return conf;
}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:9,代码来源:CProject.cs
示例16: GetDefineFlags
public override string GetDefineFlags (CProjectConfiguration configuration)
{
string defines = ((CCompilationParameters)configuration.CompilationParameters).DefineSymbols;
return ProcessDefineSymbols (defines);
}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:5,代码来源:GNUCompiler.cs
示例17: MakeStaticLibrary
private void MakeStaticLibrary (Project project,
ProjectFileCollection projectFiles,
CProjectConfiguration configuration,
ProjectPackageCollection packages,
CompilerResults cr,
IProgressMonitor monitor, string outputName)
{
if (!NeedsUpdate (projectFiles, configuration, outputName)) return;
string objectFiles = string.Join (" ", ObjectFiles (projectFiles, configuration, true));
string args = string.Format ("rcs \"{0}\" {1}", outputName, objectFiles);
monitor.BeginTask (GettextCatalog.GetString ("Generating static library {0} from object files", Path.GetFileName (outputName)), 1);
string errorOutput;
int exitCode = ExecuteCommand ("ar", args, Path.GetDirectoryName (outputName), monitor, out errorOutput);
if (exitCode == 0)
monitor.Step (1);
monitor.EndTask ();
ParseCompilerOutput (errorOutput, cr);
ParseLinkerOutput (errorOutput, cr);
CheckReturnCode (exitCode, cr);
}
开发者ID:thild,项目名称:monodevelop,代码行数:24,代码来源:GNUCompiler.cs
示例18: ObjectFiles
/// <summary>
/// Gets the files that get compiled into object code.
/// </summary>
/// <param name="projectFiles">
/// A <see cref="ProjectFileCollection"/>
/// The project's files, extracts from here the files that get compiled into object code.
/// </param>
/// <param name="configuration">
/// A <see cref="CProjectConfiguration"/>
/// The configuration to get the object files for...
/// </param>
/// <param name="withQuotes">
/// A <see cref="System.Boolean"/>
/// If true, it will surround each object file with quotes
/// so that gcc has no problem with paths that contain spaces.
/// </param>
/// <returns>
/// An array of strings, each string is the name of a file
/// that will get compiled into object code. The file name
/// will already have the .o extension.
/// </returns>
private string[] ObjectFiles (ProjectFileCollection projectFiles, CProjectConfiguration configuration, bool withQuotes)
{
if(projectFiles.Count == 0)
return new string[] {};
List<string> objectFiles = new List<string> ();
foreach (ProjectFile f in projectFiles) {
if (f.BuildAction == BuildAction.Compile) {
string PathName = Path.Combine(configuration.OutputDirectory, Path.GetFileNameWithoutExtension(f.Name) + ".o");
if(File.Exists(PathName) == false)
continue;
if (!withQuotes)
objectFiles.Add (PathName);
else
objectFiles.Add ("\"" + PathName + "\"");
}
}
return objectFiles.ToArray ();
}
开发者ID:thild,项目名称:monodevelop,代码行数:44,代码来源:GNUCompiler.cs
示例19: MakeSharedLibrary
private void MakeSharedLibrary(Project project,
ProjectFileCollection projectFiles,
CProjectConfiguration configuration,
ProjectPackageCollection packages,
CompilerResults cr,
IProgressMonitor monitor, string outputName)
{
if (!NeedsUpdate (projectFiles, configuration, outputName)) return;
string objectFiles = string.Join (" ", ObjectFiles (projectFiles, configuration, true));
string pkgargs = GeneratePkgLinkerArgs (packages);
StringBuilder args = new StringBuilder ();
if (configuration.ExtraLinkerArguments != null && configuration.ExtraLinkerArguments.Length > 0) {
string extraLinkerArgs = ExpandBacktickedParameters(configuration.ExtraLinkerArguments.Replace ('\n', ' '));
args.Append (extraLinkerArgs + " ");
}
if (configuration.LibPaths != null)
foreach (string libpath in configuration.LibPaths)
args.Append ("-L\"" + StringParserService.Parse (libpath, GetStringTags (project)) + "\" ");
if (configuration.Libs != null) {
foreach (string lib in configuration.Libs) {
string directory = Path.GetDirectoryName(lib);
string library = Path.GetFileName(lib);
// Is this a 'standard' (as in, uses an orthodox naming convention) library..?
string link_lib = String.Empty;
if(IsStandardLibrary(configuration, directory, library, ref link_lib))
args.Append ("-l\"" + link_lib + "\" ");
// If not, reference the library by it's full pathname.
else
args.Append ("\"" + lib + "\" ");
}
}
string linker_args = string.Format ("-shared -o \"{0}\" {1} {2} {3}",
outputName, pkgargs, objectFiles, args.ToString ());
monitor.BeginTask (GettextCatalog.GetString ("Generating shared object \"{0}\" from object files", Path.GetFileName (outputName)), 1);
string errorOutput;
int exitCode = ExecuteCommand (linkerCommand , linker_args, Path.GetDirectoryName (outputName), monitor, out errorOutput);
if (exitCode == 0)
monitor.Step (1);
monitor.EndTask ();
ParseCompilerOutput (errorOutput, cr);
ParseLinkerOutput (errorOutput, cr);
CheckReturnCode (exitCode, cr);
}
开发者ID:thild,项目名称:monodevelop,代码行数:52,代码来源:GNUCompiler.cs
示例20: CleanPrecompiledHeaders
void CleanPrecompiledHeaders (CProjectConfiguration configuration)
{
if (string.IsNullOrEmpty (configuration.SourceDirectory))
return;
string precDir = Path.Combine (configuration.SourceDirectory, ".prec");
if (Directory.Exists (precDir))
Directory.Delete (precDir, true);
}
开发者ID:thild,项目名称:monodevelop,代码行数:10,代码来源:GNUCompiler.cs
注:本文中的CBinding.CProjectConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论