Finish Mono AOT for iOS with .NET 7
This commit is contained in:
@@ -174,24 +174,36 @@ bool DeployDataStep::Perform(CookingData& data)
|
|||||||
String packFolder = srcDotnet / TEXT("../../../");
|
String packFolder = srcDotnet / TEXT("../../../");
|
||||||
String dstDotnetLibs = dstDotnet, srcDotnetLibs = srcDotnet;
|
String dstDotnetLibs = dstDotnet, srcDotnetLibs = srcDotnet;
|
||||||
StringUtils::PathRemoveRelativeParts(packFolder);
|
StringUtils::PathRemoveRelativeParts(packFolder);
|
||||||
if (usAOT && srcDotnetFromEngine)
|
if (usAOT)
|
||||||
{
|
{
|
||||||
// AOT runtime files inside Engine Platform folder
|
if (srcDotnetFromEngine)
|
||||||
packFolder /= TEXT("Dotnet");
|
{
|
||||||
dstDotnetLibs /= TEXT("lib/net7.0");
|
// AOT runtime files inside Engine Platform folder
|
||||||
srcDotnetLibs = packFolder / TEXT("lib/net7.0");
|
packFolder /= TEXT("Dotnet");
|
||||||
}
|
dstDotnetLibs /= TEXT("lib/net7.0");
|
||||||
else if (srcDotnetFromEngine)
|
srcDotnetLibs = packFolder / TEXT("lib/net7.0");
|
||||||
{
|
}
|
||||||
// Runtime files inside Engine Platform folder
|
else
|
||||||
dstDotnetLibs /= TEXT("lib/net7.0");
|
{
|
||||||
srcDotnetLibs /= TEXT("lib/net7.0");
|
// Runtime files inside Dotnet SDK folder but placed for AOT
|
||||||
|
dstDotnetLibs /= TEXT("lib/net7.0");
|
||||||
|
srcDotnetLibs /= TEXT("../lib/net7.0");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Runtime files inside Dotnet SDK folder
|
if (srcDotnetFromEngine)
|
||||||
dstDotnetLibs /= TEXT("shared/Microsoft.NETCore.App");
|
{
|
||||||
srcDotnetLibs /= TEXT("../lib/net7.0");
|
// Runtime files inside Engine Platform folder
|
||||||
|
dstDotnetLibs /= TEXT("lib/net7.0");
|
||||||
|
srcDotnetLibs /= TEXT("lib/net7.0");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Runtime files inside Dotnet SDK folder
|
||||||
|
dstDotnetLibs /= TEXT("shared/Microsoft.NETCore.App");
|
||||||
|
srcDotnetLibs /= TEXT("../lib/net7.0");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FileSystem::CopyFile(dstDotnet / TEXT("LICENSE.TXT"), packFolder / TEXT("LICENSE.txt"));
|
FileSystem::CopyFile(dstDotnet / TEXT("LICENSE.TXT"), packFolder / TEXT("LICENSE.txt"));
|
||||||
FileSystem::CopyFile(dstDotnet / TEXT("LICENSE.TXT"), packFolder / TEXT("LICENSE.TXT"));
|
FileSystem::CopyFile(dstDotnet / TEXT("LICENSE.TXT"), packFolder / TEXT("LICENSE.TXT"));
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ namespace Flax.Build.Platforms
|
|||||||
var inputFileAsm = inputFile + ".s";
|
var inputFileAsm = inputFile + ".s";
|
||||||
var inputFileObj = inputFile + ".o";
|
var inputFileObj = inputFile + ".o";
|
||||||
var outputFileDylib = options.OutputFiles[0];
|
var outputFileDylib = options.OutputFiles[0];
|
||||||
|
var inputFileFolder = Path.GetDirectoryName(inputFile);
|
||||||
|
|
||||||
// Setup options
|
// Setup options
|
||||||
var monoAotMode = "full";
|
var monoAotMode = "full";
|
||||||
@@ -87,30 +88,35 @@ namespace Flax.Build.Platforms
|
|||||||
if (options.EnableDebugSymbols || options.EnableToolDebug)
|
if (options.EnableDebugSymbols || options.EnableToolDebug)
|
||||||
aotCompilerArgs = "--debug " + aotCompilerArgs;
|
aotCompilerArgs = "--debug " + aotCompilerArgs;
|
||||||
var envVars = new Dictionary<string, string>();
|
var envVars = new Dictionary<string, string>();
|
||||||
envVars["MONO_PATH"] = options.AssembliesPath + ";" + options.ClassLibraryPath;
|
envVars["MONO_PATH"] = options.AssembliesPath + ":" + options.ClassLibraryPath;
|
||||||
if (options.EnableToolDebug)
|
if (options.EnableToolDebug)
|
||||||
{
|
{
|
||||||
envVars["MONO_LOG_LEVEL"] = "debug";
|
envVars["MONO_LOG_LEVEL"] = "debug";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run cross-compiler compiler (outputs assembly code)
|
// Run cross-compiler compiler (outputs assembly code)
|
||||||
int result = Utilities.Run(aotCompilerPath, $"{aotCompilerArgs} \"{inputFile}\"", null, options.PlatformToolsPath, Utilities.RunOptions.AppMustExist | Utilities.RunOptions.ConsoleLogOutput, envVars);
|
int result = Utilities.Run(aotCompilerPath, $"{aotCompilerArgs} \"{inputFile}\"", null, inputFileFolder, Utilities.RunOptions.AppMustExist | Utilities.RunOptions.ConsoleLogOutput, envVars);
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
{
|
{
|
||||||
// Try without optimizations as a fallback
|
// Try without optimizations as a fallback
|
||||||
aotCompilerArgs = aotCompilerArgs.Replace("-O=all", "");
|
aotCompilerArgs = aotCompilerArgs.Replace("-O=all", "");
|
||||||
result = Utilities.Run(aotCompilerPath, $"{aotCompilerArgs} \"{inputFile}\"", null, options.PlatformToolsPath, Utilities.RunOptions.AppMustExist | Utilities.RunOptions.ConsoleLogOutput, envVars);
|
result = Utilities.Run(aotCompilerPath, $"{aotCompilerArgs} \"{inputFile}\"", null, inputFileFolder, Utilities.RunOptions.AppMustExist | Utilities.RunOptions.ConsoleLogOutput, envVars);
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get build args for iOS
|
||||||
|
var clangArgs = new List<string>();
|
||||||
|
AddArgsCommon(null, clangArgs);
|
||||||
|
var clangArgsText = string.Join(" ", clangArgs);
|
||||||
|
|
||||||
// Build object file
|
// Build object file
|
||||||
result = Utilities.Run(clangPath, $"\"{inputFileAsm}\" \"{inputFileObj}\"", null, options.PlatformToolsPath, Utilities.RunOptions.AppMustExist | Utilities.RunOptions.ConsoleLogOutput, envVars);
|
result = Utilities.Run(clangPath, $"\"{inputFileAsm}\" -c -o \"{inputFileObj}\" " + clangArgsText, null, inputFileFolder, Utilities.RunOptions.AppMustExist | Utilities.RunOptions.ConsoleLogOutput, envVars);
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Build dylib file
|
// Build dylib file
|
||||||
result = Utilities.Run(clangPath, $"\"{inputFileObj}\" -dynamiclib -o \"{outputFileDylib}\"", null, options.PlatformToolsPath, Utilities.RunOptions.AppMustExist | Utilities.RunOptions.ConsoleLogOutput, envVars);
|
result = Utilities.Run(clangPath, $"\"{inputFileObj}\" -dynamiclib -fPIC -o \"{outputFileDylib}\" " + clangArgsText, null, inputFileFolder, Utilities.RunOptions.AppMustExist | Utilities.RunOptions.ConsoleLogOutput, envVars);
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user