1*30877f79SAndroid Build Coastguard Worker// Copyright (C) 2019 The Android Open Source Project
2*30877f79SAndroid Build Coastguard Worker//
3*30877f79SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*30877f79SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*30877f79SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*30877f79SAndroid Build Coastguard Worker//
7*30877f79SAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
8*30877f79SAndroid Build Coastguard Worker//
9*30877f79SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*30877f79SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*30877f79SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*30877f79SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*30877f79SAndroid Build Coastguard Worker// limitations under the License.
14*30877f79SAndroid Build Coastguard Workerapply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle"
15*30877f79SAndroid Build Coastguard Worker
16*30877f79SAndroid Build Coastguard Workerandroid {
17*30877f79SAndroid Build Coastguard Worker    defaultConfig {
18*30877f79SAndroid Build Coastguard Worker        externalNativeBuild {
19*30877f79SAndroid Build Coastguard Worker            cmake {
20*30877f79SAndroid Build Coastguard Worker                // Debug CMake build type causes video frames to drop,
21*30877f79SAndroid Build Coastguard Worker                // so native library should always use Release build type.
22*30877f79SAndroid Build Coastguard Worker                arguments "-DCMAKE_BUILD_TYPE=Release"
23*30877f79SAndroid Build Coastguard Worker                arguments "-DBUILD_TESTING=OFF"
24*30877f79SAndroid Build Coastguard Worker                targets "gav1JNI"
25*30877f79SAndroid Build Coastguard Worker            }
26*30877f79SAndroid Build Coastguard Worker        }
27*30877f79SAndroid Build Coastguard Worker    }
28*30877f79SAndroid Build Coastguard Worker}
29*30877f79SAndroid Build Coastguard Worker
30*30877f79SAndroid Build Coastguard Worker// Configure the native build only if libgav1 is present to avoid gradle sync
31*30877f79SAndroid Build Coastguard Worker// failures if libgav1 hasn't been built according to the README instructions.
32*30877f79SAndroid Build Coastguard Workerif (project.file('src/main/jni/libgav1').exists()) {
33*30877f79SAndroid Build Coastguard Worker    android.externalNativeBuild.cmake {
34*30877f79SAndroid Build Coastguard Worker        path = 'src/main/jni/CMakeLists.txt'
35*30877f79SAndroid Build Coastguard Worker        version = '3.7.1+'
36*30877f79SAndroid Build Coastguard Worker        if (project.hasProperty('externalNativeBuildDir')) {
37*30877f79SAndroid Build Coastguard Worker            if (!new File(externalNativeBuildDir).isAbsolute()) {
38*30877f79SAndroid Build Coastguard Worker                ext.externalNativeBuildDir =
39*30877f79SAndroid Build Coastguard Worker                        new File(rootDir, it.externalNativeBuildDir)
40*30877f79SAndroid Build Coastguard Worker            }
41*30877f79SAndroid Build Coastguard Worker            buildStagingDirectory = "${externalNativeBuildDir}/${project.name}"
42*30877f79SAndroid Build Coastguard Worker        }
43*30877f79SAndroid Build Coastguard Worker    }
44*30877f79SAndroid Build Coastguard Worker}
45*30877f79SAndroid Build Coastguard Worker
46*30877f79SAndroid Build Coastguard Workerdependencies {
47*30877f79SAndroid Build Coastguard Worker    implementation project(modulePrefix + 'library-decoder')
48*30877f79SAndroid Build Coastguard Worker    // TODO(b/203752526): Remove this dependency.
49*30877f79SAndroid Build Coastguard Worker    implementation project(modulePrefix + 'library-core')
50*30877f79SAndroid Build Coastguard Worker    implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
51*30877f79SAndroid Build Coastguard Worker    compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
52*30877f79SAndroid Build Coastguard Worker}
53*30877f79SAndroid Build Coastguard Worker
54*30877f79SAndroid Build Coastguard Workerext {
55*30877f79SAndroid Build Coastguard Worker    javadocTitle = 'AV1 extension'
56*30877f79SAndroid Build Coastguard Worker}
57*30877f79SAndroid Build Coastguard Workerapply from: '../../javadoc_library.gradle'
58