Skip to content

Commit e19b370

Browse files
committed
Use libdatachannel library, add Godot 4 support.
1 parent 8c18112 commit e19b370

24 files changed

+1034
-1019
lines changed

.github/actions/webrtc-download/action.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/build_release.yml

Lines changed: 99 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -33,77 +33,84 @@ jobs:
3333
name: 🔧 Build
3434
needs: static-checks
3535
strategy:
36+
fail-fast: false
3637
matrix:
3738
include:
3839
# Android
3940
- platform: android
40-
arch: 'x86'
41-
sconsflags: 'android_arch=x86'
41+
arch: 'x86_32'
42+
gdnative_flags: 'android_arch=x86'
43+
sconsflags: ''
4244
os: 'ubuntu-20.04'
4345
- platform: android
44-
arch: 'x64'
45-
sconsflags: 'android_arch=x86_64'
46+
arch: 'x86_64'
47+
gdnative_flags: 'android_arch=x86_64'
48+
sconsflags: ''
4649
os: 'ubuntu-20.04'
4750
- platform: android
48-
arch: 'arm'
49-
sconsflags: 'android_arch=armv7'
51+
arch: 'arm32'
52+
gdnative_flags: 'android_arch=armv7'
53+
sconsflags: ''
5054
os: 'ubuntu-20.04'
5155
- platform: android
5256
arch: 'arm64'
53-
sconsflags: 'android_arch=arm64v8'
57+
gdnative_flags: 'android_arch=arm64v8'
58+
sconsflags: ''
5459
os: 'ubuntu-20.04'
5560

5661
# iOS
5762
- platform: ios
58-
arch: 'x64'
59-
sconsflags: 'ios_arch=x86_64 ios_simulator=true'
60-
os: 'macos-latest'
61-
- platform: ios
62-
arch: 'arm'
63-
sconsflags: 'ios_arch=armv7'
63+
arch: 'x86_64'
64+
gdnative_flags: 'ios_arch=x86_64'
65+
sconsflags: 'ios_simulator=true'
6466
os: 'macos-latest'
6567
- platform: ios
6668
arch: 'arm64'
67-
sconsflags: 'ios_arch=arm64'
68-
os: 'macos-latest'
69+
gdnative_flags: 'ios_arch=arm64'
70+
sconsflags: ''
71+
os: 'macos-11'
72+
6973

7074
# Linux
7175
- platform: linux
72-
arch: 'x86'
73-
sconsflags: 'bits=32'
76+
arch: 'x86_32'
77+
gdnative_flags: 'bits=32'
78+
sconsflags: ''
7479
os: 'ubuntu-20.04'
7580
- platform: linux
76-
arch: 'x64'
77-
sconsflags: 'bits=64'
81+
arch: 'x86_64'
82+
gdnative_flags: 'bits=64'
83+
sconsflags: ''
7884
os: 'ubuntu-20.04'
7985

8086
# macOS
8187
- platform: osx
82-
arch: 'x64'
83-
sconsflags: 'bits=64'
84-
os: 'macos-latest'
88+
arch: 'x86_64'
89+
gdnative_flags: 'macos_arch=x86_64 bits=64'
90+
sconsflags: ''
91+
os: 'macos-11'
8592
- platform: osx
93+
gdnative_flags: 'macos_arch=arm64 bits=64'
8694
arch: 'arm64'
87-
sconsflags: 'bits=64 macos_arch=arm64 macos_sdk_path=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/'
88-
os: 'macos-10.15'
95+
sconsflags: ''
96+
os: 'macos-11'
8997

9098
# Windows
9199
- platform: windows
92-
arch: 'x86'
93-
sconsflags: 'bits=32'
94-
os: 'windows-latest'
100+
arch: 'x86_32'
101+
gdnative_flags: 'bits=32'
102+
sconsflags: 'use_mingw=yes'
103+
os: 'ubuntu-20.04'
95104
msvc_arch: amd64_x86
96105
- platform: windows
97-
arch: 'x64'
98-
sconsflags: 'bits=64'
99-
os: 'windows-latest'
106+
arch: 'x86_64'
107+
gdnative_flags: 'bits=64'
108+
sconsflags: 'use_mingw=yes'
109+
os: 'ubuntu-20.04'
100110
msvc_arch: amd64
101111

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

