Skip to content

Commit 1436024

Browse files
authored
Merge pull request #65 from Faless/bump/beta3
[Upstream] Update to Godot Beta 3
2 parents 1769730 + 690b31e commit 1436024

File tree

8 files changed

+125
-60
lines changed

8 files changed

+125
-60
lines changed

.github/workflows/build_release.yml

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
name: 🔧 Build -> Package 📦
22
on: [push, pull_request]
33

4+
env:
5+
# Only used for the cache key. Increment version to force clean build.
6+
GODOT_BASE_BRANCH: master
7+
48
jobs:
59
static-checks:
610
name: 📊 Static Checks (clang-format, black format, file format)
711
runs-on: ubuntu-20.04
812
steps:
913
- name: Checkout
10-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1115

1216
- name: Install dependencies
1317
run: |
@@ -42,48 +46,55 @@ jobs:
4246
gdnative_flags: 'android_arch=x86_64'
4347
sconsflags: ''
4448
os: 'ubuntu-20.04'
49+
cache-name: android-x86_64
4550
- platform: android
4651
arch: 'arm64'
4752
gdnative_flags: 'android_arch=arm64v8'
4853
sconsflags: ''
4954
os: 'ubuntu-20.04'
55+
cache-name: android-arm64
5056

5157
# iOS
5258
- platform: ios
5359
arch: 'x86_64'
5460
gdnative_flags: 'ios_arch=x86_64'
5561
sconsflags: 'ios_simulator=true'
56-
os: 'macos-latest'
62+
os: 'macos-11'
63+
cache-name: ios-x86_64-simulator
5764
- platform: ios
5865
arch: 'arm64'
5966
gdnative_flags: 'ios_arch=arm64'
6067
sconsflags: ''
6168
os: 'macos-11'
62-
69+
cache-name: ios-arm64
6370

6471
# Linux
6572
- platform: linux
6673
arch: 'x86_32'
6774
gdnative_flags: 'bits=32'
6875
sconsflags: ''
6976
os: 'ubuntu-20.04'
77+
cache-name: linux-x86_32
7078
- platform: linux
7179
arch: 'x86_64'
7280
gdnative_flags: 'bits=64'
7381
sconsflags: ''
7482
os: 'ubuntu-20.04'
83+
cache-name: linux-x86_64
7584

7685
# macOS
7786
- platform: macos
7887
arch: 'x86_64'
7988
gdnative_flags: 'macos_arch=x86_64 bits=64'
8089
sconsflags: ''
8190
os: 'macos-11'
91+
cache-name: macos-x86_64
8292
- platform: macos
8393
gdnative_flags: 'macos_arch=arm64 bits=64'
8494
arch: 'arm64'
8595
sconsflags: ''
8696
os: 'macos-11'
97+
cache-name: macos-arm64
8798

8899
# Windows
89100
- platform: windows
@@ -92,25 +103,34 @@ jobs:
92103
sconsflags: 'use_mingw=yes'
93104
os: 'ubuntu-20.04'
94105
msvc_arch: amd64_x86
106+
cache-name: win-x86_32
95107
- platform: windows
96108
arch: 'x86_64'
97109
gdnative_flags: 'bits=64'
98110
sconsflags: 'use_mingw=yes'
99111
os: 'ubuntu-20.04'
100112
msvc_arch: amd64
113+
cache-name: win-x86_64
101114

102115
env:
116+
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
103117
SCONSFLAGS: ${{ matrix.sconsflags }} platform=${{ matrix.platform }} arch=${{ matrix.arch }} --jobs=2
104118

105119
defaults:
106120
run:
107121
shell: bash
108122

109123
steps:
110-
- uses: actions/checkout@v2
124+
- uses: actions/checkout@v3
111125
with:
112126
submodules: recursive
113127

