File size: 2,170 Bytes
613af8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
plugins {
    id 'com.android.library'
    id 'org.jetbrains.kotlin.android'
}

android {
    namespace 'com.whispercpp'
    compileSdk 34

    defaultConfig {
        minSdk 26
        targetSdk 34
        versionCode 1
        versionName "1.0"

        ndk {
            abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
        }
        externalNativeBuild {
            cmake {
                // When set, builds whisper.android against the version located
                // at GGML_HOME instead of the copy bundled with whisper.cpp.
                if (
                    project.hasProperty('GGML_HOME') &&
                    project.findProperty('GGML_CLBLAST') == 'ON'
                ) {
                    // Turning on CLBlast requires GGML_HOME
                    arguments "-DGGML_HOME=${project.property('GGML_HOME')}",
                         "-DGGML_CLBLAST=ON",
                         "-DOPENCL_LIB=${project.property('OPENCL_LIB')}",
                         "-DCLBLAST_HOME=${project.property('CLBLAST_HOME')}",
                         "-DOPENCL_ROOT=${project.property('OPENCL_ROOT')}",
                         "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH",
                         "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH"
                } else if (project.hasProperty('GGML_HOME')) {
                    arguments "-DGGML_HOME=${project.property('GGML_HOME')}"
                }

            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }

    ndkVersion "25.2.9519653"
    externalNativeBuild {
        cmake {
            path = file("src/main/jni/whisper/CMakeLists.txt")
        }
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {
    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.8.0'
}