Skip to content

Commit

Permalink
Merge pull request #65 from Faless/bump/beta3
Browse files Browse the repository at this point in the history
[Upstream] Update to Godot Beta 3
  • Loading branch information
Faless committed Oct 17, 2022
2 parents 1769730 + 690b31e commit 1436024
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 60 deletions.
73 changes: 38 additions & 35 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: 🔧 Build -> Package 📦
on: [push, pull_request]

env:
# Only used for the cache key. Increment version to force clean build.
GODOT_BASE_BRANCH: master

jobs:
static-checks:
name: 📊 Static Checks (clang-format, black format, file format)
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install dependencies
run: |
Expand Down Expand Up @@ -42,48 +46,55 @@ jobs:
gdnative_flags: 'android_arch=x86_64'
sconsflags: ''
os: 'ubuntu-20.04'
cache-name: android-x86_64
- platform: android
arch: 'arm64'
gdnative_flags: 'android_arch=arm64v8'
sconsflags: ''
os: 'ubuntu-20.04'
cache-name: android-arm64

# iOS
- platform: ios
arch: 'x86_64'
gdnative_flags: 'ios_arch=x86_64'
sconsflags: 'ios_simulator=true'
os: 'macos-latest'
os: 'macos-11'
cache-name: ios-x86_64-simulator
- platform: ios
arch: 'arm64'
gdnative_flags: 'ios_arch=arm64'
sconsflags: ''
os: 'macos-11'

cache-name: ios-arm64

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

# macOS
- platform: macos
arch: 'x86_64'
gdnative_flags: 'macos_arch=x86_64 bits=64'
sconsflags: ''
os: 'macos-11'
cache-name: macos-x86_64
- platform: macos
gdnative_flags: 'macos_arch=arm64 bits=64'
arch: 'arm64'
sconsflags: ''
os: 'macos-11'
cache-name: macos-arm64

# Windows
- platform: windows
Expand All @@ -92,25 +103,34 @@ jobs:
sconsflags: 'use_mingw=yes'
os: 'ubuntu-20.04'
msvc_arch: amd64_x86
cache-name: win-x86_32
- platform: windows
arch: 'x86_64'
gdnative_flags: 'bits=64'
sconsflags: 'use_mingw=yes'
os: 'ubuntu-20.04'
msvc_arch: amd64
cache-name: win-x86_64

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

defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup Godot build cache
uses: ./godot-cpp/.github/actions/godot-cache
with:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true

- name: Install Windows build dependencies
if: ${{ matrix.platform == 'windows' }}
run: |
Expand All @@ -129,7 +149,7 @@ jobs:
sudo apt-get install build-essential gcc-multilib g++-multilib
- name: Set up Python 3.x
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
architecture: 'x64'
Expand All @@ -142,21 +162,17 @@ jobs:
scons --version
cmake --version
- name: Compile Extension - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
- name: Compile Extension - template_debug - ${{ matrix.platform }} - ${{ matrix.arch }}
run: |
scons target=debug generate_bindings=yes
scons target=template_debug generate_bindings=yes
- name: Compile GDNative - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
- name: Compile Extension - template_release - ${{ matrix.platform }} - ${{ matrix.arch }}
run: |
scons target=debug generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3
- name: Compile Extension - release - ${{ matrix.platform }} - ${{ matrix.arch }}
run: |
scons target=release
scons target=template_release
- name: Compile GDNative - release ${{ matrix.platform }} - ${{ matrix.arch }}
run: |
scons target=release ${{ matrix.gdnative_flags }} godot_version=3
scons target=release generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3
- uses: actions/upload-artifact@v3
with:
Expand All @@ -168,7 +184,7 @@ jobs:
needs: build
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

Expand All @@ -188,28 +204,15 @@ jobs:
cp deps/libdatachannel/deps/plog/LICENSE artifacts/LICENSE.plog
- name: Package artifacts for release
env:
DESTINATION: "release"
run: |
mkdir release
cd release
ls -R
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
ls -R
VERSION="extension" TYPE="webrtc" ./misc/scripts/package_release.sh
VERSION="gdnative" TYPE="webrtc" ./misc/scripts/package_release.sh
ls -R release
- uses: actions/upload-artifact@v3
with:
Expand Down
37 changes: 26 additions & 11 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ if env["godot_version"] == "3":
if "platform" in ARGUMENTS and ARGUMENTS["platform"] == "macos":
ARGUMENTS["platform"] = "osx" # compatibility with old osx name

scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path is not None:
CacheDir(scons_cache_path)
Decider("MD5")

env = SConscript("godot-cpp-3.x/SConstruct")