128+
- name: Setup Godot build cache
129+
uses: ./godot-cpp/.github/actions/godot-cache
130+
with:
131+
cache-name: ${{ matrix.cache-name }}
132+
continue-on-error: true
133+
114134
- name: Install Windows build dependencies
115135
if: ${{ matrix.platform == 'windows' }}
116136
run: |
@@ -129,7 +149,7 @@ jobs:
129149
sudo apt-get install build-essential gcc-multilib g++-multilib
130150
131151
- name: Set up Python 3.x
132-
uses: actions/setup-python@v2
152+
uses: actions/setup-python@v4
133153
with:
134154
python-version: '3.x'
135155
architecture: 'x64'
@@ -142,21 +162,17 @@ jobs:
142162
scons --version
143163
cmake --version
144164
145-
- name: Compile Extension - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
165+
- name: Compile Extension - template_debug - ${{ matrix.platform }} - ${{ matrix.arch }}
146166
run: |
147-
scons target=debug generate_bindings=yes
167+
scons target=template_debug generate_bindings=yes
148168
149-
- name: Compile GDNative - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
169+
- name: Compile Extension - template_release - ${{ matrix.platform }} - ${{ matrix.arch }}
150170
run: |
151-
scons target=debug generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3
152-
153-
- name: Compile Extension - release - ${{ matrix.platform }} - ${{ matrix.arch }}
154-
run: |
155-
scons target=release
171+
scons target=template_release
156172
157173
- name: Compile GDNative - release ${{ matrix.platform }} - ${{ matrix.arch }}
158174
run: |
159-
scons target=release ${{ matrix.gdnative_flags }} godot_version=3
175+
scons target=release generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3
160176
161177
- uses: actions/upload-artifact@v3
162178
with:
@@ -168,7 +184,7 @@ jobs:
168184
needs: build
169185
runs-on: "ubuntu-latest"
170186
steps:
171-
- uses: actions/checkout@v2
187+
- uses: actions/checkout@v3
172188
with:
173189
submodules: recursive
174190

@@ -188,28 +204,15 @@ jobs:
188204
cp deps/libdatachannel/deps/plog/LICENSE artifacts/LICENSE.plog
189205
190206
- name: Package artifacts for release
207+
env:
208+
DESTINATION: "release"
191209
run: |
192210
mkdir release
193-
cd release
194-
195-
ls -R
196-
197-
for version in extension gdnative
198-
do
199-
for name in webrtc webrtc_debug
200-
do
201-
destdir="${version}/${name}"
202-
mkdir -p ${destdir}/lib
203-
find ../artifacts -wholename "*/${destdir}/lib/*" | xargs cp -t ${destdir}/lib/
204-
find ../artifacts -wholename "*/${destdir}/${name}.tres" -or -wholename "*/${destdir}/${name}.gdextension" | head -n 1 | xargs cp -t ${destdir}/
205-
find ../artifacts -wholename "*/LICENSE*" | xargs cp -t ${destdir}/
206-
cd ${version}
207-
zip -r ../godot-${version}-${name}.zip ${name}
208-
cd ..
209-
done
210-
done
211-
212-
ls -R
211+
212+
VERSION="extension" TYPE="webrtc" ./misc/scripts/package_release.sh
213+
VERSION="gdnative" TYPE="webrtc" ./misc/scripts/package_release.sh
214+
215+
ls -R release
213216
214217
- uses: actions/upload-artifact@v3
215218
with:

SConstruct

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ if env["godot_version"] == "3":
2626
if "platform" in ARGUMENTS and ARGUMENTS["platform"] == "macos":
2727
ARGUMENTS["platform"] = "osx" # compatibility with old osx name
2828

29+
scons_cache_path = os.environ.get("SCONS_CACHE")
30+
if scons_cache_path is not None:
31+
CacheDir(scons_cache_path)
32+
Decider("MD5")
33+
2934
env = SConscript("godot-cpp-3.x/SConstruct")
3035

3136
# Patch base env
@@ -52,7 +57,7 @@ if env["godot_version"] == "3":
5257
if env["platform"] in ["windows", "linux"]:
5358
env["arch"] = "x86_32" if env["bits"] == "32" else "x86_64"
5459
env["arch_suffix"] = env["arch"]
55-
elif env["platform"] == "osx":
60+
elif env["platform"] == "macos":
5661
env["arch"] = env["macos_arch"]
5762
env["arch_suffix"] = env["arch"]
5863
elif env["platform"] == "ios":
@@ -66,6 +71,10 @@ if env["godot_version"] == "3":
6671
"x86_64": "x86_64",
6772
}[env["android_arch"]]
6873
env["arch_suffix"] = env["arch"]
74+
75+
target_compat = "template_" + env["target"]
76+
env["suffix"] = ".{}.{}.{}".format(env["platform"], target_compat, env["arch_suffix"])
77+
env["debug_symbols"] = False
6978
else:
7079
ARGUMENTS["ios_min_version"] = "11.0"
7180
env = SConscript("godot-cpp/SConstruct").Clone()
@@ -77,7 +86,10 @@ if env["platform"] == "windows" and env["use_mingw"]:
7786
opts.Update(env)
7887

7988
target = env["target"]
80-
result_path = os.path.join("bin", "gdnative" if env["godot_version"] == "3" else "extension", "webrtc" if env["target"] == "release" else "webrtc_debug")
89+
if env["godot_version"] == "3":
90+
result_path = os.path.join("bin", "gdnative", "webrtc" if env["target"] == "release" else "webrtc_debug")
91+
else:
92+
result_path = os.path.join("bin", "extension", "webrtc")
8193

