iOS
Build Csound as an XCFramework for iOS devices and simulators.Prerequisites
- macOS with Xcode installed
- Homebrew (for installing bison and flex)
- CMake
Building for iOS
Build Csound for iOS
- Configures CMake for iOS with both arm64 (device) and x86_64 (simulator) architectures
- Builds Csound as a static library
- Creates an XCFramework combining both architectures
- Copies necessary headers and resources
Build script details
The iOS build process uses several key CMake options:libCsoundLib.a- Static library for iOSCsoundiOS.xcframework- XCFramework for use in Xcode projects- Headers in the XCFramework including
iOSCsound.hpp
Using the XCFramework in your project
- Copy
CsoundiOS.xcframeworkfromiOS/Csound-iOS/xcframeworks/to your Xcode project - In Xcode, add the XCFramework to your target:
- Select your target → General → Frameworks, Libraries, and Embedded Content
- Click + and add
CsoundiOS.xcframework - Set “Embed” to “Do Not Embed” (it’s a static framework)
Cross-compiling iOS on Linux
You can cross-compile for iOS on Linux using the ioscross toolchain:Android
Build Csound for Android using Android Studio and the NDK.Prerequisites
- Android Studio: developer.android.com/studio
- Android NDK: developer.android.com/ndk
Setting up environment
Before building, set the following environment variables:Building for Android
Build JNI libraries
- Csound JNI libraries for multiple architectures (armeabi-v7a, arm64-v8a, x86, x86_64)
- Java interface classes
Update Android Studio project (optional)
CsoundForAndroid/ with the newly built libraries.Project structure
- CsoundAndroid: Android Csound JNI and Java interface sources
- CsoundForAndroid: Android Studio projects (CsoundAndroid and CsoundAndroidExamples)
- docs: Documentation
Using in Android Studio
After building:- The JNI libraries are in
./CsoundAndroid/libs/ - The Java sources are in
./CsoundAndroid/src/ - Import the
CsoundAndroidmodule into your Android Studio project as a dependency
Cross-compiling Android on Linux
You can cross-compile for Android on Linux using vcpkg and the Android NDK:Manual NDK build
If you prefer to build without Docker:armeabi-v7a, x86, x86_64.
Troubleshooting
iOS: Bison version too old
Ensure Homebrew’s bison is in your PATH:iOS: Framework build fails
Make sure libsndfile was built first:Android: NDK not found
Set theANDROID_NDK_ROOT environment variable:
Android: Build script not executable
Make scripts executable:Android: Java version incompatibility
Ensure you’re using Java 11 or later:JAVA_HOME to point to the correct JDK.