# Patch base env
Expand All @@ -52,7 +57,7 @@ if env["godot_version"] == "3":
if env["platform"] in ["windows", "linux"]:
env["arch"] = "x86_32" if env["bits"] == "32" else "x86_64"
env["arch_suffix"] = env["arch"]
elif env["platform"] == "osx":
elif env["platform"] == "macos":
env["arch"] = env["macos_arch"]
env["arch_suffix"] = env["arch"]
elif env["platform"] == "ios":
Expand All @@ -66,6 +71,10 @@ if env["godot_version"] == "3":
"x86_64": "x86_64",
}[env["android_arch"]]
env["arch_suffix"] = env["arch"]

target_compat = "template_" + env["target"]
env["suffix"] = ".{}.{}.{}".format(env["platform"], target_compat, env["arch_suffix"])
env["debug_symbols"] = False
else:
ARGUMENTS["ios_min_version"] = "11.0"
env = SConscript("godot-cpp/SConstruct").Clone()
Expand All @@ -77,7 +86,10 @@ if env["platform"] == "windows" and env["use_mingw"]:
opts.Update(env)

target = env["target"]
result_path = os.path.join("bin", "gdnative" if env["godot_version"] == "3" else "extension", "webrtc" if env["target"] == "release" else "webrtc_debug")
if env["godot_version"] == "3":
result_path = os.path.join("bin", "gdnative", "webrtc" if env["target"] == "release" else "webrtc_debug")
else:
result_path = os.path.join("bin", "extension", "webrtc")

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

# SSL
ssl = env.BuildOpenSSL(env.Dir(builders.get_ssl_build_dir(env)), env.Dir(builders.get_ssl_source_dir(env)))
env.Depends(ssl, env.File("builders.py"))

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

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

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

# Make the shared library
result_name = "webrtc_native.{}.{}.{}{}".format(env["platform"], env["target"], env["arch_suffix"], env["SHLIBSUFFIX"])
result_name = "webrtc_native{}{}".format(env["suffix"], env["SHLIBSUFFIX"])
env.Depends(sources, ssl)

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

# GDNativeLibrary
gdnlib = "webrtc"
if target != "release":
gdnlib += "_debug"
ext = ".tres" if env["godot_version"] == "3" else ".gdextension"
extfile = env.Substfile(os.path.join(result_path, gdnlib + ext), "misc/webrtc" + ext, SUBST_DICT={
"{GDNATIVE_PATH}": gdnlib,
"{TARGET}": env["target"],
})
if env["godot_version"] == "3":
gdnlib = "webrtc" if target != "debug" else "webrtc_debug"
ext = ".tres"
extfile = env.Substfile(os.path.join(result_path, gdnlib + ext), "misc/webrtc" + ext, SUBST_DICT={
"{GDNATIVE_PATH}": gdnlib,
"{TARGET}": "template_" + env["target"],
})
else:
extfile = env.InstallAs(os.path.join(result_path, "webrtc.gdextension"), "misc/webrtc.gdextension")
Default(extfile)
6 changes: 3 additions & 3 deletions builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def get_deps_dir(env):


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


def get_rtc_source_dir(env):
Expand Down Expand Up @@ -63,7 +63,7 @@ def ssl_action(target, source, env):
"--prefix=%s" % install_dir,
"--openssldir=%s" % install_dir,
]
if env["target"] == "debug":
if env["debug_symbols"]:
args.append("-d")

