You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Add linux-bionic RID Export Option
Adds an export option to enable the linux-bionic RID so Android can export with NativeAOT enabled.
This commit is contained in:
@@ -37,8 +37,28 @@ namespace GodotTools.Export
|
|||||||
|
|
||||||
public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetExportOptions(EditorExportPlatform platform)
|
public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetExportOptions(EditorExportPlatform platform)
|
||||||
{
|
{
|
||||||
return new Godot.Collections.Array<Godot.Collections.Dictionary>()
|
var exportOptionList = new Godot.Collections.Array<Godot.Collections.Dictionary>();
|
||||||
|
|
||||||
|
if (platform.GetOsName().Equals(OS.Platforms.Android, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
exportOptionList.Add
|
||||||
|
(
|
||||||
|
new Godot.Collections.Dictionary()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
"option", new Godot.Collections.Dictionary()
|
||||||
|
{
|
||||||
|
{ "name", "dotnet/android_use_linux_bionic" },
|
||||||
|
{ "type", (int)Variant.Type.Bool }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ "default_value", false }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
exportOptionList.Add
|
||||||
|
(
|
||||||
new Godot.Collections.Dictionary()
|
new Godot.Collections.Dictionary()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -49,7 +69,10 @@ namespace GodotTools.Export
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ "default_value", false }
|
{ "default_value", false }
|
||||||
},
|
}
|
||||||
|
);
|
||||||
|
exportOptionList.Add
|
||||||
|
(
|
||||||
new Godot.Collections.Dictionary()
|
new Godot.Collections.Dictionary()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -60,7 +83,10 @@ namespace GodotTools.Export
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ "default_value", true }
|
{ "default_value", true }
|
||||||
},
|
}
|
||||||
|
);
|
||||||
|
exportOptionList.Add
|
||||||
|
(
|
||||||
new Godot.Collections.Dictionary()
|
new Godot.Collections.Dictionary()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -72,7 +98,8 @@ namespace GodotTools.Export
|
|||||||
},
|
},
|
||||||
{ "default_value", false }
|
{ "default_value", false }
|
||||||
}
|
}
|
||||||
};
|
);
|
||||||
|
return exportOptionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddExceptionMessage(EditorExportPlatform platform, Exception exception)
|
private void AddExceptionMessage(EditorExportPlatform platform, Exception exception)
|
||||||
@@ -158,11 +185,12 @@ namespace GodotTools.Export
|
|||||||
throw new NotImplementedException("Target platform not yet implemented.");
|
throw new NotImplementedException("Target platform not yet implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool useAndroidLinuxBionic = (bool)GetOption("dotnet/android_use_linux_bionic");
|
||||||
PublishConfig publishConfig = new()
|
PublishConfig publishConfig = new()
|
||||||
{
|
{
|
||||||
BuildConfig = isDebug ? "ExportDebug" : "ExportRelease",
|
BuildConfig = isDebug ? "ExportDebug" : "ExportRelease",
|
||||||
IncludeDebugSymbols = (bool)GetOption("dotnet/include_debug_symbols"),
|
IncludeDebugSymbols = (bool)GetOption("dotnet/include_debug_symbols"),
|
||||||
RidOS = DetermineRuntimeIdentifierOS(platform),
|
RidOS = DetermineRuntimeIdentifierOS(platform, useAndroidLinuxBionic),
|
||||||
Archs = new List<string>(),
|
Archs = new List<string>(),
|
||||||
UseTempDir = platform != OS.Platforms.iOS, // xcode project links directly to files in the publish dir, so use one that sticks around.
|
UseTempDir = platform != OS.Platforms.iOS, // xcode project links directly to files in the publish dir, so use one that sticks around.
|
||||||
BundleOutputs = true,
|
BundleOutputs = true,
|
||||||
@@ -335,6 +363,14 @@ namespace GodotTools.Export
|
|||||||
|
|
||||||
if (IsSharedObject(fileName))
|
if (IsSharedObject(fileName))
|
||||||
{
|
{
|
||||||
|
if (fileName.EndsWith(".so") && !fileName.StartsWith("lib"))
|
||||||
|
{
|
||||||
|
// Add 'lib' prefix required for all native libraries in Android.
|
||||||
|
string newPath = string.Concat(path.AsSpan(0, path.Length - fileName.Length), "lib", fileName);
|
||||||
|
Godot.DirAccess.RenameAbsolute(path, newPath);
|
||||||
|
path = newPath;
|
||||||
|
}
|
||||||
|
|
||||||
AddSharedObject(path, tags: new string[] { arch },
|
AddSharedObject(path, tags: new string[] { arch },
|
||||||
Path.Join(projectDataDirName,
|
Path.Join(projectDataDirName,
|
||||||
Path.GetRelativePath(publishOutputDir,
|
Path.GetRelativePath(publishOutputDir,
|
||||||
@@ -450,8 +486,14 @@ namespace GodotTools.Export
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string DetermineRuntimeIdentifierOS(string platform)
|
private string DetermineRuntimeIdentifierOS(string platform, bool useAndroidLinuxBionic)
|
||||||
=> OS.DotNetOSPlatformMap[platform];
|
{
|
||||||
|
if (platform == OS.Platforms.Android && useAndroidLinuxBionic)
|
||||||
|
{
|
||||||
|
return OS.DotNetOS.LinuxBionic;
|
||||||
|
}
|
||||||
|
return OS.DotNetOSPlatformMap[platform];
|
||||||
|
}
|
||||||
|
|
||||||
private string DetermineRuntimeIdentifierArch(string arch)
|
private string DetermineRuntimeIdentifierArch(string arch)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ namespace GodotTools.Utils
|
|||||||
public const string Linux = "linux";
|
public const string Linux = "linux";
|
||||||
public const string Win10 = "win10";
|
public const string Win10 = "win10";
|
||||||
public const string Android = "android";
|
public const string Android = "android";
|
||||||
|
public const string LinuxBionic = "linux-bionic";
|
||||||
public const string iOS = "ios";
|
public const string iOS = "ios";
|
||||||
public const string iOSSimulator = "iossimulator";
|
public const string iOSSimulator = "iossimulator";
|
||||||
public const string Browser = "browser";
|
public const string Browser = "browser";
|
||||||
@@ -99,7 +100,6 @@ namespace GodotTools.Utils
|
|||||||
[Platforms.iOS] = DotNetOS.iOS,
|
[Platforms.iOS] = DotNetOS.iOS,
|
||||||
[Platforms.Web] = DotNetOS.Browser
|
[Platforms.Web] = DotNetOS.Browser
|
||||||
};
|
};
|
||||||
|
|
||||||
private static bool IsOS(string name)
|
private static bool IsOS(string name)
|
||||||
{
|
{
|
||||||
Internal.godot_icall_Utils_OS_GetPlatformName(out godot_string dest);
|
Internal.godot_icall_Utils_OS_GetPlatformName(out godot_string dest);
|
||||||
|
|||||||
@@ -416,6 +416,8 @@ godot_plugins_initialize_fn try_load_native_aot_library(void *&r_aot_dll_handle)
|
|||||||
String native_aot_so_path = GodotSharpDirs::get_api_assemblies_dir().path_join(assembly_name + ".dll");
|
String native_aot_so_path = GodotSharpDirs::get_api_assemblies_dir().path_join(assembly_name + ".dll");
|
||||||
#elif defined(MACOS_ENABLED) || defined(IOS_ENABLED)
|
#elif defined(MACOS_ENABLED) || defined(IOS_ENABLED)
|
||||||
String native_aot_so_path = GodotSharpDirs::get_api_assemblies_dir().path_join(assembly_name + ".dylib");
|
String native_aot_so_path = GodotSharpDirs::get_api_assemblies_dir().path_join(assembly_name + ".dylib");
|
||||||
|
#elif defined(ANDROID_ENABLED)
|
||||||
|
String native_aot_so_path = "lib" + assembly_name + ".so";
|
||||||
#elif defined(UNIX_ENABLED)
|
#elif defined(UNIX_ENABLED)
|
||||||
String native_aot_so_path = GodotSharpDirs::get_api_assemblies_dir().path_join(assembly_name + ".so");
|
String native_aot_so_path = GodotSharpDirs::get_api_assemblies_dir().path_join(assembly_name + ".so");
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -2058,6 +2058,9 @@ bool EditorExportPlatformAndroid::get_export_option_visibility(const EditorExpor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p_option == "dotnet/android_use_linux_bionic") {
|
||||||
|
return advanced_options_enabled;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user