forked from Unity-Technologies/com.unity.webrtc
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild_plugin_ios.sh
executable file
·41 lines (33 loc) · 1.1 KB
/
build_plugin_ios.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash -eu
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M89/webrtc-ios.zip
export SOLUTION_DIR=$(pwd)/Plugin~
export WEBRTC_FRAMEWORK_DIR=$(pwd)/Runtime/Plugins/iOS
# Install cmake
export HOMEBREW_NO_AUTO_UPDATE=1
brew install cmake
# Download webrtc
curl -L $LIBWEBRTC_DOWNLOAD_URL > webrtc.zip
unzip -d $SOLUTION_DIR/webrtc webrtc.zip
# Build webrtc Unity plugin
cd "$SOLUTION_DIR"
cmake . \
-G Xcode \
-D CMAKE_SYSTEM_NAME=iOS \
-D "CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \
-D CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO \
-D CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE=YES \
-B build
xcodebuild -sdk iphonesimulator \
-arch "x86_64" \
-project build/webrtc.xcodeproj \
-target WebRTCPlugin \
-configuration Release
mv "$WEBRTC_FRAMEWORK_DIR/webrtc.framework" "$WEBRTC_FRAMEWORK_DIR/webrtc-sim.framework"
xcodebuild -sdk iphoneos \
-project build/webrtc.xcodeproj \
-target WebRTCPlugin \
-configuration Release
cd "$WEBRTC_FRAMEWORK_DIR"
lipo -create -o webrtc.framework/webrtc \
webrtc.framework/webrtc \
webrtc-sim.framework/webrtc