if env["platform"] != "windows":
Expand Down Expand Up @@ -163,7 +163,7 @@ def rtc_action(target, source, env):
"-DOPENSSL_INCLUDE_DIR=%s" % get_ssl_include_dir(env),
"-DOPENSSL_SSL_LIBRARY=%s/libssl.a" % get_ssl_build_dir(env),
"-DOPENSSL_CRYPTO_LIBRARY=%s/libcrypto.a" % get_ssl_build_dir(env),
"-DCMAKE_BUILD_TYPE=%s" % ("Release" if env["target"] == "release" else "Debug"),
"-DCMAKE_BUILD_TYPE=%s" % ("RelWithDebInfo" if env["debug_symbols"] else "Release"),
]
if env["platform"] == "android":
abi = {
Expand Down
2 changes: 1 addition & 1 deletion godot-cpp
Submodule godot-cpp updated 94 files
+91 −20 .clang-format
+11 −43 .github/workflows/ci.yml
+54 −0 .github/workflows/static_checks.yml
+3 −0 .gitignore
+12 −12 Makefile
+28 −11 SConstruct
+53 −20 binding_generator.py
+1,798 −699 godot-headers/extension_api.json
+5 −6 godot-headers/godot/gdnative_interface.h
+3 −3 include/godot_cpp/classes/ref.hpp
+7 −7 include/godot_cpp/classes/wrapped.hpp
+6 −3 include/godot_cpp/core/binder_common.hpp
+3 −3 include/godot_cpp/core/builtin_ptrcall.hpp
+12 −8 include/godot_cpp/core/class_db.hpp
+7 −3 include/godot_cpp/core/defs.hpp
+3 −3 include/godot_cpp/core/engine_ptrcall.hpp
+3 −3 include/godot_cpp/core/error_macros.hpp
+25 −4 include/godot_cpp/core/math.hpp
+3 −3 include/godot_cpp/core/memory.hpp
+4 −4 include/godot_cpp/core/method_bind.hpp
+3 −3 include/godot_cpp/core/method_ptrcall.hpp
+3 −3 include/godot_cpp/core/mutex_lock.hpp
+1 −1 include/godot_cpp/core/object.hpp
+1 −1 include/godot_cpp/core/property_info.hpp
+2 −2 include/godot_cpp/core/type_info.hpp
+3 −3 include/godot_cpp/godot.hpp
+3 −3 include/godot_cpp/templates/cowdata.hpp
+3 −3 include/godot_cpp/templates/hash_map.hpp
+3 −3 include/godot_cpp/templates/hash_set.hpp
+3 −3 include/godot_cpp/templates/hashfuncs.hpp
+3 −3 include/godot_cpp/templates/list.hpp
+3 −3 include/godot_cpp/templates/pair.hpp
+3 −3 include/godot_cpp/templates/rb_map.hpp
+3 −3 include/godot_cpp/templates/rb_set.hpp
+3 −3 include/godot_cpp/templates/rid_owner.hpp
+3 −3 include/godot_cpp/templates/safe_refcount.hpp
+3 −3 include/godot_cpp/templates/search_array.hpp
+4 −4 include/godot_cpp/templates/self_list.hpp
+3 −3 include/godot_cpp/templates/sort_array.hpp
+3 −3 include/godot_cpp/templates/spin_lock.hpp
+3 −3 include/godot_cpp/templates/thread_work_pool.hpp
+3 −3 include/godot_cpp/templates/vector.hpp
+3 −3 include/godot_cpp/templates/vmap.hpp
+3 −3 include/godot_cpp/templates/vset.hpp
+80 −48 include/godot_cpp/variant/aabb.hpp
+97 −113 include/godot_cpp/variant/basis.hpp
+3 −3 include/godot_cpp/variant/char_string.hpp
+3 −3 include/godot_cpp/variant/char_utils.hpp
+46 −46 include/godot_cpp/variant/color.hpp
+24 −22 include/godot_cpp/variant/plane.hpp
+19 −23 include/godot_cpp/variant/projection.hpp
+52 −59 include/godot_cpp/variant/quaternion.hpp
+65 −35 include/godot_cpp/variant/rect2.hpp
+44 −24 include/godot_cpp/variant/rect2i.hpp
+47 −45 include/godot_cpp/variant/transform2d.hpp
+86 −50 include/godot_cpp/variant/transform3d.hpp
+3 −3 include/godot_cpp/variant/typed_array.hpp
+3 −3 include/godot_cpp/variant/ucaps.hpp
+3 −3 include/godot_cpp/variant/variant.hpp
+12 −10 include/godot_cpp/variant/vector2.hpp
+4 −7 include/godot_cpp/variant/vector2i.hpp
+27 −16 include/godot_cpp/variant/vector3.hpp
+4 −10 include/godot_cpp/variant/vector3i.hpp
+39 −38 include/godot_cpp/variant/vector4.hpp
+7 −11 include/godot_cpp/variant/vector4i.hpp
+1 −2 misc/scripts/clang_format.sh
+0 −23 misc/scripts/file_format.sh
+60 −0 misc/scripts/header_guards.sh
+11 −0 misc/scripts/mypy.ini
+6 −0 misc/scripts/mypy_check.sh
+38 −29 src/core/class_db.cpp
+2 −1 src/godot.cpp
+49 −13 src/variant/aabb.cpp
+401 −490 src/variant/basis.cpp
+128 −118 src/variant/color.cpp
+33 −5 src/variant/plane.cpp
+127 −120 src/variant/projection.cpp
+163 −43 src/variant/quaternion.cpp
+11 −1 src/variant/rect2.cpp
+1 −1 src/variant/rect2i.cpp
+69 −26 src/variant/transform2d.cpp
+44 −43 src/variant/transform3d.cpp
+32 −32 src/variant/variant.cpp
+4 −0 src/variant/vector2.cpp
+25 −15 src/variant/vector3.cpp
+0 −10 src/variant/vector3i.cpp
+98 −28 src/variant/vector4.cpp
+7 −15 src/variant/vector4i.cpp
+1 −3 test/SConstruct
+2 −2 test/demo/bin/libgdexample.osx.template_debug.framework/Resources/Info.plist
+2 −2 test/demo/bin/libgdexample.osx.template_release.framework/Resources/Info.plist
+12 −12 test/demo/example.gdextension
+1 −1 test/demo/main.gd
+50 −19 tools/targets.py
32 changes: 32 additions & 0 deletions misc/scripts/package_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -e
set -x

ARTIFACTS=${ARTIFACTS:-"artifacts"}
DESTINATION=${DESTIONATION:-"release"}
VERSION=${VERSION:-"extension"}
TYPE=${TYPE:-"webrtc"}

mkdir -p ${DESTINATION}
ls -R ${DESTINATION}

DESTDIR="${DESTINATION}/${VERSION}/${TYPE}"

mkdir -p ${DESTDIR}/lib

find "${ARTIFACTS}" -wholename "*/${VERSION}/${TYPE}/lib/*" | xargs cp -t "${DESTDIR}/lib/"
find "${ARTIFACTS}" -wholename "*/LICENSE*" | xargs cp -t "${DESTDIR}/"

if [ $VERSION = "extension" ]; then
find "${ARTIFACTS}" -wholename "*/${VERSION}/${TYPE}/${TYPE}.gdextension" | head -n 1 | xargs cp -t "${DESTDIR}/"
else
find "${ARTIFACTS}" -wholename "*/${VERSION}/${TYPE}/${TYPE}.tres" | head -n 1 | xargs cp -t "${DESTDIR}/"
fi

CURDIR=$(pwd)
cd "${DESTINATION}/${VERSION}"
zip -r ../godot-${VERSION}-${TYPE}.zip ${TYPE}
cd "$CURDIR"

ls -R ${DESTINATION}
31 changes: 21 additions & 10 deletions misc/webrtc.gdextension
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,24 @@ entry_symbol = "webrtc_extension_init"

[libraries]

linux.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_64.so"
linux.x86_32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_32.so"
osx.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.osx.{TARGET}.x86_64.dylib"
osx.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.osx.{TARGET}.arm64.dylib"
windows.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_64.dll"
windows.x86_32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_32.dll"
android.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.arm64.so"
android.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.x86_64.so"
ios.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.arm64.dylib"
ios.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.x86_64.simulator.dylib"
linux.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.linux.template_debug.x86_64.so"
linux.debug.x86_32 = "res://webrtc/lib/libwebrtc_native.linux.template_debug.x86_32.so"
osx.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.osx.template_debug.x86_64.dylib"
osx.debug.arm64 = "res://webrtc/lib/libwebrtc_native.osx.template_debug.arm64.dylib"
windows.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.windows.template_debug.x86_64.dll"
windows.debug.x86_32 = "res://webrtc/lib/libwebrtc_native.windows.template_debug.x86_32.dll"
android.debug.arm64 = "res://webrtc/lib/libwebrtc_native.android.template_debug.arm64.so"
android.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.android.template_debug.x86_64.so"
ios.debug.arm64 = "res://webrtc/lib/libwebrtc_native.ios.template_debug.arm64.dylib"
ios.debug.x86_64 = "res://webrtc/lib/libwebrtc_native.ios.template_debug.x86_64.simulator.dylib"

linux.release.x86_64 = "res://webrtc/lib/libwebrtc_native.linux.template_release.x86_64.so"
linux.release.x86_32 = "res://webrtc/lib/libwebrtc_native.linux.template_release.x86_32.so"
osx.release.x86_64 = "res://webrtc/lib/libwebrtc_native.osx.template_release.x86_64.dylib"
osx.release.arm64 = "res://webrtc/lib/libwebrtc_native.osx.template_release.arm64.dylib"
windows.release.x86_64 = "res://webrtc/lib/libwebrtc_native.windows.template_release.x86_64.dll"
windows.release.x86_32 = "res://webrtc/lib/libwebrtc_native.windows.template_release.x86_32.dll"
android.release.arm64 = "res://webrtc/lib/libwebrtc_native.android.template_release.arm64.so"
android.release.x86_64 = "res://webrtc/lib/libwebrtc_native.android.template_release.x86_64.so"
ios.release.arm64 = "res://webrtc/lib/libwebrtc_native.ios.template_release.arm64.dylib"
ios.release.x86_64 = "res://webrtc/lib/libwebrtc_native.ios.template_release.x86_64.simulator.dylib"
2 changes: 2 additions & 0 deletions src/WebRTCLibDataChannel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#define GDCLASS(arg1, arg2) GODOT_CLASS(arg1, arg2)
#endif
#else
#include <godot_cpp/core/binder_common.hpp>

#include <godot_cpp/classes/global_constants_binds.hpp>
#include <godot_cpp/classes/web_rtc_data_channel_extension.hpp>
#endif
Expand Down

0 comments on commit 1436024

Please sign in to comment.