108115
defaults:
109116
run:
@@ -114,31 +121,22 @@ jobs:
114121
with:
115122
submodules: recursive
116123

117-
- name: Cache NDK
118-
id: cache-ndk
119-
if: ${{ matrix.platform == 'android' }}
120-
uses: actions/cache@v2
121-
with:
122-
path: ${{ env.ANDROID_NDK_ROOT }}
123-
key: ndk-${{ env.NDK_VERSION }}
124-
125-
- name: Download NDK
126-
if: ${{ matrix.platform == 'android' && steps.cache-ndk.outputs.cache-hit != 'true' }}
127-
id: setup-ndk
128-
run: |
129-
cd ${{ github.workspace }}
130-
curl -L https://dl.google.com/android/repository/android-ndk-r${{ env.NDK_VERSION }}-linux-x86_64.zip -o ndk.zip
131-
unzip ndk.zip
132-
ls
133-
134-
- name: Setup MSVC build environment for ${{ matrix.msvc_arch }}
124+
- name: Install Windows build dependencies
135125
if: ${{ matrix.platform == 'windows' }}
136-
run: "'${{ env.MSVC_VARS }}' ${{ matrix.msvc_arch }}"
126+
run: |
127+
sudo apt-get update
128+
sudo apt-get install build-essential mingw-w64
129+
sudo update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix
130+
sudo update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
131+
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
132+
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
133+
dpkg -l | grep ii | grep mingw
134+
update-alternatives --get-selections | grep mingw
137135
138136
- name: Install Linux build dependencies
139137
if: ${{ matrix.platform == 'linux' }}
140138
run: |
141-
sudo apt-get install build-essential gcc-multilib wget g++-multilib
139+
sudo apt-get install build-essential gcc-multilib g++-multilib
142140
143141
- name: Set up Python 3.x
144142
uses: actions/setup-python@v2
@@ -152,35 +150,25 @@ jobs:
152150
python -m pip install scons
153151
python --version
154152
scons --version
153+
cmake --version
155154
156-
- name: Get WebRTC package for ${{ matrix.platform }} - ${{ matrix.arch }}
157-
uses: ./.github/actions/webrtc-download
158-
with:
159-
platform: ${{ matrix.platform }}
160-
archs: ${{ matrix.arch }}
161-
162-
- name: Fix godot-cpp revision and file names for OSX arm64 build.
163-
if: ${{ matrix.platform == 'osx' && matrix.arch == 'arm64' }}
155+
- name: Compile Extension - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
164156
run: |
165-
cd godot-cpp
166-
git checkout e08ecdc28c5409cb5366027227e996c342dcee93
167-
rm -rf src/gen/
168-
rm -rf include/gen/
169-
mkdir bin
170-
ln -s libgodot-cpp.osx.debug.64.a bin/libgodot-cpp.osx.debug.arm64.a
171-
ln -s libgodot-cpp.osx.release.64.a bin/libgodot-cpp.osx.release.arm64.a
172-
173-
- name: Compilation ${{ matrix.platform }} - ${{ matrix.arch }} - godot-cpp
157+
scons target=debug generate_bindings=yes
158+
159+
- name: Compile GDNative - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
174160
run: |
175-
scons -C godot-cpp target=debug generate_bindings=yes
176-
scons -C godot-cpp target=release
161+
scons target=debug generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3
177162
178-
- name: Compilation ${{ matrix.platform }} - ${{ matrix.arch }} - webrtc-native
163+
- name: Compile Extension - release - ${{ matrix.platform }} - ${{ matrix.arch }}
179164
run: |
180-
scons target=debug
181165
scons target=release
182166
183-
- uses: actions/upload-artifact@v2
167+
- name: Compile GDNative - release ${{ matrix.platform }} - ${{ matrix.arch }}
168+
run: |
169+
scons target=release ${{ matrix.gdnative_flags }} godot_version=3
170+
171+
- uses: actions/upload-artifact@v3
184172
with:
185173
name: ${{ github.job }}-${{ matrix.platform }}-${{ matrix.arch }}
186174
path: bin/*
@@ -191,32 +179,54 @@ jobs:
191179
runs-on: "ubuntu-latest"
192180
steps:
193181
- uses: actions/checkout@v2
182+
with:
183+
submodules: recursive
194184

195-
- uses: actions/download-artifact@v2
185+
- uses: actions/download-artifact@v3
196186
with:
197187
path: artifacts
198188

189+
- name: Bundle licenses.
190+
run: |
191+
cp LICENSE artifacts/LICENSE.webrtc-native
192+
cp deps/libdatachannel/LICENSE artifacts/LICENSE.libdatachannel
193+
cp deps/openssl/LICENSE.txt artifacts/LICENSE.openssl
194+
cp deps/libdatachannel/deps/libjuice/LICENSE artifacts/LICENSE.libjuice
195+
cp deps/libdatachannel/deps/usrsctp/LICENSE.md artifacts/LICENSE.usrsctp
196+
cp deps/libdatachannel/deps/libsrtp/LICENSE artifacts/LICENSE.libsrtp
197+
cp deps/libdatachannel/deps/json/LICENSE.MIT artifacts/LICENSE.json
198+
cp deps/libdatachannel/deps/plog/LICENSE artifacts/LICENSE.plog
199+
199200
- name: Package artifacts for release
200201
run: |
201202
mkdir release
202203
cd release
203-
for name in webrtc webrtc_debug
204+
205+
ls -R
206+
207+
for version in extension gdnative
204208
do
205-
mkdir -p ${name}/lib/
206-
find ../artifacts -wholename "*/${name}/lib/*" | xargs cp -t ${name}/lib/
207-
find ../artifacts -wholename "*/${name}/${name}.tres" | head -n 1 | xargs cp -t ${name}/
209+
for name in webrtc webrtc_debug
210+
do
211+
destdir="${version}/${name}"
212+
mkdir -p ${destdir}/lib
213+
find ../artifacts -wholename "*/${destdir}/lib/*" | xargs cp -t ${destdir}/lib/
214+
find ../artifacts -wholename "*/${destdir}/${name}.tres" -or -wholename "*/${destdir}/${name}.gdextension" | head -n 1 | xargs cp -t ${destdir}/
215+
find ../artifacts -wholename "*/LICENSE*" | xargs cp -t ${destdir}/
216+
cd ${version}
217+
zip -r ../godot-${version}-${name}.zip ${name}
218+
cd ..
219+
done
208220
done
209221
210-
zip -r godot-webrtc-native-release.zip webrtc
211-
zip -r godot-webrtc-native-debug.zip webrtc_debug
212222
ls -R
213223
214-
- uses: actions/upload-artifact@v2
224+
- uses: actions/upload-artifact@v3
215225
with:
216-
name: godot-webrtc-native-debug.zip
217-
path: release/godot-webrtc-native-debug.zip
226+
name: godot-webrtc-extension
227+
path: release/*-extension-*.zip
218228

219-
- uses: actions/upload-artifact@v2
229+
- uses: actions/upload-artifact@v3
220230
with:
221-
name: godot-webrtc-native-release.zip
222-
path: release/godot-webrtc-native-release.zip
231+
name: godot-webrtc-gdnative
232+
path: release/*-gdnative-*.zip

.gitmodules

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
[submodule "godot-cpp-3.x"]
2+
path = godot-cpp-3.x
3+
url = https://github.com/godotengine/godot-cpp.git
14
[submodule "godot-cpp"]
25
path = godot-cpp
3-
url = https://github.com/GodotNativeTools/godot-cpp
6+
url = https://github.com/godotengine/godot-cpp.git
7+
[submodule "libdatachannel"]
8+
path = deps/libdatachannel
9+
url = https://github.com/paullouisageneau/libdatachannel.git
10+
[submodule "openssl"]
11+
path = deps/openssl
12+
url = https://github.com/openssl/openssl.git

0 commit comments

Comments
 (0)