apply plugin: 'com.android.application'

def parent = new File(project.buildFile.absolutePath).parent
parent = new File(parent).parent
def sample = new File(parent).getName()

android {
    compileSdkVersion 23
    buildToolsVersion "28.0.3"

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 23

        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a'
        }
    }

    buildTypes {
        debug {
            externalNativeBuild {
                cmake {
                    arguments "-DANDROID_TOOLCHAIN=clang",
                            "-DANDROID_STL=c++_static",
                            "-DPLATFORM=android",
                            "-DANDROID_ARM_MODE=arm",
                            "-DANDROID_CPP_FEATURES=exceptions",
                            "-DFILTER_TARGET=${sample}".toString(),
                            "-DCMAKE_BUILD_TYPE=Debug"

                    targets "${sample}".toString()
                }
            }
            jniDebuggable true
        }
        release {
            externalNativeBuild {
                cmake {
                    arguments "-DANDROID_TOOLCHAIN=clang",
                            "-DANDROID_STL=c++_static",
                            "-DPLATFORM=android",
                            "-DANDROID_ARM_MODE=arm",
                            "-DANDROID_CPP_FEATURES=exceptions",
                            "-DFILTER_TARGET=${sample}".toString(),
                            "-DCMAKE_BUILD_TYPE=RelWithDebInfo"

                    targets "${sample}".toString()
                }
            }
            debuggable true
            signingConfig signingConfigs.debug
            jniDebuggable true
        }
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            resources.srcDirs = ['res']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }

    externalNativeBuild {
        cmake {
            path "../../../CMakeLists.txt"
        }
    }
}

dependencies {
}
