From 3592d483c239f2d9d0736ba215273f88e9c9a45a Mon Sep 17 00:00:00 2001 From: Chris Speciale Date: Fri, 14 Mar 2025 02:16:31 -0400 Subject: [PATCH] Include PLATFORM define for older NDK support 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. --- tools/platforms/AndroidPlatform.hx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/platforms/AndroidPlatform.hx b/tools/platforms/AndroidPlatform.hx index c6f57da7ca..821eed86da 100644 --- a/tools/platforms/AndroidPlatform.hx +++ b/tools/platforms/AndroidPlatform.hx @@ -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,16 @@ 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); }