Fail av1 extension build if CMake is missing

If a user has checked out libgav1 they almost certainly want to
build the extension, so fail if CMake is not present but
libgav1 is present. Also add a note to the README linking to
instructions for installing CMake.

Also remove the NDK check, as ndk.dir is apparently deprecated
and Android Studio appears to install this automatically anyway.

PiperOrigin-RevId: 273918142
This commit is contained in:
andrewlewis 2019-10-10 10:35:21 +01:00 committed by Ian Baker
parent 5cf82a5079
commit 3574345960
2 changed files with 11 additions and 14 deletions

View File

@ -41,15 +41,17 @@ cd "${AV1_EXT_PATH}/jni/libgav1" && \
git clone https://github.com/abseil/abseil-cpp.git third_party/abseil-cpp git clone https://github.com/abseil/abseil-cpp.git third_party/abseil-cpp
``` ```
libgav1 and [JNI wrapper library][] are built using [CMake][] set-up with * [Install CMake][].
[Ninja][]. After following the instructions above to fetch libgav1, gradle will
build the extension automatically when run on the command line or via Android Having followed these steps, gradle will build the extension automatically when
Studio. run on the command line or via Android Studio, using [CMake][] and [Ninja][]
to configure and build libgav1 and the extension's [JNI wrapper library][].
[top level README]: https://github.com/google/ExoPlayer/blob/release-v2/README.md [top level README]: https://github.com/google/ExoPlayer/blob/release-v2/README.md
[JNI wrapper library]: https://github.com/google/ExoPlayer/blob/release-v2/extensions/av1/src/main/jni/gav1_jni.cc [Install CMake]: https://developer.android.com/studio/projects/install-ndk
[CMake]: https://cmake.org/ [CMake]: https://cmake.org/
[Ninja]: https://ninja-build.org [Ninja]: https://ninja-build.org
[JNI wrapper library]: https://github.com/google/ExoPlayer/blob/dev-v2/extensions/av1/src/main/jni/gav1_jni.cc
## Using the extension ## ## Using the extension ##

View File

@ -54,15 +54,10 @@ android {
} }
} }
// Check that the Android NDK, CMake and libgav1 are present, to avoid gradle // Configure the native build only if libgav1 is present, to avoid gradle sync
// sync failures if the tools aren't installed or libgav1 is missing. To use // failures if libgav1 hasn't been checked out according to the README and CMake
// the extension it is necessary to install the NDK and CMake from the SDK // isn't installed.
// Manager and fetch libgav1 following the steps in README. if (project.file('src/main/jni/libgav1').exists()) {
def ndkDirectory = project.android.ndkDirectory
def sdkDirectory = project.android.sdkDirectory
if (ndkDirectory != null && !ndkDirectory.toString().isEmpty()
&& new File(sdkDirectory.toString() + '/cmake').exists()
&& project.file('src/main/jni/libgav1').exists()) {
android.externalNativeBuild.cmake.path = 'src/main/jni/CMakeLists.txt' android.externalNativeBuild.cmake.path = 'src/main/jni/CMakeLists.txt'
android.externalNativeBuild.cmake.version = '3.7.1+' android.externalNativeBuild.cmake.version = '3.7.1+'
} }