apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    ndkVersion '21.2.6472646'

    defaultConfig {
        applicationId "com.ethicalml.kompute"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode = 1
        versionName = "0.0.1"
        externalNativeBuild {
            cmake {
                abiFilters "armeabi-v7a", 'arm64-v8a', 'x86', 'x86_64'
                arguments '-DANDROID_TOOLCHAIN=clang',
                        '-DANDROID_STL=c++_static',
                        '-DKOMPUTE_OPT_ANDROID_BUILD=1',
                        '-DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1',
                        '-DKOMPUTE_OPT_INSTALL=0',
                        '-DKOMPUTE_OPT_ENABLE_SPDLOG=0',
                        '-DKOMPUTE_OPT_BUILD_SINGLE_HEADER=0',
                        '-DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=1',
                        '-DKOMPUTE_EXTRA_CXX_FLAGS=-DKOMPUTE_VK_API_MINOR_VERSION=0'
            }
        }
    }

    buildFeatures {
        viewBinding true
    }
    buildTypes {
        release {
             minifyEnabled = false
             proguardFiles getDefaultProguardFile('proguard-android.txt'),
                     'proguard-rules.pro'
        }
     }
    externalNativeBuild {
        cmake {
            path 'src/main/cpp/CMakeLists.txt'
        }
    }

    flavorDimensions 'cpuArch'
    productFlavors {
        arm8 {
            dimension 'cpuArch'
            ndk {
                abiFilters 'arm64-v8a', 'armeabi-v7a'
            }
        }
        x86_64 {
            dimension 'cpuArch'
            ndk {
                abiFilters 'x86_64', 'x86'
            }
        }
        universal {
            dimension 'cpuArch'
            // include all default ABIs. with NDK-r16,  it is:
            //   armeabi-v7a, arm64-v8a, x86, x86_64
        }
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
