Skip to content

Commit

Permalink
Define PLATFORM and PLATFORM_NUMBER based on the minimum `Android…
Browse files Browse the repository at this point in the history
…` SDK Version.
  • Loading branch information
MAJigsaw77 authored Aug 16, 2024
1 parent 9cc7a8f commit 88a49a4
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions tools/platforms/AndroidPlatform.hx
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ class AndroidPlatform extends PlatformTarget

for (architecture in architectures)
{
var haxeParams = [hxml, "-D", "android", "-D", "PLATFORM=android-21"];
var cppParams = ["-Dandroid", "-DPLATFORM=android-21"];
var minimumSDKVersion = project.config.getInt("android.minimum-sdk-version", 21);
var haxeParams = [hxml, "-D", "android", "-D", "PLATFORM=android-" + minimumSDKVersion, "-D", "PLATFORM_NUMBER=" + minimumSDKVersion];
var cppParams = ["-Dandroid", "-DPLATFORM=android-" + minimumSDKVersion, "-DPLATFORM_NUMBER=" + minimumSDKVersion];
var path = sourceSet + "/jniLibs/armeabi";
var suffix = ".so";

Expand Down Expand Up @@ -363,21 +364,22 @@ class AndroidPlatform extends PlatformTarget

public override function rebuild():Void
{
var armv5 = (/*command == "rebuild" ||*/
ArrayTools.containsValue(project.architectures, Architecture.ARMV5)
|| ArrayTools.containsValue(project.architectures, Architecture.ARMV6));
var armv5 = ArrayTools.containsValue(project.architectures, Architecture.ARMV5)
|| ArrayTools.containsValue(project.architectures, Architecture.ARMV6);
var armv7 = (command == "rebuild" || ArrayTools.containsValue(project.architectures, Architecture.ARMV7));
var arm64 = (command == "rebuild" || ArrayTools.containsValue(project.architectures, Architecture.ARM64));
var x86 = (command == "rebuild" || ArrayTools.containsValue(project.architectures, Architecture.X86));
var x64 = (/*command == "rebuild" ||*/ ArrayTools.containsValue(project.architectures, Architecture.X64));
var x64 = ArrayTools.containsValue(project.architectures, Architecture.X64);

var commands = [];

if (armv5) commands.push(["-Dandroid", "-DPLATFORM=android-21"]);
if (armv7) commands.push(["-Dandroid", "-DHXCPP_ARMV7", "-DPLATFORM=android-21"]);
if (arm64) commands.push(["-Dandroid", "-DHXCPP_ARM64", "-DPLATFORM=android-21"]);
if (x86) commands.push(["-Dandroid", "-DHXCPP_X86", "-DPLATFORM=android-21"]);
if (x64) commands.push(["-Dandroid", "-DHXCPP_X86_64", "-DPLATFORM=android-21"]);
var minimumSDKVersion = project.config.getInt("android.minimum-sdk-version", 21);

if (armv5) commands.push(["-Dandroid", "-DPLATFORM=android-" + minimumSDKVersion, "-DPLATFORM_NUMBER=" + minimumSDKVersion]);
if (armv7) commands.push(["-Dandroid", "-DHXCPP_ARMV7", "-DPLATFORM=android-" + minimumSDKVersion, "-DPLATFORM_NUMBER=" + minimumSDKVersion]);
if (arm64) commands.push(["-Dandroid", "-DHXCPP_ARM64", "-DPLATFORM=android-" + minimumSDKVersion, "-DPLATFORM_NUMBER=" + minimumSDKVersion]);
if (x86) commands.push(["-Dandroid", "-DHXCPP_X86", "-DPLATFORM=android-" + minimumSDKVersion, "-DPLATFORM_NUMBER=" + minimumSDKVersion]);
if (x64) commands.push(["-Dandroid", "-DHXCPP_X86_64", "-DPLATFORM=android-" + minimumSDKVersion, "-DPLATFORM_NUMBER=" + minimumSDKVersion]);

CPPHelper.rebuild(project, commands);
}
Expand Down

0 comments on commit 88a49a4

Please sign in to comment.