Add cmake build instructions for Android (#751)

Co-authored-by: I.Laghidze <developer@artisan-one.com>
Co-authored-by: evpobr <evpobr@gmail.com>
This commit is contained in:
Ioseb Laghidze 2021-06-15 20:29:22 +04:00 committed by GitHub
parent dfdad63ff2
commit 01628f48b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,3 +15,32 @@ by setting them before the script is run.
Since I (erikd), do almost zero Android development, I am happy accept patches
for this documentation and script to improve its utility for real Android
developers.
---
## Using CMake
(Tested on Linux)
For convenience, export the following variables:
```
export ANDROID_ABI=arm64-v8a
export ANDROID_PLATFORM_API_LEVEL=29
export NDK_ROOT=/path/to/android/ndk
```
Set `ANDROID_ABI`, `ANDROID_PLATFORM_API_LEVEL` according to your target system. Now cd into the libsndfile root directory, and run
```
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$NDK_ROOT/build/cmake/android.toolchain.cmake -DANDROID_ABI=$ANDROID_ABI -DANDROID_PLATFORM=$ANDROID_PLATFORM_API_LEVEL
```
cd into `build` and run make
```
cd build
make [-j <number of parallel jobs>]
```
This will build libsndfile for android.