private void Compile(String directory, String sourceFile, String objectFile, String nativeOptions)
{
// Build the command line
StringBuilder builder = new StringBuilder();
builder.AppendFormat(" -Os -gdwarf-2 {0} -I\"{1}\" ", nativeOptions, directory);
builder.AppendFormat(" -c \"{0}\" -o \"{1}\" ", sourceFile, objectFile);
builder.AppendFormat(" {0} ", this.NativeCFLAGS ?? String.Empty);
if (this.UseReceigen) {
builder.AppendFormat(" -DRECEIGEN ");
}
// Add the pkg-config flags for Mono
String monoLibrary = this.UseSGEN ? "monosgen-2" : "mono-2";
using (ProcessHelper helper = new ProcessHelper("pkg-config", String.Format("{0} {1}", "--cflags", monoLibrary)))
{
helper.Logger = this.Logger;
String result = helper.ExecuteAndReturnOutput ();
result = result.Replace("\n", String.Empty);
builder.Append(result);
}
// TODO: I18N
this.Logger.LogInfo("Compiling...");
this.Logger.LogDebug(String.Format("Arguments: '{0}'", builder.ToString()));
using (ProcessHelper helper = new ProcessHelper(this.NativeCompiler, builder.ToString()))
{
helper.Logger = this.Logger;
helper.Execute();
}
}