...
This commit is contained in:
@@ -14,4 +14,13 @@
|
||||
<ProjectReference Include="..\Syntax\Syntax.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="runtime\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="runtime\libruntime_x64.a" />
|
||||
<EmbeddedResource Include="runtime\libruntime_x64.a" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using CLI;
|
||||
using Generation.QBE;
|
||||
using Syntax;
|
||||
@@ -26,18 +27,13 @@ Directory.CreateDirectory(BIN_INT_DIR);
|
||||
|
||||
var files = new List<string>();
|
||||
|
||||
var compileOnly = false;
|
||||
string? outPath = null;
|
||||
string? runtimePath = null;
|
||||
|
||||
foreach (var arg in args)
|
||||
{
|
||||
if (arg == "-c")
|
||||
if (arg.StartsWith("-r="))
|
||||
{
|
||||
compileOnly = true;
|
||||
}
|
||||
else if (arg.StartsWith("-o="))
|
||||
{
|
||||
outPath = arg.Substring("-o=".Length);
|
||||
runtimePath = arg.Substring("-r=".Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -99,10 +95,25 @@ if (diagnostics.Any(diagnostic => diagnostic.Severity == DiagnosticSeverity.Erro
|
||||
return 1;
|
||||
}
|
||||
|
||||
var objectFiles = new List<string>
|
||||
var objectFiles = new List<string>();
|
||||
|
||||
if (runtimePath == null)
|
||||
{
|
||||
"libruntime.a"
|
||||
};
|
||||
const string RUNTIME_NAME = "libruntime_x64";
|
||||
await using var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(RUNTIME_NAME);
|
||||
if (stream == null)
|
||||
{
|
||||
throw new Exception("Runtime stream is null");
|
||||
}
|
||||
|
||||
var tmpDir = Directory.CreateTempSubdirectory("nub");
|
||||
runtimePath = Path.Combine(tmpDir.FullName, RUNTIME_NAME + ".a");
|
||||
|
||||
await using var writer = new FileStream(runtimePath, FileMode.Create, FileAccess.Write);
|
||||
await stream.CopyToAsync(writer);
|
||||
}
|
||||
|
||||
objectFiles.Add(runtimePath);
|
||||
|
||||
foreach (var boundSyntaxTree in boundSyntaxTrees)
|
||||
{
|
||||
|
||||
BIN
src/compiler/CLI/runtime/libruntime_x64.a
Normal file
BIN
src/compiler/CLI/runtime/libruntime_x64.a
Normal file
Binary file not shown.
Reference in New Issue
Block a user