apply plugin: 'com.android.library'

android {
    compileSdkVersion = rootProject.ext.compileApi
    buildToolsVersion = rootProject.ext.toolsVersion
    packagingOptions {
        jniLibs {
            pickFirsts += ['lib/arm64-v8a/libfreerdp3.so', 'lib/armeabi-v7a/libfreerdp3.so', 'lib/x86/libfreerdp3.so', 'lib/x86_64/libfreerdp3.so', 'lib/arm64-v8a/libfreerdp-client3.so', 'lib/armeabi-v7a/libfreerdp-client3.so', 'lib/x86/libfreerdp-client3.so', 'lib/x86_64/libfreerdp-client3.so', 'lib/arm64-v8a/libwinpr3.so', 'lib/armeabi-v7a/libwinpr3.so', 'lib/x86/libwinpr3.so', 'lib/x86_64/libwinpr3.so']
        }
    }


    defaultConfig {
        minSdkVersion rootProject.ext.minApi
        targetSdkVersion rootProject.ext.targetApi
	ndkVersion = "29.0.13113456"

        ndk {
            //noinspection ChromeOsAbiSupport
            abiFilters "arm64-v8a", "armeabi-v7a", "x86_64", "x86"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            externalNativeBuild {
                cmake {
                    arguments "-DWITH_FFMPEG=ON", "-DWITH_OPENH264=ON",
                              "-DWITH_OPUS=ON",   "-DWITH_WEBP=ON", 
                              "-DWITH_JPEG=ON",   "-DWITH_PNG=ON", 
                              "-DWITH_CJSON=ON",  "-DWITH_OPENSSL=ON"

                    abiFilters "arm64-v8a", "armeabi-v7a", "x86_64", "x86"
                }
            }
        }
        debug {
            jniDebuggable true
            externalNativeBuild {
                cmake {
                    arguments "-DWITH_FFMPEG=OFF", "-DWITH_OPENH264=OFF",
                              "-DWITH_OPUS=OFF",   "-DWITH_WEBP=OFF", 
                              "-DWITH_JPEG=OFF",   "-DWITH_PNG=OFF", 
                              "-DWITH_CJSON=OFF",  "-DWITH_OPENSSL=ON"

                    abiFilters "arm64-v8a", "armeabi-v7a", "x86_64", "x86"
                }
            }
        }
        qa {
            jniDebuggable false
            externalNativeBuild {
                cmake {
                    arguments "-DWITH_FFMPEG=ON", "-DWITH_OPENH264=ON",
                              "-DWITH_OPUS=ON",   "-DWITH_WEBP=ON",
                              "-DWITH_JPEG=ON",   "-DWITH_PNG=ON",
                              "-DWITH_CJSON=ON",  "-DWITH_OPENSSL=ON"

                    abiFilters "arm64-v8a"
                }
            }
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildFeatures {
        viewBinding true
    }
    externalNativeBuild {
        cmake {
            path file('src/main/cpp/CMakeLists.txt')
        }
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.7.1'
    implementation 'androidx.core:core:1.18.0'
    implementation 'androidx.preference:preference:1.2.1'
    implementation 'androidx.recyclerview:recyclerview:1.3.2'
    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.8.7'
    implementation 'androidx.lifecycle:lifecycle-livedata:2.8.7'

    implementation "androidx.room:room-runtime:2.8.4"
    annotationProcessor "androidx.room:room-compiler:2.8.4"

    implementation 'net.zetetic:sqlcipher-android:4.15.0@aar'
    implementation 'androidx.sqlite:sqlite:2.6.2'
}
