本文整理汇总了C#中CBinding.CProjectConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# CProjectConfiguration类的具体用法?C# CProjectConfiguration怎么用?C# CProjectConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CProjectConfiguration类属于CBinding命名空间,在下文中一共展示了CProjectConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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, "");
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 ();
}
示例8: Compile
public abstract BuildResult Compile (
Project project,
ProjectFileCollection projectFiles,
ProjectPackageCollection packages,
CProjectConfiguration configuration,
IProgressMonitor monitor);
示例9: GetCompilerFlags
public abstract string GetCompilerFlags (Project project, CProjectConfiguration configuration);
示例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);
}
示例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, "");
}
示例12: CreateConfiguration
public override SolutionItemConfiguration CreateConfiguration (string name)
{
CProjectConfiguration conf = new CProjectConfiguration ();
conf.Name = name;
return conf;
}
示例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;
}
示例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;
}
示例15: CreateConfiguration
public override IConfiguration CreateConfiguration (string name)
{
CProjectConfiguration conf = new CProjectConfiguration ();
conf.Name = name;
conf.CompilationParameters = new CCompilationParameters ();
return conf;
}