8294
# Dependencies
8395
deps_source_dir = "deps"
@@ -88,13 +100,15 @@ env.Append(BUILDERS={
88100

89101
# SSL
90102
ssl = env.BuildOpenSSL(env.Dir(builders.get_ssl_build_dir(env)), env.Dir(builders.get_ssl_source_dir(env)))
103+
env.Depends(ssl, env.File("builders.py"))
91104

92105
env.Prepend(CPPPATH=[builders.get_ssl_include_dir(env)])
93106
env.Prepend(LIBPATH=[builders.get_ssl_build_dir(env)])
94107
env.Append(LIBS=[ssl])
95108

96109
# RTC
97110
rtc = env.BuildLibDataChannel(env.Dir(builders.get_rtc_build_dir(env)), [env.Dir(builders.get_rtc_source_dir(env))] + ssl)
111+
env.Depends(rtc, env.File("builders.py"))
98112

99113
env.Append(LIBPATH=[builders.get_rtc_build_dir(env)])
100114
env.Append(CPPPATH=[builders.get_rtc_include_dir(env)])
@@ -119,7 +133,7 @@ else:
119133
env.Depends(sources, [ssl, rtc])
120134

121135
# Make the shared library
122-
result_name = "webrtc_native.{}.{}.{}{}".format(env["platform"], env["target"], env["arch_suffix"], env["SHLIBSUFFIX"])
136+
result_name = "webrtc_native{}{}".format(env["suffix"], env["SHLIBSUFFIX"])
123137
env.Depends(sources, ssl)
124138

125139
if env["platform"] == "windows" and env["use_mingw"]:
@@ -129,12 +143,13 @@ library = env.SharedLibrary(target=os.path.join(result_path, "lib", result_name)
129143
Default(library)
130144

131145
# GDNativeLibrary
132-
gdnlib = "webrtc"
133-
if target != "release":
134-
gdnlib += "_debug"
135-
ext = ".tres" if env["godot_version"] == "3" else ".gdextension"
136-
extfile = env.Substfile(os.path.join(result_path, gdnlib + ext), "misc/webrtc" + ext, SUBST_DICT={
137-
"{GDNATIVE_PATH}": gdnlib,
138-
"{TARGET}": env["target"],
139-
})
146+
if env["godot_version"] == "3":
147+
gdnlib = "webrtc" if target != "debug" else "webrtc_debug"
148+
ext = ".tres"
149+
extfile = env.Substfile(os.path.join(result_path, gdnlib + ext), "misc/webrtc" + ext, SUBST_DICT={
150+
"{GDNATIVE_PATH}": gdnlib,
151+
"{TARGET}": "template_" + env["target"],
152+
})
153+
else:
154+
extfile = env.InstallAs(os.path.join(result_path, "webrtc.gdextension"), "misc/webrtc.gdextension")
140155
Default(extfile)

builders.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def get_deps_dir(env):
1111

1212

1313
def get_deps_build_dir(env):
14-
return get_deps_dir(env) + "/build/{}.{}.{}.dir".format(env["platform"], env["target"], env["arch_suffix"])
14+
return get_deps_dir(env) + "/build/build{}.{}.dir".format(env["suffix"], "RelWithDebInfo" if env["debug_symbols"] else "Release")
1515

1616

1717
def get_rtc_source_dir(env):
@@ -63,7 +63,7 @@ def ssl_action(target, source, env):
6363
"--prefix=%s" % install_dir,
6464
"--openssldir=%s" % install_dir,
6565
]
66-
if env["target"] == "debug":
66+
if env["debug_symbols"]:
6767
args.append("-d")
6868

6969
if env["platform"] != "windows":
@@ -163,7 +163,7 @@ def rtc_action(target, source, env):
163163
"-DOPENSSL_INCLUDE_DIR=%s" % get_ssl_include_dir(env),
164164
"-DOPENSSL_SSL_LIBRARY=%s/libssl.a" % get_ssl_build_dir(env),
165165
"-DOPENSSL_CRYPTO_LIBRARY=%s/libcrypto.a" % get_ssl_build_dir(env),
166-
"-DCMAKE_BUILD_TYPE=%s" % ("Release" if env["target"] == "release" else "Debug"),
166+
"-DCMAKE_BUILD_TYPE=%s" % ("RelWithDebInfo" if env["debug_symbols"] else "Release"),
167167
]
168168
if env["platform"] == "android":
169169
abi = {

godot-cpp

Submodule godot-cpp updated 94 files

misc/scripts/package_release.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -x
5+
6+
ARTIFACTS=${ARTIFACTS:-"artifacts"}
7+
DESTINATION=${DESTIONATION:-"release"}
8+
VERSION=${VERSION:-"extension"}
9+
TYPE=${TYPE:-"webrtc"}
10+
11+
mkdir -p ${DESTINATION}
12+
ls -R ${DESTINATION}
13+
14+
DESTDIR="${DESTINATION}/${VERSION}/${TYPE}"
15+
16+
mkdir -p ${DESTDIR}/lib
17+
18+
find "${ARTIFACTS}" -wholename "*/${VERSION}/${TYPE}/lib/*" | xargs cp -t "${DESTDIR}/lib/"
19+
find "${ARTIFACTS}" -wholename "*/LICENSE*" | xargs cp -t "${DESTDIR}/"
20+
21+
if [ $VERSION = "extension" ]; then
22+
find "${ARTIFACTS}" -wholename "*/${VERSION}/${TYPE}/${TYPE}.gdextension" | head -n 1 | xargs cp -t "${DESTDIR}/"
23+
else
24+
find "${ARTIFACTS}" -wholename "*/${VERSION}/${TYPE}/${TYPE}.tres" | head -n 1 | xargs cp -t "${DESTDIR}/"
25+
fi
26+
27+
CURDIR=$(pwd)
28+
cd "${DESTINATION}/${VERSION}"
29+
zip -r ../godot-${VERSION}-${TYPE}.zip ${TYPE}
30+
cd "$CURDIR"
31+
32+
ls -R ${DESTINATION}

misc/webrtc.gdextension

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,24 @@ entry_symbol = "webrtc_extension_init"
44

55
[libraries]
66

7-
linux.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_64.so"
8-
linux.x86_32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_32.so"
9-
osx.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.osx.{TARGET}.x86_64.dylib"
10-
osx.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.osx.{TARGET}.arm64.dylib"
11-
windows.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_64.dll"
12-
windows.x86_32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_32.dll"
13-
android.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.arm64.so"
14-
android.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.x86_64.so"
15-
ios.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.arm64.dylib"
16-
ios.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.x86_64.simulator.dylib"
7+
linux.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.linux.template_debug.x86_64.so"
8+
linux.debug.x86_32 = "res://webrtc/lib/libwebrtc_native.linux.template_debug.x86_32.so"
9+
osx.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.osx.template_debug.x86_64.dylib"
10+
osx.debug.arm64 = "res://webrtc/lib/libwebrtc_native.osx.template_debug.arm64.dylib"
11+
windows.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.windows.template_debug.x86_64.dll"
12+
windows.debug.x86_32 = "res://webrtc/lib/libwebrtc_native.windows.template_debug.x86_32.dll"
13+
android.debug.arm64 = "res://webrtc/lib/libwebrtc_native.android.template_debug.arm64.so"
14+
android.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.android.template_debug.x86_64.so"
15+
ios.debug.arm64 = "res://webrtc/lib/libwebrtc_native.ios.template_debug.arm64.dylib"
16+
ios.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.ios.template_debug.x86_64.simulator.dylib"
17+
18+
linux.release.x86_64 = "res://webrtc/lib/libwebrtc_native.linux.template_release.x86_64.so"
19+
linux.release.x86_32 = "res://webrtc/lib/libwebrtc_native.linux.template_release.x86_32.so"
20+
osx.release.x86_64 = "res://webrtc/lib/libwebrtc_native.osx.template_release.x86_64.dylib"
21+
osx.release.arm64 = "res://webrtc/lib/libwebrtc_native.osx.template_release.arm64.dylib"
22+
windows.release.x86_64 = "res://webrtc/lib/libwebrtc_native.windows.template_release.x86_64.dll"
23+
windows.release.x86_32 = "res://webrtc/lib/libwebrtc_native.windows.template_release.x86_32.dll"
24+
android.release.arm64 = "res://webrtc/lib/libwebrtc_native.android.template_release.arm64.so"
25+
android.release.x86_64 = "res://webrtc/lib/libwebrtc_native.android.template_release.x86_64.so"
26+
ios.release.arm64 = "res://webrtc/lib/libwebrtc_native.ios.template_release.arm64.dylib"
27+
ios.release.x86_64 = "res://webrtc/lib/libwebrtc_native.ios.template_release.x86_64.simulator.dylib"

src/WebRTCLibDataChannel.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
#define GDCLASS(arg1, arg2) GODOT_CLASS(arg1, arg2)
4141
#endif
4242
#else
43+
#include <godot_cpp/core/binder_common.hpp>
44+
4345
#include <godot_cpp/classes/global_constants_binds.hpp>
4446
#include <godot_cpp/classes/web_rtc_data_channel_extension.hpp>
4547
#endif

0 commit comments

Comments
 (0)