Include PLATFORM define for older NDK support (#1925)

Hxcpp needs the PLATFORM define for older ndks that require the gcc toolchain. We initially removed it since Lime potentially was going to have a minimum requirement of android sdk 28 due to openal soft version 1.20.1, however, this was solved by upgrading to 1.21.1 which presented no further conflicts with sdk 21. 

To simply things, we just provide both defines for now.

Co-authored-by: player-03 <player3.14@gmail.com>
This commit is contained in:
Chris Speciale
2025-10-03 13:05:09 -04:00
committed by GitHub
parent 80eb17b050
commit 9f2f518857

View File

@@ -162,8 +162,9 @@ class AndroidPlatform extends PlatformTarget
for (architecture in architectures)
{
var minSDKVer = project.config.getInt("android.minimum-sdk-version", 21);
var haxeParams = [hxml, "-D", "android", "-D", 'PLATFORM_NUMBER=$minSDKVer'];
var cppParams = ["-Dandroid", '-DPLATFORM_NUMBER=$minSDKVer'];
//PLATFORM define needed for older ndk and gcc toolchain
var haxeParams = [hxml, "-D", "android", "-D", 'PLATFORM_NUMBER=$minSDKVer', "-D", 'PLATFORM=$minSDKVer'];
var cppParams = ["-Dandroid", '-DPLATFORM_NUMBER=$minSDKVer', '-DPLATFORM=$minSDKVer'];
var path = sourceSet + "/jniLibs/armeabi";
var suffix = ".so";
@@ -374,13 +375,15 @@ class AndroidPlatform extends PlatformTarget
var commands = [];
var minSDKVer = 21;
var platformDefine = '-DPLATFORM_NUMBER=$minSDKVer';
var platformNumberDefine = '-DPLATFORM_NUMBER=$minSDKVer';
// Required for older ndk and gcc toolchain
var platformDefine = '-DPLATFORM=$minSDKVer';
if (armv5) commands.push(["-Dandroid", platformDefine]);
if (armv7) commands.push(["-Dandroid", "-DHXCPP_ARMV7", platformDefine]);
if (arm64) commands.push(["-Dandroid", "-DHXCPP_ARM64", platformDefine]);
if (x86) commands.push(["-Dandroid", "-DHXCPP_X86", platformDefine]);
if (x64) commands.push(["-Dandroid", "-DHXCPP_X86_64", platformDefine]);
if (armv7) commands.push(["-Dandroid", "-DHXCPP_ARMV7", platformDefine, platformNumberDefine]);
if (arm64) commands.push(["-Dandroid", "-DHXCPP_ARM64", platformDefine, platformNumberDefine]);
if (x86) commands.push(["-Dandroid", "-DHXCPP_X86", platformDefine, platformNumberDefine]);
if (x64) commands.push(["-Dandroid", "-DHXCPP_X86_64", platformDefine, platformNumberDefine]);
CPPHelper.rebuild(project, commands);
}