build_plugin_linux.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash -eu
  2. export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M92/webrtc-linux.zip
  3. export SOLUTION_DIR=$(pwd)/Plugin~
  4. export LIBCXX_BUILD_DIR=$(pwd)/llvm-project/build
  5. source ~/.profile
  6. # Download LibWebRTC
  7. curl -L $LIBWEBRTC_DOWNLOAD_URL > webrtc.zip
  8. unzip -d $SOLUTION_DIR/webrtc webrtc.zip
  9. # Install glad2
  10. pip3 install git+https://github.com/dav1dde/glad.git@glad2#egg=glad2
  11. git clone --depth 1 --branch release/13.x https://github.com/llvm/llvm-project.git
  12. pushd llvm-project
  13. mkdir build
  14. cmake -G Ninja -S runtimes -B build -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10 -DLLVM_ENABLE_PIC=ON -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"
  15. ninja -C build cxx cxxabi
  16. popd
  17. # Build UnityRenderStreaming Plugin
  18. cd "$SOLUTION_DIR"
  19. cmake . \
  20. -D CMAKE_C_COMPILER="clang-10" \
  21. -D CMAKE_CXX_COMPILER="clang++-10" \
  22. -D CMAKE_BUILD_TYPE="Release" \
  23. -D USE_CUSTOM_LIBCXX_STATIC=ON \
  24. -D CUSTOM_LIBCXX_DIR="$LIBCXX_BUILD_DIR" \
  25. -B build
  26. cmake \
  27. --build build \
  28. --config Release \
  29. --target WebRTCPlugin