apply plugin: 'com.android.library'

android {
    compileSdkVersion 34
    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
    signingConfigs {
        protokitSigning {
            storeFile     file("${System.properties['user.home']}${File.separator}.android${File.separator}debug.keystore")
            storePassword "android"
            keyAlias      "androiddebugkey"
            keyPassword   "android"
            storeType     "jks"
        }
    }

    defaultConfig {
        externalNativeBuild {
            cmake {
                arguments "-DANDROID_TOOLCHAIN=clang", "-DANDROID_PLATFORM=android-24", "-DANDROID_STL=c++_static", "-DANDROID_CPP_FEATURES=exceptions rtti", "-DANDROID_ARM_MODE=arm", "-DANDROID_ARM_NEON=TRUE"
                cFlags "-fsigned-char"
                cppFlags "-fsigned-char", "-std=c++14"
            }
        }
    }

    buildTypes {
         debug {
             initWith debug
             debuggable    true
             jniDebuggable true
             signingConfig signingConfigs.protokitSigning
         }
         release {
             initWith release
             debuggable    false
             jniDebuggable false
             signingConfig signingConfigs.protokitSigning
         }
    }

    flavorDimensions "default"
    productFlavors {
        debug_ {
            ndk {
                abiFilters "armeabi-v7a", "x86"
            }
            externalNativeBuild {
                cmake {
                    targets "protokit"
                    arguments "-DBUILD_CONFIGURATION=DEBUG", "-DCMAKE_CXX_FLAGS_DEBUG=-O0", "-DCMAKE_C_FLAGS_DEBUG=-O0"
                }
            }

            dimension "default"
       }
        release_ {
            externalNativeBuild {
                cmake {
                    targets "protokit"
                    arguments "-DBUILD_CONFIGURATION=RELEASE", "-DCMAKE_CXX_FLAGS_RELEASE=-O3", "-DCMAKE_C_FLAGS_RELEASE=-O3"
                }
            }

            dimension "default"
       }
    }

    variantFilter { variant ->
        def names = variant.flavors*.name
        if (names.contains ("debug_")
              && variant.buildType.name != "debug") {
            setIgnore(true)
        }
        if (names.contains ("release_")
              && variant.buildType.name != "release") {
            setIgnore(true)
        }
    }

repositories {
}

dependencies {
}


}

