This repository provides a set of simple, powerful build scripts to cross-compile the WebRTC Audio Processing library for both Android and iOS.
The goal is to automate the complex setup of cross-compilation toolchains, allowing mobile developers to quickly generate the necessary static (.a) or shared (.so/.dylib) libraries for their native projects.
- Dual Platform Support: Build for both Android and iOS with dedicated scripts.
- Static and Shared Libraries: Easily choose to build
.aor.so/.dyliblibraries. - Android ABI Support: Out-of-the-box support for
arm64-v8aandarmeabi-v7a. - iOS Architecture Support: Builds for
arm64, ready for modern iOS devices. - Automated Toolchain Configuration: The scripts generate the necessary Meson cross-files on the fly, detecting NDK and Xcode paths automatically.
- Clean and Organized Output: All compiled artifacts (libraries and headers) are placed in a structured
output/directory, separated by platform, architecture, and library type.
Before you begin, ensure you have the following tools installed.
- Build Tools: Install Meson and Ninja using Homebrew.
brew install meson ninja
- Xcode: The full Xcode IDE is required for iOS builds. Install it from the App Store.
- Xcode Command Line Tools: If not already installed, run
xcode-select --install. - Android NDK: For Android builds, install the NDK and set the
ANDROID_NDK_HOMEenvironment variable.# Example: Add this to your ~/.zshrc or ~/.bash_profile export ANDROID_NDK_HOME="/path/to/your/android-ndk"
- Build Tools: Install Meson and Ninja using
apt.sudo apt-get update && sudo apt-get install meson ninja-build - Android NDK: Install the NDK and set the
ANDROID_NDK_HOMEenvironment variable.
-
Clone the Repository
Clone this repository recursively to ensure the
webrtc-audio-processingsubmodule is included:git clone --recursive https://github.com/your-username/webrtc-audio-processing-mobile.git cd webrtc-audio-processing-mobileIf you have already cloned the repository without the
--recursiveflag, you can initialize the submodule by running:git submodule update --init --recursive
-
Verify Project Structure
Your project directory should now look like this:
webrtc-audio-processing-mobile/ ├── build-android.sh ├── build-ios.sh ├── README.md └── webrtc-audio-processing/ <-- The initialized submodule ├── meson.build └── ...
First, make the scripts executable:
chmod +x build-android.sh build-ios.shRun the build-android.sh script. It defaults to building static libraries.
-
To build static libraries (
.a):./build-android.sh static
(You can also just run
./build-android.sh) -
To build shared libraries (
.so):./build-android.sh shared
Run the build-ios.sh script. It defaults to building static libraries.
-
To build a static library (
.a):./build-ios.sh static
(You can also just run
./build-ios.sh) -
To build a dynamic library (
.dylib):./build-ios.sh shared
All compiled libraries and headers will be placed in the output/ directory, neatly organized. You can directly take these artifacts and integrate them into your Android Studio or Xcode project.
output/
├── android-arm64-v8a-static/
│ ├── include/
│ └── lib/libwebrtc_audio_processing.a
├── android-armeabi-v7a-static/
│ ├── include/
│ └── lib/libwebrtc_audio_processing.a
│
└── ios-arm64-static/
├── include/
└── lib/libwebrtc_audio_processing.a
... (and similar folders for 'shared' if you built them)
You can easily tweak build parameters by editing the variables at the top of each script:
build-android.sh: ModifyABISto add/remove target ABIs (e.g.,x86_64) or change theAPI_LEVEL.build-ios.sh: ModifyMIN_IOS_VERSIONto change the minimum deployment target.
This project and its build scripts are released under the MIT License.