From 6dce7ad79a2508bb9cf9ea2af08e1fadabb60079 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Fri, 5 Apr 2019 18:07:13 -0700 Subject: [PATCH] Progress on newer NDK support (forces minimum API from 14 to 16) --- project/Build.xml | 2 +- project/include/system/System.h | 2 +- project/lib/openal | 2 +- project/lib/pixman | 2 +- project/src/system/CFFI.cpp | 4 ++-- project/src/system/JNI.cpp | 20 ++++++++++++++++++-- project/src/system/System.cpp | 2 +- project/src/text/Font.cpp | 2 +- tools/platforms/AndroidPlatform.hx | 12 ++++++------ 9 files changed, 32 insertions(+), 16 deletions(-) diff --git a/project/Build.xml b/project/Build.xml index 1a07f66b3..aad527a48 100644 --- a/project/Build.xml +++ b/project/Build.xml @@ -1,6 +1,6 @@ - + diff --git a/project/include/system/System.h b/project/include/system/System.h index 62a1063fc..23cfb7bb9 100644 --- a/project/include/system/System.h +++ b/project/include/system/System.h @@ -353,7 +353,7 @@ typedef uint64_t uintmax_t; #endif -#ifdef ANDROID +#if defined(ANDROID) && !defined(HXCPP_CLANG) std::size_t _mbsrtowcs(wchar_t * ws, const char **src, std::size_t wn, std::mbstate_t *st); diff --git a/project/lib/openal b/project/lib/openal index 3f732355f..f7b3962cd 160000 --- a/project/lib/openal +++ b/project/lib/openal @@ -1 +1 @@ -Subproject commit 3f732355f078ea8fd226b70b4ccdb428d6453c0d +Subproject commit f7b3962cdd38728fd81c7fe37d9c7bd1371c2e78 diff --git a/project/lib/pixman b/project/lib/pixman index 9e028b142..979a51f79 160000 --- a/project/lib/pixman +++ b/project/lib/pixman @@ -1 +1 @@ -Subproject commit 9e028b14213fdcf5956645aecbd32c2a653642a6 +Subproject commit 979a51f79af984763d8c1e059eb2e5a4740886e8 diff --git a/project/src/system/CFFI.cpp b/project/src/system/CFFI.cpp index faa0e84bd..d40f50ece 100644 --- a/project/src/system/CFFI.cpp +++ b/project/src/system/CFFI.cpp @@ -50,8 +50,8 @@ HL_API const uchar *hl_field_name( int hash ) { return NULL; } HL_API void hl_error_msg( const uchar *msg, ... ) {} HL_API void hl_assert( void ) {} -HL_API void hl_throw( vdynamic *v ) {} -HL_API void hl_rethrow( vdynamic *v ) {} +HL_API void hl_throw( vdynamic *v ) { throw ""; } +HL_API void hl_rethrow( vdynamic *v ) { throw ""; } HL_API void hl_setup_longjump( void *j ) {} HL_API void hl_setup_exception( void *resolve_symbol, void *capture_stack ) {} HL_API void hl_dump_stack( void ) {} diff --git a/project/src/system/JNI.cpp b/project/src/system/JNI.cpp index 391428f16..51a1e149f 100644 --- a/project/src/system/JNI.cpp +++ b/project/src/system/JNI.cpp @@ -817,6 +817,7 @@ namespace lime { } } + default: break; } @@ -1052,6 +1053,8 @@ namespace lime { out.l = 0; return true; + default: {} + } return false; @@ -1100,6 +1103,7 @@ namespace lime { case jniFloat: out.f = (float)val_number (inValue); return true; case jniDouble: out.d = val_number (inValue); return true; case jniVoid: out.l = 0; return true; + default: {} } @@ -1173,7 +1177,7 @@ namespace lime { bool Ok () const { - return mField > 0; + return mField != 0; } @@ -1231,6 +1235,8 @@ namespace lime { result = alloc_float (env->GetStaticDoubleField (mClass, mField)); break; + default: {} + } } @@ -1301,6 +1307,8 @@ namespace lime { env->SetStaticDoubleField (mClass, mField, setValue.d); break; + default: {} + } } @@ -1363,6 +1371,8 @@ namespace lime { result = alloc_float(env->GetDoubleField (inObject, mField)); break; + default: {} + } } @@ -1433,6 +1443,8 @@ namespace lime { env->SetDoubleField (inObject, mField, setValue.d); break; + default: {} + } } @@ -1706,7 +1718,7 @@ namespace lime { bool Ok () const { - return mMethod > 0; + return mMethod != 0; } @@ -1786,6 +1798,8 @@ namespace lime { result = alloc_float (env->CallStaticDoubleMethodA (mClass, mMethod, jargs)); break; + default: {} + } } @@ -1867,6 +1881,8 @@ namespace lime { result = alloc_float (env->CallDoubleMethodA (inObject, mMethod, jargs)); break; + default: {} + } } diff --git a/project/src/system/System.cpp b/project/src/system/System.cpp index 3b279027c..820a3d4a6 100644 --- a/project/src/system/System.cpp +++ b/project/src/system/System.cpp @@ -250,7 +250,7 @@ long int __fdelt_chk (long int d) { #endif -#ifdef ANDROID +#if defined(ANDROID) && !defined(HXCPP_CLANG) #include #include diff --git a/project/src/text/Font.cpp b/project/src/text/Font.cpp index 2720cd915..8ab0bdd0b 100644 --- a/project/src/text/Font.cpp +++ b/project/src/text/Font.cpp @@ -754,7 +754,7 @@ namespace lime { len = sfnt_name.string_len; family_name = new wchar_t[len + 1]; - #ifdef ANDROID + #if defined(ANDROID) && !defined(HXCPP_CLANG) // Fix some devices (Android 4.x or older) that have a bad stdc implementation _mbsrtowcs (family_name, (const char**)&sfnt_name.string, len, 0); #else diff --git a/tools/platforms/AndroidPlatform.hx b/tools/platforms/AndroidPlatform.hx index a2520c4d1..f964b6c18 100644 --- a/tools/platforms/AndroidPlatform.hx +++ b/tools/platforms/AndroidPlatform.hx @@ -69,8 +69,8 @@ class AndroidPlatform extends PlatformTarget for (architecture in architectures) { - var haxeParams = [hxml, "-D", "android", "-D", "PLATFORM=android-14"]; - var cppParams = ["-Dandroid", "-DPLATFORM=android-14"]; + var haxeParams = [hxml, "-D", "android", "-D", "PLATFORM=android-16"]; + var cppParams = ["-Dandroid", "-DPLATFORM=android-16"]; var path = sourceSet + "/jniLibs/armeabi"; var suffix = ".so"; @@ -249,10 +249,10 @@ class AndroidPlatform extends PlatformTarget var commands = []; - if (armv5) commands.push(["-Dandroid", "-DPLATFORM=android-14"]); - if (armv7) commands.push(["-Dandroid", "-DHXCPP_ARMV7", "-DHXCPP_ARM7", "-DPLATFORM=android-14"]); + if (armv5) commands.push(["-Dandroid", "-DPLATFORM=android-16"]); + if (armv7) commands.push(["-Dandroid", "-DHXCPP_ARMV7", "-DHXCPP_ARM7", "-DPLATFORM=android-16"]); if (arm64) commands.push(["-Dandroid", "-DHXCPP_ARM64", "-DPLATFORM=android-21"]); - if (x86) commands.push(["-Dandroid", "-DHXCPP_X86", "-DPLATFORM=android-14"]); + if (x86) commands.push(["-Dandroid", "-DHXCPP_X86", "-DPLATFORM=android-16"]); CPPHelper.rebuild(project, commands); } @@ -339,7 +339,7 @@ class AndroidPlatform extends PlatformTarget context.CPP_DIR = targetDirectory + "/obj"; context.OUTPUT_DIR = targetDirectory; context.ANDROID_INSTALL_LOCATION = project.config.getString("android.install-location", "auto"); - context.ANDROID_MINIMUM_SDK_VERSION = project.config.getInt("android.minimum-sdk-version", 14); + context.ANDROID_MINIMUM_SDK_VERSION = project.config.getInt("android.minimum-sdk-version", 16); context.ANDROID_TARGET_SDK_VERSION = project.config.getInt("android.target-sdk-version", 26); context.ANDROID_EXTENSIONS = project.config.getArrayString("android.extension"); context.ANDROID_PERMISSIONS = project.config.getArrayString("android.permission", [