Skip to content

Commit

Permalink
C#: Enable exporting for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
RedworkDE committed Jun 28, 2023
1 parent 7c456d2 commit f759cc0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion modules/mono/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prior to .NET Core, we supported these: ["windows", "macos", "linuxbsd", "android", "haiku", "web", "ios"]
# Eventually support for each them should be added back (except Haiku if not supported by .NET Core)
supported_platforms = ["windows", "macos", "linuxbsd"]
supported_platforms = ["windows", "macos", "linuxbsd", "android"]


def can_build(env, platform):
Expand Down
16 changes: 10 additions & 6 deletions modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long
if (!DeterminePlatformFromFeatures(features, out string platform))
throw new NotSupportedException("Target platform not supported.");

if (!new[] { OS.Platforms.Windows, OS.Platforms.LinuxBSD, OS.Platforms.MacOS }
if (!new[] { OS.Platforms.Windows, OS.Platforms.LinuxBSD, OS.Platforms.MacOS, OS.Platforms.Android }
.Contains(platform))
{
throw new NotImplementedException("Target platform not yet implemented.");
Expand All @@ -142,15 +142,19 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long
{
archs.Add("x86_64");
}
else if (features.Contains("x86_32"))
if (features.Contains("x86_32"))
{
archs.Add("x86_32");
}
else if (features.Contains("arm64"))
if (features.Contains("arm64"))
{
archs.Add("arm64");
}
else if (features.Contains("universal"))
if (features.Contains("arm32"))
{
archs.Add("arm32");
}
if (features.Contains("universal"))
{
if (platform == OS.Platforms.MacOS)
{
Expand All @@ -159,7 +163,7 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long
}
}

bool embedBuildResults = (bool)GetOption("dotnet/embed_build_outputs");
bool embedBuildResults = (bool)GetOption("dotnet/embed_build_outputs") || features.Contains("android");

foreach (var arch in archs)
{
Expand Down Expand Up @@ -256,7 +260,7 @@ private string DetermineRuntimeIdentifierArch(string arch)
"x86_64" => "x64",
"armeabi-v7a" => "arm",
"arm64-v8a" => "arm64",
"armv7" => "arm",
"arm32" => "arm",
"arm64" => "arm64",
_ => throw new ArgumentOutOfRangeException(nameof(arch), arch, "Unexpected architecture")
};
Expand Down

0 comments on commit f759cc0

Please sign in to comment.