# Build Native Plugin
This guide will cover building and deploying the native plugin `com.unity.webrtc` depends on.
## Developing environment
Install dependencies to make development environment.
### Windows
On windows, first, the build process use the **clang** compiler. To install clang, see [MSDN](https://docs.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-170). And [chocolatey](https://chocolatey.org/) is used to install.
```powershell
# Install CUDA
choco install cuda --version=10.1
# Install Windows SDK
# WARNING: If you have versions of Windows SDK earlier than Version 1809,
# compiling the plugin will fail. Make sure to uninstall earlier versions.
choco install -y vcredist2010 vcredist2013 vcredist140 windows-sdk-10-version-1809-all
# Install Vulkan
choco install -y wget
wget https://vulkan.lunarg.com/sdk/download/1.1.121.2/windows/VulkanSDK-1.1.121.2-Installer.exe -O C:/Windows/Temp/VulkanSDK.exe
C:/Windows/Temp/VulkanSDK.exe /S
# Install CMake 3.18.0
choco install cmake -y --version 3.18.0
# Install 7zip (used to extract Google's webrtc library after download)
choco install 7zip
# Setting up environment variables
setx CUDA_PATH "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1" /m
setx VULKAN_SDK "C:\VulkanSDK\1.1.121.2" /m
```
### Ubuntu
The below commands shows the build process developing environment on Ubuntu `18.04` or `20.04`.
```bash
# Install libc++-dev libc++abi-dev clang vulkan-utils libvulkan1 libvulkan-dev
# Ubuntu `18.04`
sudo apt install -y libc++-10-dev libc++abi-10-dev clang-10 vulkan-utils libvulkan1 libvulkan-dev
# Ubuntu `20.04`
sudo apt install -y libc++-dev libc++abi-dev clang vulkan-utils libvulkan1 libvulkan-dev
# Install freeglut3-dev
sudo apt update
sudo apt install -y freeglut3-dev
# Install CUDA SDK
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.1.243-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804_10.1.243-1_amd64.deb
sudo apt update
sudo apt install -y cuda
# Install CMake 3.18.0
sudo apt install -y libssl-dev
sudo apt purge -y cmake
wget https://github.com/Kitware/CMake/releases/download/v3.18.0/cmake-3.18.0.tar.gz
tar xvf cmake-3.18.0.tar.gz
cd cmake-3.18.0
./bootstrap && make && sudo make install
```
### macOS
On macOS, [homebrew](https://brew.sh/) is used to install CMake. XCode version **11.0.0 or higher** is used but **Xcode 12 would not work well**.
```bash
# Install CMake
brew install cmake
```
### iOS
On macOS, [homebrew](https://brew.sh/) is used to install CMake. XCode version **11.0.0 or higher** is used but **Xcode 12 would not work well**.
### Android
On Ubuntu (**WSL2** on Windows is also working well),
```bash
# Install Android NDK r21b
wget https://dl.google.com/android/repository/android-ndk-r21b-linux-x86_64.zip
# Set Android NDK root path to `ANDROID_NDK` environment variable
echo "export ANDROID_NDK=~/android-ndk-r21d/" >> ~/.profile
# Install CMake 3.18.0
sudo apt install -y libssl-dev
sudo apt purge -y cmake
wget https://github.com/Kitware/CMake/releases/download/v3.18.0/cmake-3.18.0.tar.gz
tar xvf cmake-3.18.0.tar.gz
cd cmake-3.18.0
./bootstrap && make && sudo make install
# Install pkg-config, zip
sudo apt install -y pkg-config zip
```
## Build plugin
To build plugin, you need to execute command in the `BuildScripts~` folder.
- [BuildScripts~/build_plugin_android.sh](../BuildScripts~/build_plugin_android.sh)
- [BuildScripts~/build_plugin_mac.sh](../BuildScripts~/build_plugin_mac.sh)
- [BuildScripts~/build_plugin_ios.sh](../BuildScripts~/build_plugin_ios.sh)
- [BuildScripts~/build_plugin_linux.sh](../BuildScripts~/build_plugin_linux.sh)
- [BuildScripts~/build_plugin_win.cmd](../BuildScripts~/build_plugin_win.cmd)
- Note: If you encounter `LNK1120`, `LNK2001` or `LNK2019` errors while running this build script, it's possible that you may need to open `Plugin~/build64/webrtc.sln` and build from within Visual Studio 2019 instead. You can also use it for development. ([#441](https://github.com/Unity-Technologies/com.unity.webrtc/issues/441))
Alternatively, after the script has been run, a project ready for your IDE or other build tools is ready for you to use/build with (the name of the folder differs based on the target platform, check the script for more details).
### Deploying the Plugin
When you run the build, `webrtc.dll` will be placed in `Packages\com.unity.webrtc\Runtime\Plugins\x86_64`. You should then be able to verify the following settings in the Unity Inspector window.
**WARNING:** If "Load on startup" is not ticked, your editor will crash when running your project. This may become unticked after you make a change to the plugin. ([#444](https://github.com/Unity-Technologies/com.unity.webrtc/issues/444))
<img src="../Documentation~/images/inspector_webrtc_plugin.png" width=400 align=center>
## Debug
The `WebRTC` project properties must be adjusted to match your environment in order to build the plugin.
Set the Unity.exe path under `Command` and the project path under `Command Arguments`. Once set, during debugging the Unity Editor will run and breakpoints will be enabled.
<img src="../Documentation~/images/command_config_vs2017.png" width=600 align=center>
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共828个文件
meta:300个
cs:150个
h:84个
webrtc源码的下载-对应ios-android-linux-mac-window等平台的编译文档 举例mac端 //直接连外网代理,如何有连外面vpn就不需要,下面的连接是例子不能直接连改自己IP和端口 export http_proxy=http://192.168.0.122:1111 https_proxy=http://192.168.0.122:111 cd /Users/Documents/mac/com.unity.webrtc-2.4.0-exp.6/ //下载编译 ./BuildScripts~//build_libwebrtc_macos.sh
资源推荐
资源详情
资源评论
收起资源包目录
webrtc源码的下载-对应ios-android-linux-mac-window等平台的编译文档 (828个子文件)
libwebrtc.aar 26.42MB
libwebrtc.aar 26.42MB
Unity.WebRTC.RuntimeTests.asmdef 666B
Unity.WebRTC.RuntimeTests.asmdef 666B
Unity.WebRTC.Runtime.asmdef 462B
Unity.WebRTC.Runtime.asmdef 462B
Unity.WebRTC.Editor.asmdef 418B
Unity.WebRTC.Editor.asmdef 418B
Unity.WebRTC.Samples.asmdef 358B
Unity.WebRTC.Samples.asmdef 358B
Unity.WebRTC.EditorTests.asmdef 267B
Unity.WebRTC.EditorTests.asmdef 267B
ProjectSettings.asset 19KB
ProjectSettings-android-vulkan.asset 19KB
QualitySettings.asset 6KB
InputManager.asset 6KB
GraphicsSettings.asset 2KB
Physics2DSettings.asset 2KB
EditorBuildSettings.asset 2KB
NavMeshAreas.asset 1KB
DynamicsManager.asset 1KB
EditorSettings.asset 1KB
PackageManagerSettings.asset 1003B
UnityConnectSettings.asset 853B
EditorUserSettings.asset 485B
AudioManager.asset 414B
TagManager.asset 378B
VFXManager.asset 273B
TimeManager.asset 202B
VersionControlSettings.asset 188B
XRSettings.asset 158B
PresetManager.asset 120B
ClusterInputManager.asset 114B
gl3w.c 82KB
libcuda.so.init.c 15KB
libnvcuvid.so.init.c 4KB
libnvidia-encode.so.init.c 3KB
android_codec_factory_helper.cc 2KB
FindGMock.cmake 4KB
FindWebRTC.cmake 1KB
FindFramework.cmake 1016B
build_libwebrtc_win.cmd 3KB
test_plugin_win.cmd 679B
build_plugin_win.cmd 509B
BarcodeRead.compute 432B
BarcodeRead.compute 432B
WebRTCPlugin.cpp 49KB
NvEncoder.cpp 31KB
NvDecoder.cpp 29KB
NvEncoder.cpp 20KB
Context.cpp 18KB
VulkanUtility.cpp 17KB
debug.cpp 14KB
GraphicsDeviceTestBase.cpp 14KB
UnityRenderEvent.cpp 12KB
D3D12GraphicsDevice.cpp 10KB
PeerConnectionObject.cpp 10KB
NvEncoderCuda.cpp 9KB
VulkanGraphicsDevice.cpp 9KB
OpenGLGraphicsDevice.cpp 7KB
CudaContext.cpp 7KB
ContextTest.cpp 6KB
DummyVideoEncoder.cpp 5KB
GraphicsDevice.cpp 5KB
D3D11GraphicsDevice.cpp 4KB
UnityVulkanInitCallback.cpp 4KB
EncoderFactory.cpp 4KB
VideoRendererTest.cpp 3KB
UnityVideoEncoderFactory.cpp 3KB
Logger.cpp 3KB
VideoTrackSourceTest.cpp 3KB
AudioTrackSinkAdapter.cpp 3KB
VulkanTexture2D.cpp 3KB
UnityAudioTrackSource.cpp 3KB
UnityVideoRenderer.cpp 3KB
GraphicsDeviceTest.cpp 3KB
DummyAudioDevice.cpp 3KB
CudaImage.cpp 3KB
MediaStreamObserver.cpp 2KB
UnityAudioEncoderFactory.cpp 2KB
GraphicsUtility.cpp 2KB
UnityAudioDecoderFactory.cpp 2KB
UnityVideoTrackSource.cpp 2KB
UnityVideoDecoderFactory.cpp 2KB
D3D12Texture2D.cpp 2KB
LoadVulkanFunctions.cpp 2KB
DataChannelObject.cpp 2KB
SoftwareEncoder.cpp 2KB
NvEncoderTest.cpp 2KB
NvEncoderCuda.cpp 1KB
SetSessionDescriptionObserver.cpp 1KB
NvEncoderGL.cpp 1KB
OpenGLTexture2D.cpp 1017B
UnityLogStream.cpp 824B
NvEncoderD3D12.cpp 757B
NvEncoderD3D11.cpp 757B
PeerConnectionStatsCollectorCallback.cpp 753B
Jni.cpp 665B
ScopedProfiler.cpp 627B
CudaDeviceTest.cpp 532B
共 828 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
baoyu45585
- 粉丝: 626
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功