srt

Building SRT for iOS

Prerequisites

Building OpenSSL

There is OpenSSL for iPhone project which have all necessary to build OpenSSL for our needs. It fetches OpenSSL code by itself, so you don’t need to download it separately. So simply clone it and build with command:

./build-libssl.sh --archs="arm64"

Results (both libraries and headers) will be placed in bin/<SDK_VERSION>-<ARCH>.sdk directory (for example, bin/iPhoneOS11.2-arm64.sdk). We assume you set IOS_OPENSSL variable to this path (e.g. export IOS_OPENSSL="/Users/johndoe/sources/OpenSSL-for-iPhone/bin/iPhoneOS11.2-arm64.sdk").

Building SRT code

Now you can build SRT providing path to OpenSSL library and toolchain file for iOS

./configure --cmake-prefix-path=$IOS_OPENSSL --use-openssl-pc=OFF --cmake-toolchain-file=scripts/iOS.cmake
make

Optionally you may add following iOS-specifc settings to configure:

Note that resulting .dylib file has install path @executable_path/Frameworks/libsrt.1.dylib, so if you need to place it in some other place with your application, you may change it with install_name_tool command: install_name_tool -id "<install_path>" <library_file>, for example install_name_tool -id "@executable_path/Frameworks/libsrt.1.3.0.dylib" libsrt.1.3.0.dylib

Adding to Xcode project

In Xcode project settings in General tab, add libsrt to Linked Frameworks and Libraries section - click Plus sign, then click “Add Other” and find libsrt.1.dylib

Click plus sign in Embedded binaries section and choose Frameworks/libsrt.1.dylib

In Build settings tab find Header Search Paths setting
and add paths to SRT library sources (you should add srt, srt/common and srt/common directories).