Browse Source

Upgraded to latest Android SDK + NDK + Gradle version (#214)

Jorrit Rouwe 3 years ago
parent
commit
22d675437e

+ 5 - 4
Build/Android/UnitTests/build.gradle

@@ -3,19 +3,20 @@ plugins {
 }
 
 android {
-    compileSdk 31
+    compileSdk 33
+    ndkVersion "25.0.8775105"
 
     defaultConfig {
         applicationId "com.joltphysics.unittests"
         minSdk 24
-        targetSdk 31
+        targetSdk 33
         versionCode 1
         versionName "1.0"
         ndk.abiFilters 'arm64-v8a', 'x86_64'
 
         externalNativeBuild {
             cmake {
-                cppFlags '-std=c++17 -Wall -Werror -DJPH_PROFILE_ENABLED -DJPH_DEBUG_RENDERER'
+                cppFlags '-std=c++17 -Wall -Werror -ffp-contract=off -DJPH_PROFILE_ENABLED -DJPH_DEBUG_RENDERER'
                 arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static'
             }
         }
@@ -35,7 +36,7 @@ android {
     externalNativeBuild {
         cmake {
             path file('src/main/cpp/CMakeLists.txt')
-            version '3.18.1'
+            version '3.22.1'
         }
     }
 

+ 1 - 1
Build/Android/build.gradle

@@ -5,7 +5,7 @@ buildscript {
         mavenCentral()
     }
     dependencies {
-        classpath "com.android.tools.build:gradle:7.0.0"
+        classpath 'com.android.tools.build:gradle:7.2.2'
 
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files

+ 1 - 1
Build/Android/gradle/wrapper/gradle-wrapper.properties

@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
 distributionPath=wrapper/dists
 zipStorePath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME

+ 8 - 8
UnitTests/UnitTestFramework.cpp

@@ -31,7 +31,7 @@ JPH_SUPPRESS_WARNINGS
 
 // Callback for traces
 static void TraceImpl(const char *inFMT, ...)
-{ 
+{
 	// Format the message
 	va_list list;
 	va_start(list, inFMT);
@@ -46,7 +46,7 @@ static void TraceImpl(const char *inFMT, ...)
 
 // Callback for asserts
 static bool AssertFailedImpl(const char *inExpression, const char *inMessage, const char *inFile, uint inLine)
-{ 
+{
 	// Format message
 	char buffer[1024];
 	snprintf(buffer, sizeof(buffer), "%s:%u: (%s) %s", inFile, inLine, inExpression, inMessage != nullptr? inMessage : "");
@@ -122,7 +122,7 @@ int main(int argc, char** argv)
 	// Register physics types
 	RegisterTypes();
 
-	int rv = Context(argc, argv).run(); 
+	int rv = Context(argc, argv).run();
 
 	// Destroy the factory
 	delete Factory::sInstance;
@@ -136,8 +136,8 @@ int main(int argc, char** argv)
 // Reporter that writes logs to the Android log
 struct LogReporter : public ConsoleReporter
 {
-	LogReporter(const ContextOptions &inOptions) : 
-		ConsoleReporter(inOptions, mStream) 
+	LogReporter(const ContextOptions &inOptions) :
+		ConsoleReporter(inOptions, mStream)
 	{
 	}
 
@@ -145,9 +145,9 @@ struct LogReporter : public ConsoleReporter
 	void func(type arg) override								\
 	{															\
 		ConsoleReporter::func(arg);								\
-		const char *str = mStream.str().c_str();				\
-		if (str[0] != 0)										\
-			__android_log_write(ANDROID_LOG_INFO, "Jolt", str);	\
+		string str = mStream.str();								\
+		if (!str.empty())										\
+			__android_log_write(ANDROID_LOG_INFO, "Jolt", str.c_str());	\
 		mStream.str("");										\
 	}