Skip to content

Commit

Permalink
Merge pull request #51 from Faless/libdatachannel_pr
Browse files Browse the repository at this point in the history
Switch to libdatachannel as RTC library. Add GDExtension support.
  • Loading branch information
Faless authored Jun 16, 2022
2 parents 8c18112 + e19b370 commit b2654cc
Show file tree
Hide file tree
Showing 24 changed files with 1,034 additions and 1,019 deletions.
51 changes: 0 additions & 51 deletions .github/actions/webrtc-download/action.yml

This file was deleted.

188 changes: 99 additions & 89 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,77 +33,84 @@ jobs:
name: 🔧 Build
needs: static-checks
strategy:
fail-fast: false
matrix:
include:
# Android
- platform: android
arch: 'x86'
sconsflags: 'android_arch=x86'
arch: 'x86_32'
gdnative_flags: 'android_arch=x86'
sconsflags: ''
os: 'ubuntu-20.04'
- platform: android
arch: 'x64'
sconsflags: 'android_arch=x86_64'
arch: 'x86_64'
gdnative_flags: 'android_arch=x86_64'
sconsflags: ''
os: 'ubuntu-20.04'
- platform: android
arch: 'arm'
sconsflags: 'android_arch=armv7'
arch: 'arm32'
gdnative_flags: 'android_arch=armv7'
sconsflags: ''
os: 'ubuntu-20.04'
- platform: android
arch: 'arm64'
sconsflags: 'android_arch=arm64v8'
gdnative_flags: 'android_arch=arm64v8'
sconsflags: ''
os: 'ubuntu-20.04'

# iOS
- platform: ios
arch: 'x64'
sconsflags: 'ios_arch=x86_64 ios_simulator=true'
os: 'macos-latest'
- platform: ios
arch: 'arm'
sconsflags: 'ios_arch=armv7'
arch: 'x86_64'
gdnative_flags: 'ios_arch=x86_64'
sconsflags: 'ios_simulator=true'
os: 'macos-latest'
- platform: ios
arch: 'arm64'
sconsflags: 'ios_arch=arm64'
os: 'macos-latest'
gdnative_flags: 'ios_arch=arm64'
sconsflags: ''
os: 'macos-11'


# Linux
- platform: linux
arch: 'x86'
sconsflags: 'bits=32'
arch: 'x86_32'
gdnative_flags: 'bits=32'
sconsflags: ''
os: 'ubuntu-20.04'
- platform: linux
arch: 'x64'
sconsflags: 'bits=64'
arch: 'x86_64'
gdnative_flags: 'bits=64'
sconsflags: ''
os: 'ubuntu-20.04'

# macOS
- platform: osx
arch: 'x64'
sconsflags: 'bits=64'
os: 'macos-latest'
arch: 'x86_64'
gdnative_flags: 'macos_arch=x86_64 bits=64'
sconsflags: ''
os: 'macos-11'
- platform: osx
gdnative_flags: 'macos_arch=arm64 bits=64'
arch: 'arm64'
sconsflags: 'bits=64 macos_arch=arm64 macos_sdk_path=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/'
os: 'macos-10.15'
sconsflags: ''
os: 'macos-11'

# Windows
- platform: windows
arch: 'x86'
sconsflags: 'bits=32'
os: 'windows-latest'
arch: 'x86_32'
gdnative_flags: 'bits=32'
sconsflags: 'use_mingw=yes'
os: 'ubuntu-20.04'
msvc_arch: amd64_x86
- platform: windows
arch: 'x64'
sconsflags: 'bits=64'
os: 'windows-latest'
arch: 'x86_64'
gdnative_flags: 'bits=64'
sconsflags: 'use_mingw=yes'
os: 'ubuntu-20.04'
msvc_arch: amd64

env:
SCONSFLAGS: ${{ matrix.sconsflags }} platform=${{ matrix.platform }} --jobs=2
NDK_VERSION: 22b
ANDROID_NDK_ROOT: ${{github.workspace}}/android-ndk-r22b
MSVC_VARS: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat'
SCONSFLAGS: ${{ matrix.sconsflags }} platform=${{ matrix.platform }} arch=${{ matrix.arch }} --jobs=2

defaults:
run:
Expand All @@ -114,31 +121,22 @@ jobs:
with:
submodules: recursive

- name: Cache NDK
id: cache-ndk
if: ${{ matrix.platform == 'android' }}
uses: actions/cache@v2
with:
path: ${{ env.ANDROID_NDK_ROOT }}
key: ndk-${{ env.NDK_VERSION }}

