|
@@ -249,55 +249,72 @@ namespace GodotTools.Export
|
|
|
|
|
|
var aotObjFilePaths = new List<string>(assemblies.Count);
|
|
|
|
|
|
- foreach (var assembly in assemblies)
|
|
|
- {
|
|
|
- string assemblyName = assembly.Key;
|
|
|
- string assemblyPath = assembly.Value;
|
|
|
+ string compilerDirPath = Path.Combine(GodotSharpDirs.DataEditorToolsDir, "aot-compilers",
|
|
|
+ $"{OS.Platforms.iOS}-arm64");
|
|
|
+ string crossCompiler = FindCrossCompiler(compilerDirPath);
|
|
|
+
|
|
|
+ string aotCacheDir = Path.Combine(ProjectSettings.GlobalizePath(GodotSharpDirs.ResTempDir),
|
|
|
+ "obj", isDebug ? "ExportDebug" : "ExportRelease", "godot-aot-cache");
|
|
|
+
|
|
|
+ if (!Directory.Exists(aotCacheDir))
|
|
|
+ Directory.CreateDirectory(aotCacheDir);
|
|
|
|
|
|
- string asmFileName = assemblyName + ".dll.S";
|
|
|
- string objFileName = assemblyName + ".dll.o";
|
|
|
+ var aotCache = new AotCache(Path.Combine(aotCacheDir, "cache.json"));
|
|
|
|
|
|
+ try
|
|
|
+ {
|
|
|
+ foreach (var assembly in assemblies)
|
|
|
{
|
|
|
- string asmFilePath = Path.Combine(aotTempDir, asmFileName);
|
|
|
+ string assemblyName = assembly.Key;
|
|
|
+ string assemblyPath = assembly.Value;
|
|
|
|
|
|
- var compilerArgs = GetAotCompilerArgs(OS.Platforms.iOS, isDebug, "arm64", aotOpts, assemblyPath, asmFilePath);
|
|
|
+ string asmFilePath = Path.Combine(aotCacheDir, assemblyName + ".dll.S");
|
|
|
+ string objFilePath = Path.Combine(aotCacheDir, assemblyName + ".dll.o");
|
|
|
|
|
|
- string compilerDirPath = Path.Combine(GodotSharpDirs.DataEditorToolsDir, "aot-compilers", $"{OS.Platforms.iOS}-arm64");
|
|
|
+ aotCache.RunCached(name: assemblyName, input: assemblyPath, output: objFilePath, () =>
|
|
|
+ {
|
|
|
+ Console.WriteLine($"AOT compiler: Compiling '{assemblyName}'...");
|
|
|
|
|
|
- ExecuteCompiler(FindCrossCompiler(compilerDirPath), compilerArgs, bclDir);
|
|
|
+ var compilerArgs = GetAotCompilerArgs(OS.Platforms.iOS, isDebug,
|
|
|
+ "arm64", aotOpts, assemblyPath, asmFilePath);
|
|
|
|
|
|
- // Assembling
|
|
|
- const string iOSPlatformName = "iPhoneOS";
|
|
|
- const string versionMin = "10.0"; // TODO: Turn this hard-coded version into an exporter setting
|
|
|
- string iOSSdkPath = Path.Combine(XcodeHelper.XcodePath,
|
|
|
- $"Contents/Developer/Platforms/{iOSPlatformName}.platform/Developer/SDKs/{iOSPlatformName}.sdk");
|
|
|
+ ExecuteCompiler(crossCompiler, compilerArgs, bclDir);
|
|
|
|
|
|
- string objFilePath = Path.Combine(aotTempDir, objFileName);
|
|
|
+ // Assembling
|
|
|
+ const string iOSPlatformName = "iPhoneOS";
|
|
|
+ const string versionMin = "10.0"; // TODO: Turn this hard-coded version into an exporter setting
|
|
|
+ string iOSSdkPath = Path.Combine(XcodeHelper.XcodePath,
|
|
|
+ $"Contents/Developer/Platforms/{iOSPlatformName}.platform/Developer/SDKs/{iOSPlatformName}.sdk");
|
|
|
|
|
|
- var clangArgs = new List<string>()
|
|
|
- {
|
|
|
- "-isysroot", iOSSdkPath,
|
|
|
- "-Qunused-arguments",
|
|
|
- $"-miphoneos-version-min={versionMin}",
|
|
|
- "-arch", "arm64",
|
|
|
- "-c",
|
|
|
- "-o", objFilePath,
|
|
|
- "-x", "assembler"
|
|
|
- };
|
|
|
+ var clangArgs = new List<string>()
|
|
|
+ {
|
|
|
+ "-isysroot", iOSSdkPath,
|
|
|
+ "-Qunused-arguments",
|
|
|
+ $"-miphoneos-version-min={versionMin}",
|
|
|
+ "-arch", "arm64",
|
|
|
+ "-c",
|
|
|
+ "-o", objFilePath,
|
|
|
+ "-x", "assembler"
|
|
|
+ };
|
|
|
|
|
|
- if (isDebug)
|
|
|
- clangArgs.Add("-DDEBUG");
|
|
|
+ if (isDebug)
|
|
|
+ clangArgs.Add("-DDEBUG");
|
|
|
|
|
|
- clangArgs.Add(asmFilePath);
|
|
|
+ clangArgs.Add(asmFilePath);
|
|
|
|
|
|
- int clangExitCode = OS.ExecuteCommand(XcodeHelper.FindXcodeTool("clang"), clangArgs);
|
|
|
- if (clangExitCode != 0)
|
|
|
- throw new Exception($"Command 'clang' exited with code: {clangExitCode}");
|
|
|
+ int clangExitCode = OS.ExecuteCommand(XcodeHelper.FindXcodeTool("clang"), clangArgs);
|
|
|
+ if (clangExitCode != 0)
|
|
|
+ throw new Exception($"Command 'clang' exited with code: {clangExitCode}");
|
|
|
+ });
|
|
|
|
|
|
aotObjFilePaths.Add(objFilePath);
|
|
|
- }
|
|
|
|
|
|
- aotModuleInfoSymbols.Add($"mono_aot_module_{AssemblyNameToAotSymbol(assemblyName)}_info");
|
|
|
+ aotModuleInfoSymbols.Add($"mono_aot_module_{AssemblyNameToAotSymbol(assemblyName)}_info");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ finally
|
|
|
+ {
|
|
|
+ aotCache.SaveCache();
|
|
|
}
|
|
|
|
|
|
RunAr(aotObjFilePaths, libAotFilePath);
|