Abrarul8541 commited on
Commit
a6ae085
·
verified ·
1 Parent(s): c437b91

Build: native llama.cpp via CMake, legacy jniLibs packaging for proot

Browse files
Files changed (1) hide show
  1. app/build.gradle.kts +17 -1
app/build.gradle.kts CHANGED
@@ -8,6 +8,7 @@ plugins {
8
  android {
9
  namespace = "io.github.abrarul.modularai"
10
  compileSdk = 34
 
11
 
12
  defaultConfig {
13
  applicationId = "io.github.abrarul.modularai"
@@ -16,6 +17,16 @@ android {
16
  versionCode = 1
17
  versionName = "0.1.0"
18
  ndk { abiFilters += listOf("arm64-v8a") }
 
 
 
 
 
 
 
 
 
 
19
  }
20
 
21
  buildTypes {
@@ -34,7 +45,11 @@ android {
34
  compose = true
35
  buildConfig = true
36
  }
37
- packaging { resources.excludes += "/META-INF/{AL2.0,LGPL2.1}" }
 
 
 
 
38
  }
39
 
40
  dependencies {
@@ -44,6 +59,7 @@ dependencies {
44
  implementation("androidx.compose.material3:material3")
45
  implementation("androidx.compose.ui:ui")
46
  implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.6")
 
47
  implementation("androidx.biometric:biometric:1.1.0")
48
  implementation("androidx.room:room-runtime:2.6.1")
49
  implementation("androidx.room:room-ktx:2.6.1")
 
8
  android {
9
  namespace = "io.github.abrarul.modularai"
10
  compileSdk = 34
11
+ ndkVersion = "27.0.12077973"
12
 
13
  defaultConfig {
14
  applicationId = "io.github.abrarul.modularai"
 
17
  versionCode = 1
18
  versionName = "0.1.0"
19
  ndk { abiFilters += listOf("arm64-v8a") }
20
+ externalNativeBuild {
21
+ cmake {
22
+ arguments += listOf("-DANDROID_STL=c++_static", "-DCMAKE_BUILD_TYPE=Release")
23
+ cppFlags += listOf("-O3")
24
+ }
25
+ }
26
+ }
27
+
28
+ externalNativeBuild {
29
+ cmake { path = file("src/main/cpp/CMakeLists.txt") }
30
  }
31
 
32
  buildTypes {
 
45
  compose = true
46
  buildConfig = true
47
  }
48
+ packaging {
49
+ resources.excludes += "/META-INF/{AL2.0,LGPL2.1}"
50
+ // proot must exist as real files in nativeLibraryDir to be executable on Android 10+
51
+ jniLibs.useLegacyPackaging = true
52
+ }
53
  }
54
 
55
  dependencies {
 
59
  implementation("androidx.compose.material3:material3")
60
  implementation("androidx.compose.ui:ui")
61
  implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.6")
62
+ implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.6")
63
  implementation("androidx.biometric:biometric:1.1.0")
64
  implementation("androidx.room:room-runtime:2.6.1")
65
  implementation("androidx.room:room-ktx:2.6.1")