Use libdatachannel library, add Godot 4 support.

This commit is contained in:
Fabio Alessandrelli
2021-09-22 23:16:23 +02:00
parent 8c18112f5d
commit e19b370126
24 changed files with 1045 additions and 1030 deletions

View File

@@ -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:
@@ -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
@@ -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
scons target=debug generate_bindings=yes
- name: Compilation ${{ matrix.platform }} - ${{ matrix.arch }} - godot-cpp
- 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/*
@@ -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
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}/
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
with:
name: godot-webrtc-native-debug.zip
path: release/godot-webrtc-native-debug.zip
for version in extension gdnative
do
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
- uses: actions/upload-artifact@v2
ls -R
- uses: actions/upload-artifact@v3
with:
name: godot-webrtc-native-release.zip
path: release/godot-webrtc-native-release.zip
name: godot-webrtc-extension
path: release/*-extension-*.zip
- uses: actions/upload-artifact@v3
with:
name: godot-webrtc-gdnative
path: release/*-gdnative-*.zip