- name: Download NDK
if: ${{ matrix.platform == 'android' && steps.cache-ndk.outputs.cache-hit != 'true' }}
id: setup-ndk
run: |
cd ${{ github.workspace }}
curl -L https://dl.google.com/android/repository/android-ndk-r${{ env.NDK_VERSION }}-linux-x86_64.zip -o ndk.zip
unzip ndk.zip
ls
- name: Setup MSVC build environment for ${{ matrix.msvc_arch }}
- name: Install Windows build dependencies
if: ${{ matrix.platform == 'windows' }}
run: "'${{ env.MSVC_VARS }}' ${{ matrix.msvc_arch }}"
run: |
sudo apt-get update
sudo apt-get install build-essential mingw-w64
sudo update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix
sudo update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
dpkg -l | grep ii | grep mingw
update-alternatives --get-selections | grep mingw
- name: Install Linux build dependencies
if: ${{ matrix.platform == 'linux' }}
run: |
sudo apt-get install build-essential gcc-multilib wget g++-multilib
sudo apt-get install build-essential gcc-multilib g++-multilib
- name: Set up Python 3.x
uses: actions/setup-python@v2
Expand All @@ -152,35 +150,25 @@ jobs:
python -m pip install scons
python --version
scons --version
cmake --version
- name: Get WebRTC package for ${{ matrix.platform }} - ${{ matrix.arch }}
uses: ./.github/actions/webrtc-download
with:
platform: ${{ matrix.platform }}
archs: ${{ matrix.arch }}

- name: Fix godot-cpp revision and file names for OSX arm64 build.
if: ${{ matrix.platform == 'osx' && matrix.arch == 'arm64' }}
- name: Compile Extension - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
run: |
cd godot-cpp
git checkout e08ecdc28c5409cb5366027227e996c342dcee93
rm -rf src/gen/
rm -rf include/gen/
mkdir bin
ln -s libgodot-cpp.osx.debug.64.a bin/libgodot-cpp.osx.debug.arm64.a
ln -s libgodot-cpp.osx.release.64.a bin/libgodot-cpp.osx.release.arm64.a
- name: Compilation ${{ matrix.platform }} - ${{ matrix.arch }} - godot-cpp
scons target=debug generate_bindings=yes
- name: Compile GDNative - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
run: |
scons -C godot-cpp target=debug generate_bindings=yes
scons -C godot-cpp target=release
scons target=debug generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3
- name: Compilation ${{ matrix.platform }} - ${{ matrix.arch }} - webrtc-native
- name: Compile Extension - release - ${{ matrix.platform }} - ${{ matrix.arch }}
run: |
scons target=debug
scons target=release
- uses: actions/upload-artifact@v2
- name: Compile GDNative - release ${{ matrix.platform }} - ${{ matrix.arch }}
run: |
scons target=release ${{ matrix.gdnative_flags }} godot_version=3
- uses: actions/upload-artifact@v3
with:
name: ${{ github.job }}-${{ matrix.platform }}-${{ matrix.arch }}
path: bin/*
Expand All @@ -191,32 +179,54 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
path: artifacts

- name: Bundle licenses.
run: |
cp LICENSE artifacts/LICENSE.webrtc-native
cp deps/libdatachannel/LICENSE artifacts/LICENSE.libdatachannel
cp deps/openssl/LICENSE.txt artifacts/LICENSE.openssl
cp deps/libdatachannel/deps/libjuice/LICENSE artifacts/LICENSE.libjuice
cp deps/libdatachannel/deps/usrsctp/LICENSE.md artifacts/LICENSE.usrsctp
cp deps/libdatachannel/deps/libsrtp/LICENSE artifacts/LICENSE.libsrtp
cp deps/libdatachannel/deps/json/LICENSE.MIT artifacts/LICENSE.json
cp deps/libdatachannel/deps/plog/LICENSE artifacts/LICENSE.plog
- name: Package artifacts for release
run: |
mkdir release
cd release
for name in webrtc webrtc_debug
ls -R
for version in extension gdnative
do
mkdir -p ${name}/lib/
find ../artifacts -wholename "*/${name}/lib/*" | xargs cp -t ${name}/lib/
find ../artifacts -wholename "*/${name}/${name}.tres" | head -n 1 | xargs cp -t ${name}/
for name in webrtc webrtc_debug
do
destdir="${version}/${name}"
mkdir -p ${destdir}/lib
find ../artifacts -wholename "*/${destdir}/lib/*" | xargs cp -t ${destdir}/lib/
find ../artifacts -wholename "*/${destdir}/${name}.tres" -or -wholename "*/${destdir}/${name}.gdextension" | head -n 1 | xargs cp -t ${destdir}/
find ../artifacts -wholename "*/LICENSE*" | xargs cp -t ${destdir}/
cd ${version}
zip -r ../godot-${version}-${name}.zip ${name}
cd ..
done
done
zip -r godot-webrtc-native-release.zip webrtc
zip -r godot-webrtc-native-debug.zip webrtc_debug
ls -R
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: godot-webrtc-native-debug.zip
path: release/godot-webrtc-native-debug.zip
name: godot-webrtc-extension
path: release/*-extension-*.zip

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: godot-webrtc-native-release.zip
path: release/godot-webrtc-native-release.zip
name: godot-webrtc-gdnative
path: release/*-gdnative-*.zip
11 changes: 10 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
[submodule "godot-cpp-3.x"]
path = godot-cpp-3.x
url = https://github.com/godotengine/godot-cpp.git
[submodule "godot-cpp"]
path = godot-cpp
url = https://github.com/GodotNativeTools/godot-cpp
url = https://github.com/godotengine/godot-cpp.git
[submodule "libdatachannel"]
path = deps/libdatachannel
url = https://github.com/paullouisageneau/libdatachannel.git
[submodule "openssl"]
path = deps/openssl
url = https://github.com/openssl/openssl.git
Loading

0 comments on commit b2654cc

Please sign in to comment.