diff --git a/src/KenjinxAndroid/app/build.gradle b/src/KenjinxAndroid/app/build.gradle index 377422b15..3a010f105 100644 --- a/src/KenjinxAndroid/app/build.gradle +++ b/src/KenjinxAndroid/app/build.gradle @@ -4,21 +4,17 @@ plugins { } android { - namespace 'org.kenjinx.android' + namespace = 'org.kenjinx.android' compileSdk 36 defaultConfig { applicationId "org.kenjinx.android" minSdk 29 - //noinspection EditedTargetSdkVersion targetSdk 36 versionCode 20005 versionName '2.0.5' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - vectorDrawables { - useSupportLibrary true - } ndk { //noinspection ChromeOsAbiSupport @@ -27,10 +23,11 @@ android { externalNativeBuild { cmake { - cppFlags "-std=c++17 -O3 -ffast-math -march=armv8-a -funroll-loops" + cppFlags "-std=c++20 -O3 -fno-math-errno -fno-trapping-math -fno-signed-zeros -ffinite-math-only -march=armv8-a" arguments "-DANDROID_STL=c++_shared", "-DCMAKE_BUILD_TYPE=Release", - "-DANDROID_ARM_NEON=TRUE" + "-DANDROID_ARM_NEON=TRUE", + "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON" } } } @@ -39,25 +36,29 @@ android { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.debug + signingConfig = signingConfigs.debug debuggable false jniDebuggable false } } + androidComponents { onVariants(selector().withBuildType("release")) { packaging.dex.useLegacyPackaging.set(true) } } + compileOptions { sourceCompatibility JavaVersion.VERSION_21 targetCompatibility JavaVersion.VERSION_21 } + buildFeatures { - compose true - prefab true - buildConfig true + compose = true + prefab = true + buildConfig = true } + packagingOptions { jniLibs { keepDebugSymbols += '**/libkenjinx.so' @@ -67,9 +68,11 @@ android { excludes += '/META-INF/{AL2.0,LGPL2.1}' } } + externalNativeBuild { cmake { path file('src/main/cpp/CMakeLists.txt') + version = '4.2.3' } } @@ -112,7 +115,7 @@ dependencies { implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2' implementation platform('androidx.compose:compose-bom:2026.01.01') - implementation platform('org.jetbrains.kotlin:kotlin-bom:1.9.25') + implementation platform('org.jetbrains.kotlin:kotlin-bom:2.3.0') androidTestImplementation 'androidx.compose.ui:ui-test-junit4' androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0' androidTestImplementation 'androidx.test.ext:junit:1.3.0' diff --git a/src/KenjinxAndroid/app/src/main/cpp/CMakeLists.txt b/src/KenjinxAndroid/app/src/main/cpp/CMakeLists.txt index de3ed1543..e1212dafe 100644 --- a/src/KenjinxAndroid/app/src/main/cpp/CMakeLists.txt +++ b/src/KenjinxAndroid/app/src/main/cpp/CMakeLists.txt @@ -5,7 +5,7 @@ include(FetchContent) # Sets the minimum version of CMake required to build the native library. -cmake_minimum_required(VERSION 3.22.1) +cmake_minimum_required(VERSION 3.31.5) # Declares and names the project. @@ -17,7 +17,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE) FetchContent_Declare( adrenotools GIT_REPOSITORY https://github.com/bylaws/libadrenotools.git - GIT_TAG deec5f75ee1a8ccbe32c8780b1d17284fc87b0f1 # v1.0-14-gdeec5f7 + GIT_TAG 8fae8ce254dfc1344527e05301e43f37dea2df80 ) FetchContent_MakeAvailable(adrenotools) @@ -71,11 +71,10 @@ cmake_path(ABSOLUTE_PATH JNI_PATH NORMALIZE) cmake_path(APPEND JNI_PATH libcrypto.so OUTPUT_VARIABLE LIBCRYPTO_JNI_PATH) cmake_path(APPEND JNI_PATH libssl.so OUTPUT_VARIABLE LIBSSL_JNI_PATH) - # Add OpenAL add_subdirectory(libraries/openal) set_target_properties(OpenAL PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${JNI_PATH} ARCHIVE_OUTPUT_DIRECTORY ${JNI_PATH} RUNTIME_OUTPUT_DIRECTORY ${JNI_PATH} -) \ No newline at end of file +) diff --git a/src/KenjinxAndroid/app/src/main/cpp/kenjinx.cpp b/src/KenjinxAndroid/app/src/main/cpp/kenjinx.cpp index 7b0d2b607..dc1e20519 100644 --- a/src/KenjinxAndroid/app/src/main/cpp/kenjinx.cpp +++ b/src/KenjinxAndroid/app/src/main/cpp/kenjinx.cpp @@ -32,7 +32,7 @@ Java_org_kenjinx_android_NativeHelpers_getNativeWindow( jobject instance, jobject surface) { auto nativeWindow = ANativeWindow_fromSurface(env, surface); - return nativeWindow == NULL ? -1 : (jlong) nativeWindow; + return nativeWindow == nullptr ? -1 : (jlong) nativeWindow; } JNIEXPORT void JNICALL @@ -42,7 +42,7 @@ Java_org_kenjinx_android_NativeHelpers_releaseNativeWindow( jlong window) { auto nativeWindow = (ANativeWindow *) window; - if (nativeWindow != NULL) + if (nativeWindow != nullptr) ANativeWindow_release(nativeWindow); } @@ -75,7 +75,7 @@ Java_org_kenjinx_android_NativeHelpers_getCreateSurfacePtr( char *getStringPointer( JNIEnv *env, jstring jS) { - const char *cparam = env->GetStringUTFChars(jS, 0); + const char *cparam = env->GetStringUTFChars(jS, nullptr); auto len = env->GetStringUTFLength(jS); char *s = new char[len + 1]; //null terminator strcpy(s, cparam); diff --git a/src/KenjinxAndroid/app/src/main/cpp/kenjinx.h b/src/KenjinxAndroid/app/src/main/cpp/kenjinx.h index c75a9f8a0..83776591e 100644 --- a/src/KenjinxAndroid/app/src/main/cpp/kenjinx.h +++ b/src/KenjinxAndroid/app/src/main/cpp/kenjinx.h @@ -6,12 +6,12 @@ #define KENJINXNATIVE_KENJINX_H #include +#include +#include #include #include #include #include -#include -#include #include #include diff --git a/src/KenjinxAndroid/settings.gradle b/src/KenjinxAndroid/settings.gradle index a8ee69c2d..ab7653356 100644 --- a/src/KenjinxAndroid/settings.gradle +++ b/src/KenjinxAndroid/settings.gradle @@ -3,8 +3,8 @@ pluginManagement { google() mavenCentral() gradlePluginPortal() - maven { url 'https://jitpack.io' } - maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" } + maven { url = 'https://jitpack.io' } + maven { url = "https://maven.pkg.jetbrains.space/public/p/compose/dev" } } } dependencyResolutionManagement { @@ -12,8 +12,8 @@ dependencyResolutionManagement { repositories { google() mavenCentral() - maven { url 'https://jitpack.io' } - maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" } + maven { url = 'https://jitpack.io' } + maven { url = "https://maven.pkg.jetbrains.space/public/p/compose/dev" } } } rootProject.name = "KenjinxAndroid"