|
1 | 1 | ## WebRTC-macOS
|
2 | 2 |
|
3 |
| -A WebRTC port to macOS with a FAT library for x86 and arm (Intel and Apple Silicon) |
| 3 | +A WebRTC port for macOS consisting of a universal library for x86 and arm (Intel and Apple Silicon) |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +To Install this library, you can use the `WebRTC.framework` attached in the releases section |
| 8 | + |
| 9 | +Alternatively, you can use CocoaPods with the following addition to your podfile: |
| 10 | + |
| 11 | +``` |
| 12 | +pod 'WebRTC-macOS', :git => 'https://github.com/tmthecoder/WebRTC-macOS.git', :tag => '8324' |
| 13 | +``` |
| 14 | + |
| 15 | +## Usage |
| 16 | + |
| 17 | +The guides on the WebRTC example may be followed with all functionality present. |
| 18 | + |
| 19 | +All you need to do is add the import statement to use for Swift: |
| 20 | + |
| 21 | +``` |
| 22 | +import WebRTC |
| 23 | +``` |
| 24 | + |
| 25 | +## Building |
| 26 | +To Build your own WebRTC Framework, similar to the one I have build, |
| 27 | +the instructions are as follows: |
| 28 | + |
| 29 | +Clone the WebRTC Source: |
| 30 | + |
| 31 | +``` |
| 32 | +git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
| 33 | +export PATH=$PATH:/path/to/depot_tools |
| 34 | +
|
| 35 | +fetch --nohooks webrtc_ios |
| 36 | +
|
| 37 | +gclient sync |
| 38 | +``` |
| 39 | + |
| 40 | +Generate the macOS Targets (x86_64 and arm64) |
| 41 | + |
| 42 | +``` |
| 43 | +gn gen out/mac_x64 --args='target_os="mac" target_cpu="x64" is_component_build=false is_debug=false rtc_libvpx_build_vp9=false enable_stripping=true rtc_enable_protobuf=false' |
| 44 | +
|
| 45 | +gn gen out/mac_arm64 --args='target_os="mac" target_cpu="arm64" is_component_build=false is_debug=false rtc_libvpx_build_vp9=false enable_stripping=true rtc_enable_protobuf=false' |
| 46 | +
|
| 47 | +``` |
| 48 | + |
| 49 | +Build both frameworks: |
| 50 | + |
| 51 | +``` |
| 52 | +ninja -C out/mac_x64 mac_framework_objc |
| 53 | +
|
| 54 | +ninja -C out/mac_arm64 mac_framework_objc |
| 55 | +``` |
| 56 | + |
| 57 | +Merge the frameworks using `lipo`: |
| 58 | + |
| 59 | +``` |
| 60 | +cd .. |
| 61 | +
|
| 62 | +cp -R src/out/mac_x64/WebRTC.framework WebRTC.framework |
| 63 | +
|
| 64 | +lipo -create -output WebRTC.framework/WebRTC src/out/mac_x64/WebRTC.framework/WebRTC src/out/mac_arm64/WebRTC.framework/WebRTC |
| 65 | +``` |
| 66 | +The outputted `WebRTC.framework` can be imported into an Xcode Project and will support both Intel and Apple Silicon Macs |
| 67 | + |
| 68 | +## Licensing |
| 69 | + |
| 70 | +- This port of WebRTC, and any changes made by me will fall under the [MIT License](https://github.com/tmthecoder/WebRTC-macOS/blob/main/LICENSE) |
| 71 | + |
| 72 | +- WebRTC's license can be found [here](https://webrtc.org/support/license) |
0 commit comments