Skip to content

Powerful build scripts to cross-compile the WebRTC Audio Processing library for both Android and iOS

License

Notifications You must be signed in to change notification settings

panliming-tuya/webrtc-audio-processing-mobile

Repository files navigation

WebRTC Audio Processing for Mobile

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.

Features

  • Dual Platform Support: Build for both Android and iOS with dedicated scripts.
  • Static and Shared Libraries: Easily choose to build .a or .so/.dylib libraries.
  • Android ABI Support: Out-of-the-box support for arm64-v8a and armeabi-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.

Prerequisites

Before you begin, ensure you have the following tools installed.

On macOS

  1. Build Tools: Install Meson and Ninja using Homebrew.
    brew install meson ninja
  2. Xcode: The full Xcode IDE is required for iOS builds. Install it from the App Store.
  3. Xcode Command Line Tools: If not already installed, run xcode-select --install.
  4. Android NDK: For Android builds, install the NDK and set the ANDROID_NDK_HOME environment variable.
    # Example: Add this to your ~/.zshrc or ~/.bash_profile
    export ANDROID_NDK_HOME="/path/to/your/android-ndk"

On Linux (Ubuntu/Debian)

  1. Build Tools: Install Meson and Ninja using apt.
    sudo apt-get update && sudo apt-get install meson ninja-build
  2. Android NDK: Install the NDK and set the ANDROID_NDK_HOME environment variable.

Getting Started

  1. Clone the Repository

    Clone this repository recursively to ensure the webrtc-audio-processing submodule is included:

    git clone --recursive https://github.com/your-username/webrtc-audio-processing-mobile.git
    cd webrtc-audio-processing-mobile

    If you have already cloned the repository without the --recursive flag, you can initialize the submodule by running:

    git submodule update --init --recursive
  2. 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
        └── ...
    

How to Build

First, make the scripts executable:

chmod +x build-android.sh build-ios.sh

Building for Android

Run 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

Building for iOS (on macOS)

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

Output Artifacts

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)

Customization

You can easily tweak build parameters by editing the variables at the top of each script:

  • build-android.sh: Modify ABIS to add/remove target ABIs (e.g., x86_64) or change the API_LEVEL.
  • build-ios.sh: Modify MIN_IOS_VERSION to change the minimum deployment target.

License

This project and its build scripts are released under the MIT License.

About

Powerful build scripts to cross-compile the WebRTC Audio Processing library for both Android and iOS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages