Skip to content

Commit 690b31e

Browse files
committed
[Upstream] Update to Godot beta 3.
Update build targets. Move release script out of CI yaml. Disable debug CI builds for Godot 3.x since they are mostly used for debugging the extension itself.
1 parent 9b0a5d8 commit 690b31e

File tree

8 files changed

+97
-57
lines changed

8 files changed

+97
-57
lines changed

.github/workflows/build_release.yml

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
arch: 'x86_64'
6060
gdnative_flags: 'ios_arch=x86_64'
6161
sconsflags: 'ios_simulator=true'
62-
os: 'macos-latest'
62+
os: 'macos-11'
6363
cache-name: ios-x86_64-simulator
6464
- platform: ios
6565
arch: 'arm64'
@@ -162,21 +162,17 @@ jobs:
162162
scons --version
163163
cmake --version
164164
165-
- name: Compile Extension - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
166-
run: |
167-
scons target=debug generate_bindings=yes
168-
169-
- name: Compile GDNative - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
165+
- name: Compile Extension - template_debug - ${{ matrix.platform }} - ${{ matrix.arch }}
170166
run: |
171-
scons target=debug generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3
167+
scons target=template_debug generate_bindings=yes
172168
173-
- name: Compile Extension - release - ${{ matrix.platform }} - ${{ matrix.arch }}
169+
- name: Compile Extension - template_release - ${{ matrix.platform }} - ${{ matrix.arch }}
174170
run: |
175-
scons target=release
171+
scons target=template_release
176172
177173
- name: Compile GDNative - release ${{ matrix.platform }} - ${{ matrix.arch }}
178174
run: |
179-
scons target=release ${{ matrix.gdnative_flags }} godot_version=3
175+
scons target=release generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3
180176
181177
- uses: actions/upload-artifact@v3
182178
with:
@@ -208,28 +204,15 @@ jobs:
208204
cp deps/libdatachannel/deps/plog/LICENSE artifacts/LICENSE.plog
209205
210206
- name: Package artifacts for release
207+
env:
208+
DESTINATION: "release"
211209
run: |
212210
mkdir release
213-
cd release
214-
215-
ls -R
216-
217-
for version in extension gdnative
218-
do
219-
for name in webrtc webrtc_debug
220-
do
221-
destdir="${version}/${name}"
222-
mkdir -p ${destdir}/lib
223-
find ../artifacts -wholename "*/${destdir}/lib/*" | xargs cp -t ${destdir}/lib/
224-
find ../artifacts -wholename "*/${destdir}/${name}.tres" -or -wholename "*/${destdir}/${name}.gdextension" | head -n 1 | xargs cp -t ${destdir}/
225-
find ../artifacts -wholename "*/LICENSE*" | xargs cp -t ${destdir}/
226-
cd ${version}
227-
zip -r ../godot-${version}-${name}.zip ${name}
228-
cd ..
229-
done
230-
done
231-
232-
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
233216
234217
- uses: actions/upload-artifact@v3
235218
with:

SConstruct

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ 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-
env = SConscript("godot-cpp-3.x/SConstruct")
30-
3129
scons_cache_path = os.environ.get("SCONS_CACHE")
3230
if scons_cache_path is not None:
3331
CacheDir(scons_cache_path)
3432
Decider("MD5")
3533

34+
env = SConscript("godot-cpp-3.x/SConstruct")
35+
3636
# Patch base env
3737
replace_flags(env["CCFLAGS"], {
3838
"-mios-simulator-version-min=10.0": "-mios-simulator-version-min=11.0",
@@ -57,7 +57,7 @@ if env["godot_version"] == "3":
5757
if env["platform"] in ["windows", "linux"]:
5858
env["arch"] = "x86_32" if env["bits"] == "32" else "x86_64"
5959
env["arch_suffix"] = env["arch"]
60-
elif env["platform"] == "osx":
60+
elif env["platform"] == "macos":
6161
env["arch"] = env["macos_arch"]
6262
env["arch_suffix"] = env["arch"]
6363
elif env["platform"] == "ios":
@@ -71,6 +71,10 @@ if env["godot_version"] == "3":
7171
"x86_64": "x86_64",
7272
}[env["android_arch"]]
7373
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
7478
else:
7579
ARGUMENTS["ios_min_version"] = "11.0"
7680
env = SConscript("godot-cpp/SConstruct").Clone()
@@ -82,7 +86,10 @@ if env["platform"] == "windows" and env["use_mingw"]:
8286
opts.Update(env)
8387

8488
target = env["target"]
85-
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")
8693

8794
# Dependencies
8895
deps_source_dir = "deps"
@@ -93,13 +100,15 @@ env.Append(BUILDERS={
93100

94101
# SSL
95102
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"))
96104

97105
env.Prepend(CPPPATH=[builders.get_ssl_include_dir(env)])
98106
env.Prepend(LIBPATH=[builders.get_ssl_build_dir(env)])
99107
env.Append(LIBS=[ssl])
100108

101109
# RTC
102110
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"))
103112

104113
env.Append(LIBPATH=[builders.get_rtc_build_dir(env)])
105114
env.Append(CPPPATH=[builders.get_rtc_include_dir(env)])
@@ -124,7 +133,7 @@ else:
124133
env.Depends(sources, [ssl, rtc])
125134

126135
# Make the shared library
127-
result_name = "webrtc_native.{}.{}.{}{}".format(env["platform"], env["target"], env["arch_suffix"], env["SHLIBSUFFIX"])
136+
result_name = "webrtc_native{}{}".format(env["suffix"], env["SHLIBSUFFIX"])
128137
env.Depends(sources, ssl)
129138

130139
if env["platform"] == "windows" and env["use_mingw"]:
@@ -134,12 +143,13 @@ library = env.SharedLibrary(target=os.path.join(result_path, "lib", result_name)
134143
Default(library)
135144

136145
# GDNativeLibrary
137-
gdnlib = "webrtc"
138-
if target != "release":
139-
gdnlib += "_debug"
140-
ext = ".tres" if env["godot_version"] == "3" else ".gdextension"
141-
extfile = env.Substfile(os.path.join(result_path, gdnlib + ext), "misc/webrtc" + ext, SUBST_DICT={
142-
"{GDNATIVE_PATH}": gdnlib,
143-
"{TARGET}": env["target"],
144-
})
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")
145155
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

src/WebRTCLibPeerConnection.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_peer_connection_extension.hpp>
4547
#endif

0 commit comments

Comments
 (0)