// This file is part of ViSP project.

//
// Notes about integration ViSP into existed Android Studio application project are below (application 'app' module should exist).
//
// This file is located in <ViSP-android-sdk>/sdk directory (near 'etc', 'java', 'native' subdirectories)
//
// Add module into Android Studio application project:
//
// - Android Studio way:
//   (will copy almost all ViSP Android SDK into your project, ~200Mb)
//
//   Import module: Menu -> "File" -> "New" -> "Module" -> "Import Gradle project":
//   Source directory: select this "sdk" directory
//   Module name: ":visp"
//
// - or attach library module from ViSP Android SDK
//   (without copying into application project directory, allow to share the same module between projects)
//
//   Edit "settings.gradle" and add these lines:
//
//   def visp_sdk='<path_to_visp_android_sdk_rootdir>'
//   // You can put declaration above into gradle.properties file instead (including file in HOME directory),
//   // but without 'def' and apostrophe symbols ('): visp_sdk=<path_to_visp_android_sdk_rootdir>
//   include ':visp'
//   project(':visp').projectDir = new File(visp_sdk + '/sdk')
//
//
//
// Add dependency into application module:
//
// - Android Studio way:
//   "Open Module Settings" (F4) -> "Dependencies" tab
//
// - or add "project(':visp')" dependency into app/build.gradle:
//
//   dependencies {
//       implementation fileTree(dir: 'libs', include: ['*.jar'])
//       ...
//       implementation project(':visp')
//   }
//
//
//
// Load ViSP native library before using:
//
// - avoid using of "ViSPLoader.initAsync()" approach - it is deprecated
//   It may load library with different version (from ViSP Android Manager, which is installed separatelly on device)
//
// - use "System.loadLibrary("visp_java")" or "ViSPLoader.initDebug()"
//   TODO: Add accurate API to load ViSP native library
//
//
//
// Native C++ support (necessary to use ViSP in native code of application only):
//
// - Use find_package() in app/CMakeLists.txt:
//
//   find_package(ViSP 3.4 REQUIRED java)
//   ...
//   target_link_libraries(native-lib ${ViSP_LIBRARIES})
//
// - Add "ViSP_DIR" and enable C++ exceptions/RTTI support via app/build.gradle
//   Documentation about CMake options: https://developer.android.com/ndk/guides/cmake.html
//
//   defaultConfig {
//       ...
//       externalNativeBuild {
//           cmake {
//               cppFlags "-std=c++11 -frtti -fexceptions"
//               arguments "-DViSP_DIR=" + visp_sdk + "/sdk/native/jni" // , "-DANDROID_ARM_NEON=TRUE"
//           }
//       }
//   }
//
// - (optional) Limit/filter ABIs to build ('android' scope of 'app/build.gradle'):
//   Useful information: https://developer.android.com/studio/build/gradle-tips.html (Configure separate APKs per ABI)
//
//   splits {
//       abi {
//           enable true
//           reset()
//           include 'armeabi-v7a' // , 'x86', 'x86_64', 'arm64-v8a'
//           universalApk false
//       }
//   }
//

apply plugin: 'com.android.library'

println "ViSP: " + project.buildscript.sourceFile

android {
    compileSdkVersion @ANDROID_COMPILE_SDK_VERSION@
    //buildToolsVersion "27.0.3" // not needed since com.android.tools.build:gradle:3.0.0

    defaultConfig {
        minSdkVersion @ANDROID_MIN_SDK_VERSION@
        targetSdkVersion @ANDROID_TARGET_SDK_VERSION@
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    }

    sourceSets {
        main {
            jniLibs.srcDirs = ['native/libs']
            java.srcDirs = ['java/src']
            aidl.srcDirs = ['java/src']
            res.srcDirs = ['java/res']
            manifest.srcFile 'java/AndroidManifest.xml'
        }
    }
}

dependencies {
}
