1// Copyright (C) 2019 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14apply from: '../../constants.gradle' 15apply plugin: 'com.android.library' 16 17android { 18 compileSdkVersion project.ext.compileSdkVersion 19 20 compileOptions { 21 sourceCompatibility JavaVersion.VERSION_1_8 22 targetCompatibility JavaVersion.VERSION_1_8 23 } 24 25 defaultConfig { 26 minSdkVersion project.ext.minSdkVersion 27 targetSdkVersion project.ext.targetSdkVersion 28 consumerProguardFiles 'proguard-rules.txt' 29 30 externalNativeBuild { 31 cmake { 32 // Debug CMake build type causes video frames to drop, 33 // so native library should always use Release build type. 34 arguments "-DCMAKE_BUILD_TYPE=Release" 35 targets "gav1JNI" 36 } 37 } 38 } 39 40 // This option resolves the problem of finding libgav1JNI.so 41 // on multiple paths. The first one found is picked. 42 packagingOptions { 43 pickFirst 'lib/arm64-v8a/libgav1JNI.so' 44 pickFirst 'lib/armeabi-v7a/libgav1JNI.so' 45 pickFirst 'lib/x86/libgav1JNI.so' 46 pickFirst 'lib/x86_64/libgav1JNI.so' 47 } 48 49 sourceSets.main { 50 // As native JNI library build is invoked from gradle, this is 51 // not needed. However, it exposes the built library and keeps 52 // consistency with the other extensions. 53 jniLibs.srcDir 'src/main/libs' 54 } 55} 56 57// Configure the native build only if libgav1 is present, to avoid gradle sync 58// failures if libgav1 hasn't been checked out according to the README and CMake 59// isn't installed. 60if (project.file('src/main/jni/libgav1').exists()) { 61 android.externalNativeBuild.cmake.path = 'src/main/jni/CMakeLists.txt' 62 android.externalNativeBuild.cmake.version = '3.7.1+' 63} 64 65dependencies { 66 implementation project(modulePrefix + 'library-core') 67 implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion 68 compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion 69} 70 71ext { 72 javadocTitle = 'AV1 extension' 73} 74apply from: '../../javadoc_library.gradle' 75