apply plugin: 'com.android.library'

def vispVersionName = "@VISP_VERSION@"
def vispVersionCode = ((@VISP_VERSION_MAJOR@ * 100 + @VISP_VERSION_MINOR@) * 100 + @VISP_VERSION_PATCH@) * 10 + 0

android {
    compileSdkVersion @ANDROID_COMPILE_SDK_VERSION@

    defaultConfig {
        minSdkVersion @ANDROID_MIN_SDK_VERSION@
        targetSdkVersion @ANDROID_TARGET_SDK_VERSION@

        versionCode vispVersionCode
        versionName vispVersionName

        externalNativeBuild {
            cmake {
                arguments "-DANDROID_STL=@ANDROID_STL@"
                targets "visp_jni_shared"
            }
        }
    }

    buildTypes {
        debug {
            packagingOptions {
                doNotStrip '**/*.so'  // controlled by ViSP CMake scripts
            }
        }
        release {
            packagingOptions {
                doNotStrip '**/*.so'  // controlled by ViSP CMake scripts
            }
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    sourceSets {
        main {
            jniLibs.srcDirs = ['../../jni']
            java.srcDirs = ['src']  // TODO Use original files instead of copied into build directory
            aidl.srcDirs = ['src']
            res.srcDirs = ['@VISP_SOURCE_DIR@/modules/java/android_sdk/android_gradle_lib/res']
            manifest.srcFile 'AndroidManifest.xml'
        }
    }

    externalNativeBuild {
        cmake {
            path (project.projectDir.toString() + '/libcxx_helper/CMakeLists.txt')
        }
    }
}

dependencies {
}
