Linux CPP Mode Working.
This commit is contained in:
parent
1952e6d972
commit
fd471025dc
5 changed files with 116 additions and 119 deletions
|
@ -46,7 +46,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
|
|||
}
|
||||
else if (config.OS == OSMode.Linux)
|
||||
{
|
||||
throw new NotImplementedException("Linux Cpp not yet supported.");
|
||||
stepList.Add(new LinuxCppCompileStep(config));
|
||||
}
|
||||
else if (config.OS == OSMode.Mac)
|
||||
{
|
||||
|
|
|
@ -10,29 +10,27 @@ using Microsoft.DotNet.Tools.Common;
|
|||
|
||||
namespace Microsoft.DotNet.Tools.Compiler.Native
|
||||
{
|
||||
public class LinuxCppCompiler : IPlatformNativeStep
|
||||
public class LinuxCppCompileStep : IPlatformNativeStep
|
||||
{
|
||||
private readonly string CompilerName = "clang-3.5";
|
||||
private readonly string InputExtension = ".cpp";
|
||||
|
||||
private readonly string CompilerOutputExtension = ".a";
|
||||
|
||||
// TODO: debug/release support
|
||||
private readonly string cLibsFlags = "-lm -ldl";
|
||||
private readonly string cflags = "-g -lstdc++ -lrt -Wno-invalid-offsetof -pthread";
|
||||
|
||||
private readonly string[] libs = new string[]
|
||||
{
|
||||
"System.Native.so",
|
||||
"libPortableRuntime.a",
|
||||
"libbootstrappercpp.a",
|
||||
"libPortableRuntime.a",
|
||||
"libSystem.Private.CoreLib.Native.a",
|
||||
"System.Native.so"
|
||||
};
|
||||
|
||||
|
||||
private string CompilerArgStr { get; set; }
|
||||
|
||||
public LinuxCppCompiler(NativeCompileSettings config)
|
||||
public LinuxCppCompileStep(NativeCompileSettings config)
|
||||
{
|
||||
InitializeArgs(config);
|
||||
}
|
||||
|
@ -68,13 +66,15 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
|
|||
argsList.Add("-I");
|
||||
argsList.Add(Path.Combine(config.AppDepSDKPath, "CPPSdk"));
|
||||
|
||||
// Add Stubs
|
||||
argsList.Add(Path.Combine(config.AppDepSDKPath, "CPPSdk/ubuntu.14.04/lxstubs.cpp"));
|
||||
|
||||
// Input File
|
||||
var inCppFile = DetermineInFile(config);
|
||||
argsList.Add(inCppFile);
|
||||
|
||||
// Add Stubs
|
||||
argsList.Add(Path.Combine(config.AppDepSDKPath, "CPPSdk/ubuntu.14.04/lxstubs.cpp"));
|
||||
|
||||
|
||||
// Libs
|
||||
foreach (var lib in libs)
|
||||
{
|
||||
|
@ -115,15 +115,13 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
|
|||
|
||||
public string DetermineOutputFile(NativeCompileSettings config)
|
||||
{
|
||||
var inputFile = DetermineInFile(config);
|
||||
var intermediateDirectory = config.OutputDirectory;
|
||||
|
||||
return inputFile + CompilerOutputExtension;
|
||||
}
|
||||
var filename = Path.GetFileNameWithoutExtension(config.InputManagedAssemblyPath);
|
||||
|
||||
public bool RequiresLinkStep()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var outfile = Path.Combine(intermediateDirectory, filename);
|
||||
|
||||
return outfile;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,7 +24,6 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
|
|||
{
|
||||
"libbootstrapper.a",
|
||||
"libRuntime.a",
|
||||
"libPortableRuntime.a",
|
||||
"libSystem.Private.CoreLib.Native.a",
|
||||
"System.Native.so"
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
|
|||
//TODO support x86
|
||||
private readonly string CompilerName = "cl.exe";
|
||||
|
||||
private readonly string VSBin = "..\\..\\VC\\bin\\x86_amd64";
|
||||
private readonly string VSBin = "..\\..\\VC\\bin\\amd64";
|
||||
private readonly string InputExtension = ".cpp";
|
||||
|
||||
private readonly string CompilerOutputExtension = ".obj";
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
|
|||
{
|
||||
private readonly string LinkerName = "link.exe";
|
||||
private readonly string LinkerOutputExtension = ".exe";
|
||||
private readonly string VSBin = "..\\..\\VC\\bin\\x86_amd64";
|
||||
private readonly string VSBin = "..\\..\\VC\\bin\\amd64";
|
||||
|
||||
private readonly string InputExtension = ".obj";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue