mirror of
https://github.com/godotengine/webrtc-native.git
synced 2026-01-01 05:48:15 +03:00
Compare commits
83 Commits
1.0.0-beta
...
1.0.3-stab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf23e5e740 | ||
|
|
668d0250a7 | ||
|
|
121ed5664d | ||
|
|
67a378a667 | ||
|
|
023c42d3b3 | ||
|
|
6d96092f88 | ||
|
|
77969f68d9 | ||
|
|
a9d8ea2a1c | ||
|
|
6e2262b6c3 | ||
|
|
cb2be8723a | ||
|
|
d278661d76 | ||
|
|
552d696e0a | ||
|
|
6f4d8f5238 | ||
|
|
8040565b0e | ||
|
|
38c83f667d | ||
|
|
1de32aa9ea | ||
|
|
ed3771ced0 | ||
|
|
ac3bdb3613 | ||
|
|
931a7551f5 | ||
|
|
0771084b54 | ||
|
|
ae0dd0626a | ||
|
|
0be6b671e5 | ||
|
|
d96b43b7ee | ||
|
|
ec8cd5c0e4 | ||
|
|
b03099f7b4 | ||
|
|
85efdfd6ce | ||
|
|
32ae1d1195 | ||
|
|
54c8586235 | ||
|
|
f19011f2fb | ||
|
|
86c27ec7ef | ||
|
|
f2ee596bd9 | ||
|
|
61299ca4b7 | ||
|
|
df643250f5 | ||
|
|
45549e020f | ||
|
|
ee40730c20 | ||
|
|
8f7cb77f34 | ||
|
|
eb65d88cd4 | ||
|
|
e8de07dbb1 | ||
|
|
e34000653b | ||
|
|
826a736176 | ||
|
|
b7098e7496 | ||
|
|
6de604ffee | ||
|
|
f0af5f9982 | ||
|
|
fbe4e06b9f | ||
|
|
9a9fc0953b | ||
|
|
c6b6f7e18c | ||
|
|
00f952bcf1 | ||
|
|
d7032f7b85 | ||
|
|
c9a1efc7a0 | ||
|
|
5bc4b79435 | ||
|
|
b7b76dddab | ||
|
|
0b1c55ed83 | ||
|
|
093ac7d489 | ||
|
|
84e9d6dd37 | ||
|
|
a49a2b03e1 | ||
|
|
656d3a9964 | ||
|
|
2bc2a5d162 | ||
|
|
7176344056 | ||
|
|
7d260b1b32 | ||
|
|
0c10a7f3e3 | ||
|
|
40962dbe19 | ||
|
|
bdd9d50745 | ||
|
|
5348407de9 | ||
|
|
5002991511 | ||
|
|
0fc992e0d5 | ||
|
|
fbadff454c | ||
|
|
61a6d25c47 | ||
|
|
dfaad6f5ba | ||
|
|
35bdd5efa7 | ||
|
|
90aaa0b82e | ||
|
|
16f311844b | ||
|
|
dfb34df36e | ||
|
|
9715e73ae4 | ||
|
|
2e9a25bb39 | ||
|
|
6067addd96 | ||
|
|
a3fbd33464 | ||
|
|
d697901f81 | ||
|
|
3eb7d0aa3b | ||
|
|
ecec40f59e | ||
|
|
37a289addf | ||
|
|
1436024f59 | ||
|
|
690b31e7dd | ||
|
|
9b0a5d8b46 |
111
.clang-format
111
.clang-format
@@ -1,31 +1,40 @@
|
||||
# Commented out parameters are those with the same value as base LLVM style
|
||||
# Commented out parameters are those with the same value as base LLVM style.
|
||||
# We can uncomment them if we want to change their value, or enforce the
|
||||
# chosen value in case the base style changes (last sync: Clang 6.0.1).
|
||||
# chosen value in case the base style changes (last sync: Clang 14.0).
|
||||
---
|
||||
### General config, applies to all languages ###
|
||||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
# AlignConsecutiveAssignments: false
|
||||
# AlignConsecutiveDeclarations: false
|
||||
# AlignArrayOfStructures: None
|
||||
# AlignConsecutiveMacros: None
|
||||
# AlignConsecutiveAssignments: None
|
||||
# AlignConsecutiveBitFields: None
|
||||
# AlignConsecutiveDeclarations: None
|
||||
# AlignEscapedNewlines: Right
|
||||
# AlignOperands: true
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
# AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
# AllowShortBlocksOnASingleLine: false
|
||||
# AllowShortEnumsOnASingleLine: true
|
||||
# AllowShortBlocksOnASingleLine: Never
|
||||
# AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
# AllowShortIfStatementsOnASingleLine: false
|
||||
# AllowShortFunctionsOnASingleLine: All
|
||||
# AllowShortLambdasOnASingleLine: All
|
||||
# AllowShortIfStatementsOnASingleLine: Never
|
||||
# AllowShortLoopsOnASingleLine: false
|
||||
# AlwaysBreakAfterDefinitionReturnType: None
|
||||
# AlwaysBreakAfterReturnType: None
|
||||
# AlwaysBreakBeforeMultilineStrings: false
|
||||
# AlwaysBreakTemplateDeclarations: false
|
||||
# AlwaysBreakTemplateDeclarations: MultiLine
|
||||
# AttributeMacros:
|
||||
# - __capability
|
||||
# BinPackArguments: true
|
||||
# BinPackParameters: true
|
||||
# BraceWrapping:
|
||||
# AfterCaseLabel: false
|
||||
# AfterClass: false
|
||||
# AfterControlStatement: false
|
||||
# AfterControlStatement: Never
|
||||
# AfterEnum: false
|
||||
# AfterFunction: false
|
||||
# AfterNamespace: false
|
||||
@@ -35,32 +44,44 @@ AllowShortFunctionsOnASingleLine: Inline
|
||||
# AfterExternBlock: false
|
||||
# BeforeCatch: false
|
||||
# BeforeElse: false
|
||||
# BeforeLambdaBody: false
|
||||
# BeforeWhile: false
|
||||
# IndentBraces: false
|
||||
# SplitEmptyFunction: true
|
||||
# SplitEmptyRecord: true
|
||||
# SplitEmptyNamespace: true
|
||||
# BreakBeforeBinaryOperators: None
|
||||
# BreakBeforeConceptDeclarations: true
|
||||
# BreakBeforeBraces: Attach
|
||||
# BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: false
|
||||
# BreakInheritanceList: BeforeColon
|
||||
# BreakBeforeTernaryOperators: true
|
||||
# BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: AfterColon
|
||||
# BreakStringLiterals: true
|
||||
ColumnLimit: 0
|
||||
# CommentPragmas: '^ IWYU pragma:'
|
||||
# QualifierAlignment: Leave
|
||||
# CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
Cpp11BracedListStyle: false
|
||||
# DeriveLineEnding: true
|
||||
# DerivePointerAlignment: false
|
||||
# DisableFormat: false
|
||||
# EmptyLineAfterAccessModifier: Never
|
||||
# EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
# ExperimentalAutoDetectBinPacking: false
|
||||
# PackConstructorInitializers: BinPack
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
# AllowAllConstructorInitializersOnNextLine: true
|
||||
# FixNamespaceComments: true
|
||||
# ForEachMacros:
|
||||
# - foreach
|
||||
# - Q_FOREACH
|
||||
# - BOOST_FOREACH
|
||||
# IfMacros:
|
||||
# - KJ_IF_MAYBE
|
||||
# IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '".*"'
|
||||
@@ -70,13 +91,21 @@ IncludeCategories:
|
||||
- Regex: '^<.*'
|
||||
Priority: 3
|
||||
# IncludeIsMainRegex: '(Test)?$'
|
||||
# IncludeIsMainSourceRegex: ''
|
||||
# IndentAccessModifiers: false
|
||||
IndentCaseLabels: true
|
||||
# IndentCaseBlocks: false
|
||||
# IndentGotoLabels: true
|
||||
# IndentPPDirectives: None
|
||||
# IndentExternBlock: AfterExternBlock
|
||||
# IndentRequires: false
|
||||
IndentWidth: 4
|
||||
# IndentWrappedFunctionNames: false
|
||||
# InsertTrailingCommas: None
|
||||
# JavaScriptQuotes: Leave
|
||||
# JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
# LambdaBodyIndentation: Signature
|
||||
# MacroBlockBegin: ''
|
||||
# MacroBlockEnd: ''
|
||||
# MaxEmptyLinesToKeep: 1
|
||||
@@ -85,39 +114,81 @@ KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
# PenaltyBreakBeforeFirstCallParameter: 19
|
||||
# PenaltyBreakComment: 300
|
||||
# PenaltyBreakFirstLessLess: 120
|
||||
# PenaltyBreakOpenParenthesis: 0
|
||||
# PenaltyBreakString: 1000
|
||||
# PenaltyBreakTemplateDeclaration: 10
|
||||
# PenaltyExcessCharacter: 1000000
|
||||
# PenaltyReturnTypeOnItsOwnLine: 60
|
||||
# PenaltyIndentedWhitespace: 0
|
||||
# PointerAlignment: Right
|
||||
# RawStringFormats:
|
||||
# - Delimiter: pb
|
||||
# Language: TextProto
|
||||
# BasedOnStyle: google
|
||||
# PPIndentWidth: -1
|
||||
# ReferenceAlignment: Pointer
|
||||
# ReflowComments: true
|
||||
# SortIncludes: true
|
||||
# RemoveBracesLLVM: false
|
||||
# SeparateDefinitionBlocks: Leave
|
||||
# ShortNamespaceLines: 1
|
||||
# SortIncludes: CaseSensitive
|
||||
# SortJavaStaticImport: Before
|
||||
# SortUsingDeclarations: true
|
||||
# SpaceAfterCStyleCast: false
|
||||
# SpaceAfterLogicalNot: false
|
||||
# SpaceAfterTemplateKeyword: true
|
||||
# SpaceBeforeAssignmentOperators: true
|
||||
# SpaceBeforeCaseColon: false
|
||||
# SpaceBeforeCpp11BracedList: false
|
||||
# SpaceBeforeCtorInitializerColon: true
|
||||
# SpaceBeforeInheritanceColon: true
|
||||
# SpaceBeforeParens: ControlStatements
|
||||
# SpaceBeforeParensOptions:
|
||||
# AfterControlStatements: true
|
||||
# AfterForeachMacros: true
|
||||
# AfterFunctionDefinitionName: false
|
||||
# AfterFunctionDeclarationName: false
|
||||
# AfterIfMacros: true
|
||||
# AfterOverloadedOperator: false
|
||||
# BeforeNonEmptyParentheses: false
|
||||
# SpaceAroundPointerQualifiers: Default
|
||||
# SpaceBeforeRangeBasedForLoopColon: true
|
||||
# SpaceInEmptyBlock: false
|
||||
# SpaceInEmptyParentheses: false
|
||||
# SpacesBeforeTrailingComments: 1
|
||||
# SpacesInAngles: false
|
||||
# SpacesInAngles: Never
|
||||
# SpacesInConditionalStatement: false
|
||||
# SpacesInContainerLiterals: true
|
||||
# SpacesInCStyleCastParentheses: false
|
||||
## Godot TODO: We'll want to use a min of 1, but we need to see how to fix
|
||||
## our comment capitalization at the same time.
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 0
|
||||
Maximum: -1
|
||||
# SpacesInParentheses: false
|
||||
# SpacesInSquareBrackets: false
|
||||
# SpaceBeforeSquareBrackets: false
|
||||
# BitFieldColonSpacing: Both
|
||||
# StatementAttributeLikeMacros:
|
||||
# - Q_EMIT
|
||||
# StatementMacros:
|
||||
# - Q_UNUSED
|
||||
# - QT_REQUIRE_VERSION
|
||||
TabWidth: 4
|
||||
# UseCRLF: false
|
||||
UseTab: Always
|
||||
# WhitespaceSensitiveMacros:
|
||||
# - STRINGIZE
|
||||
# - PP_STRINGIZE
|
||||
# - BOOST_PP_STRINGIZE
|
||||
# - NS_SWIFT_NAME
|
||||
# - CF_SWIFT_NAME
|
||||
---
|
||||
### C++ specific config ###
|
||||
Language: Cpp
|
||||
Standard: Cpp11
|
||||
Standard: c++17
|
||||
---
|
||||
### ObjC specific config ###
|
||||
Language: ObjC
|
||||
Standard: Cpp11
|
||||
# ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 4
|
||||
# ObjCBreakBeforeNestedBlockParam: true
|
||||
# ObjCSpaceAfterProperty: false
|
||||
# ObjCSpaceBeforeProtocolList: true
|
||||
---
|
||||
|
||||
141
.github/workflows/build_release.yml
vendored
141
.github/workflows/build_release.yml
vendored
@@ -1,20 +1,29 @@
|
||||
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: |
|
||||
sudo apt-get install -qq dos2unix recode clang-format-11
|
||||
# Add clang repository (so we have clang-format-14)
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main"
|
||||
sudo apt-get update
|
||||
# Install required deps
|
||||
sudo apt-get install -qq dos2unix moreutils recode clang-format-14
|
||||
sudo update-alternatives --remove-all clang-format
|
||||
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-11 100
|
||||
sudo pip3 install black==20.8b1 pygments
|
||||
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-14 100
|
||||
sudo pip3 install black==22.3.0 pygments
|
||||
|
||||
- name: File formatting checks (file_format.sh)
|
||||
run: |
|
||||
@@ -42,48 +51,51 @@ 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'
|
||||
buildroot: 'i686'
|
||||
gdnative_flags: 'bits=32'
|
||||
sconsflags: ''
|
||||
os: 'ubuntu-20.04'
|
||||
cache-name: linux-x86_32
|
||||
- platform: linux
|
||||
arch: 'x86_64'
|
||||
buildroot: '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'
|
||||
- platform: macos
|
||||
gdnative_flags: 'macos_arch=arm64 bits=64'
|
||||
arch: 'arm64'
|
||||
arch: 'universal'
|
||||
gdnative_flags: 'macos_arch=universal bits=64'
|
||||
sconsflags: ''
|
||||
os: 'macos-11'
|
||||
cache-name: macos-universal
|
||||
|
||||
# Windows
|
||||
- platform: windows
|
||||
@@ -92,14 +104,17 @@ 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:
|
||||
@@ -107,10 +122,16 @@ jobs:
|
||||
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: |
|
||||
@@ -123,13 +144,28 @@ jobs:
|
||||
dpkg -l | grep ii | grep mingw
|
||||
update-alternatives --get-selections | grep mingw
|
||||
|
||||
- name: Setup Linux buildroot toolchain cache
|
||||
if: ${{ matrix.platform == 'linux' }}
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
${{ matrix.buildroot }}-godot-linux-gnu_sdk-buildroot.tar.bz2
|
||||
key: linux-${{ matrix.buildroot }}-buildroot
|
||||
|
||||
- name: Install Linux build dependencies
|
||||
if: ${{ matrix.platform == 'linux' }}
|
||||
run: |
|
||||
sudo apt-get install build-essential gcc-multilib g++-multilib
|
||||
sudo apt-get update
|
||||
sudo apt-get install build-essential gcc-multilib g++-multilib wget
|
||||
if [ ! -f ${{ matrix.buildroot }}-godot-linux-gnu_sdk-buildroot.tar.bz2 ]; then
|
||||
wget https://downloads.tuxfamily.org/godotengine/toolchains/linux/${{ matrix.buildroot }}-godot-linux-gnu_sdk-buildroot.tar.bz2
|
||||
fi
|
||||
tar -xjf ${{ matrix.buildroot }}-godot-linux-gnu_sdk-buildroot.tar.bz2
|
||||
echo "$GITHUB_WORKSPACE/${{ matrix.buildroot }}-godot-linux-gnu_sdk-buildroot/bin" >> $GITHUB_PATH
|
||||
patch -p1 < misc/patches/scons_path.diff
|
||||
|
||||
- name: Set up Python 3.x
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
architecture: 'x64'
|
||||
@@ -142,33 +178,39 @@ jobs:
|
||||
scons --version
|
||||
cmake --version
|
||||
|
||||
- name: Compile Extension - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
|
||||
- name: Compile Extension (4.1+) - template_debug - ${{ matrix.platform }} - ${{ matrix.arch }}
|
||||
run: |
|
||||
scons target=debug generate_bindings=yes
|
||||
scons target=template_debug godot_version=4.1
|
||||
|
||||
- name: Compile GDNative - debug - ${{ matrix.platform }} - ${{ matrix.arch }}
|
||||
- name: Compile Extension (4.1+) - template_release - ${{ matrix.platform }} - ${{ matrix.arch }}
|
||||
run: |
|
||||
scons target=debug generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3
|
||||
scons target=template_release godot_version=4.1
|
||||
|
||||
- name: Compile Extension - release - ${{ matrix.platform }} - ${{ matrix.arch }}
|
||||
- name: Compile Extension (4.0) - template_debug - ${{ matrix.platform }} - ${{ matrix.arch }}
|
||||
run: |
|
||||
scons target=release
|
||||
scons target=template_debug godot_version=4.0
|
||||
|
||||
- name: Compile GDNative - release ${{ matrix.platform }} - ${{ matrix.arch }}
|
||||
- name: Compile Extension (4.0) - template_release - ${{ matrix.platform }} - ${{ matrix.arch }}
|
||||
run: |
|
||||
scons target=release ${{ matrix.gdnative_flags }} godot_version=3
|
||||
scons target=template_release godot_version=4.0
|
||||
|
||||
- name: Compile GDNative (3.5+) - release ${{ matrix.platform }} - ${{ matrix.arch }}
|
||||
run: |
|
||||
scons target=release generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ github.job }}-${{ matrix.platform }}-${{ matrix.arch }}
|
||||
path: bin/*
|
||||
path: |
|
||||
bin/
|
||||
!bin/thirdparty/
|
||||
|
||||
package:
|
||||
name: 📦 Package
|
||||
needs: build
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -179,42 +221,35 @@ jobs:
|
||||
- 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
|
||||
cp thirdparty/libdatachannel/LICENSE artifacts/LICENSE.libdatachannel
|
||||
cp thirdparty/openssl/LICENSE.txt artifacts/LICENSE.openssl
|
||||
cp thirdparty/libdatachannel/deps/libjuice/LICENSE artifacts/LICENSE.libjuice
|
||||
cp thirdparty/libdatachannel/deps/usrsctp/LICENSE.md artifacts/LICENSE.usrsctp
|
||||
cp thirdparty/libdatachannel/deps/libsrtp/LICENSE artifacts/LICENSE.libsrtp
|
||||
cp thirdparty/libdatachannel/deps/json/LICENSE.MIT artifacts/LICENSE.json
|
||||
cp thirdparty/libdatachannel/deps/plog/LICENSE artifacts/LICENSE.plog
|
||||
|
||||
- name: Package artifacts for release
|
||||
env:
|
||||
DESTINATION: "release"
|
||||
run: |
|
||||
mkdir release
|
||||
cd release
|
||||
|
||||
ls -R
|
||||
VERSION="extension-4.1" TYPE="webrtc" ./misc/scripts/package_release.sh
|
||||
VERSION="extension-4.0" TYPE="webrtc" ./misc/scripts/package_release.sh
|
||||
VERSION="gdnative" TYPE="webrtc" ./misc/scripts/package_release.sh
|
||||
|
||||
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
|
||||
ls -R release
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: godot-webrtc-extension
|
||||
path: release/*-extension-*.zip
|
||||
name: godot-webrtc-extension-4.1
|
||||
path: release/*-extension-4.1-*.zip
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: godot-webrtc-extension-4.0
|
||||
path: release/*-extension-4.0-*.zip
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,3 +5,5 @@ bin/*
|
||||
.sconsign.dblite
|
||||
*.obj
|
||||
*.swp
|
||||
__pycache__/*
|
||||
*.pyc
|
||||
|
||||
13
.gitmodules
vendored
13
.gitmodules
vendored
@@ -1,12 +1,15 @@
|
||||
[submodule "godot-cpp-3.x"]
|
||||
path = godot-cpp-3.x
|
||||
url = https://github.com/godotengine/godot-cpp.git
|
||||
[submodule "godot-cpp"]
|
||||
path = godot-cpp
|
||||
url = https://github.com/godotengine/godot-cpp.git
|
||||
[submodule "godot-cpp-4.0"]
|
||||
path = godot-cpp-4.0
|
||||
url = https://github.com/godotengine/godot-cpp.git
|
||||
[submodule "godot-cpp-3.x"]
|
||||
path = godot-cpp-3.x
|
||||
url = https://github.com/godotengine/godot-cpp.git
|
||||
[submodule "libdatachannel"]
|
||||
path = deps/libdatachannel
|
||||
path = thirdparty/libdatachannel
|
||||
url = https://github.com/paullouisageneau/libdatachannel.git
|
||||
[submodule "openssl"]
|
||||
path = deps/openssl
|
||||
path = thirdparty/openssl
|
||||
url = https://github.com/openssl/openssl.git
|
||||
|
||||
12
README.md
12
README.md
@@ -21,7 +21,7 @@ $ git submodule update --init --recursive
|
||||
|
||||
### Compiling the extension.
|
||||
|
||||
To build the GDExtension version of the plugin (Godot 4.0) run the following command from the `webrtc-native` folder:
|
||||
To build the GDExtension version of the plugin (Godot 4.1+) run the following command from the `webrtc-native` folder:
|
||||
|
||||
```
|
||||
$ scons platform=<your platform>
|
||||
@@ -29,6 +29,12 @@ $ scons platform=<your platform>
|
||||
|
||||
This will build all the required dependencies into a single shared library.
|
||||
|
||||
To build the "legacy" GDExtension version of the plugin (Godot 4.0) run the following command instead:
|
||||
|
||||
```
|
||||
$ scons platform=<your platform> godot_version=4.0
|
||||
```
|
||||
|
||||
To build the GDNative version of the plugin (Godot 3.x) run the following command instead:
|
||||
|
||||
```
|
||||
@@ -45,6 +51,4 @@ You simply need to copy that folder to the root folder of your project. Note tha
|
||||
|
||||
### License
|
||||
|
||||
The `webrtc-native` plugin is licensed under the MIT license (see [LICENSE](https://github.com/godotengine/webrtc-native/blob/master/LICENSE)), while `libdatachannel` and one of its dependencies (`libjuice`) are licensed under LGPLv2.1 or later, see [libdatachannel LICENSE](https://github.com/paullouisageneau/libdatachannel/blob/master/LICENSE) and [libjuice LICENSE](https://github.com/paullouisageneau/libjuice/blob/master/LICENSE).
|
||||
|
||||
Make sure you understand and comply with the LGPLv2.1 license when redistributing this plugin.
|
||||
The `webrtc-native` plugin is licensed under the MIT license (see [LICENSE](https://github.com/godotengine/webrtc-native/blob/master/LICENSE)), while `libdatachannel` and its dependencies are licensed under other permissive open source licences. Please see [`thirdparty/README.md`](thirdparty/README.md) for more informations.
|
||||
|
||||
164
SConstruct
164
SConstruct
@@ -1,8 +1,7 @@
|
||||
#!python
|
||||
|
||||
import os, sys, platform, json, subprocess
|
||||
|
||||
import builders
|
||||
import SCons
|
||||
|
||||
|
||||
def add_sources(sources, dirpath, extension):
|
||||
@@ -19,9 +18,17 @@ def replace_flags(flags, replaces):
|
||||
|
||||
env = Environment()
|
||||
opts = Variables(["customs.py"], ARGUMENTS)
|
||||
opts.Add(EnumVariable("godot_version", "The Godot target version", "4", ["3", "4"]))
|
||||
opts.Add(EnumVariable("godot_version", "The Godot target version", "4.1", ["3", "4.0", "4.1"]))
|
||||
opts.Update(env)
|
||||
|
||||
# Minimum target platform versions.
|
||||
if "ios_min_version" not in ARGUMENTS:
|
||||
ARGUMENTS["ios_min_version"] = "11.0"
|
||||
if "macos_deployment_target" not in ARGUMENTS:
|
||||
ARGUMENTS["macos_deployment_target"] = "11.0"
|
||||
if "android_api_level" not in ARGUMENTS:
|
||||
ARGUMENTS["android_api_level"] = "28"
|
||||
|
||||
if env["godot_version"] == "3":
|
||||
if "platform" in ARGUMENTS and ARGUMENTS["platform"] == "macos":
|
||||
ARGUMENTS["platform"] = "osx" # compatibility with old osx name
|
||||
@@ -29,12 +36,15 @@ if env["godot_version"] == "3":
|
||||
env = SConscript("godot-cpp-3.x/SConstruct")
|
||||
|
||||
# Patch base env
|
||||
replace_flags(env["CCFLAGS"], {
|
||||
"-mios-simulator-version-min=10.0": "-mios-simulator-version-min=11.0",
|
||||
"-miphoneos-version-min=10.0": "-miphoneos-version-min=11.0",
|
||||
"/std:c++14": "/std:c++17",
|
||||
"-std=c++14": "-std=c++17",
|
||||
})
|
||||
replace_flags(
|
||||
env["CCFLAGS"],
|
||||
{
|
||||
"-mios-simulator-version-min=10.0": "-mios-simulator-version-min=11.0",
|
||||
"-miphoneos-version-min=10.0": "-miphoneos-version-min=11.0",
|
||||
"/std:c++14": "/std:c++17",
|
||||
"-std=c++14": "-std=c++17",
|
||||
},
|
||||
)
|
||||
|
||||
env = env.Clone()
|
||||
|
||||
@@ -47,12 +57,16 @@ if env["godot_version"] == "3":
|
||||
if env["platform"] == "osx":
|
||||
env["platform"] = "macos" # compatibility with old osx name
|
||||
ARGUMENTS["platform"] = "macos"
|
||||
env["CC"] = "clang" # CC is not set in 3.x and can result in it being "gcc".
|
||||
|
||||
if env["platform"] == "ios":
|
||||
env["ios_min_version"] = "11.0"
|
||||
|
||||
# Normalize suffix
|
||||
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":
|
||||
@@ -66,42 +80,71 @@ 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
|
||||
|
||||
# Some windows specific hacks.
|
||||
if env["platform"] == "windows":
|
||||
if sys.platform not in ["win32", "msys"]:
|
||||
# Set missing CC for MinGW from upstream build module.
|
||||
if env["bits"] == "64":
|
||||
env["CC"] = "x86_64-w64-mingw32-gcc"
|
||||
elif env["bits"] == "32":
|
||||
env["CC"] = "i686-w64-mingw32-gcc"
|
||||
elif not env["use_mingw"]:
|
||||
# Mark as MSVC build (would have failed to build the library otherwise).
|
||||
env["is_msvc"] = True
|
||||
elif env["godot_version"] == "4.0":
|
||||
env = SConscript("godot-cpp-4.0/SConstruct").Clone()
|
||||
else:
|
||||
ARGUMENTS["ios_min_version"] = "11.0"
|
||||
env = SConscript("godot-cpp/SConstruct").Clone()
|
||||
|
||||
# Should probably go to upstream godot-cpp.
|
||||
# We let SCons build its default ENV as it includes OS-specific things which we don't
|
||||
# want to have to pull in manually.
|
||||
# Then we prepend PATH to make it take precedence, while preserving SCons' own entries.
|
||||
env.PrependENVPath("PATH", os.getenv("PATH"))
|
||||
env.PrependENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH"))
|
||||
if "TERM" in os.environ: # Used for colored output.
|
||||
env["ENV"]["TERM"] = os.environ["TERM"]
|
||||
|
||||
# Patch mingw SHLIBSUFFIX.
|
||||
if env["platform"] == "windows" and env["use_mingw"]:
|
||||
env["SHLIBSUFFIX"] = ".dll"
|
||||
|
||||
# Patch OSXCross config.
|
||||
if env["platform"] == "macos" and os.environ.get("OSXCROSS_ROOT", ""):
|
||||
env["SHLIBSUFFIX"] = ".dylib"
|
||||
if env["macos_deployment_target"] != "default":
|
||||
env["ENV"]["MACOSX_DEPLOYMENT_TARGET"] = env["macos_deployment_target"]
|
||||
|
||||
# Patch linux flags to statically link libgcc and libstdc++
|
||||
if env["platform"] == "linux":
|
||||
env.Append(
|
||||
LINKFLAGS=[
|
||||
"-Wl,--no-undefined",
|
||||
"-static-libgcc",
|
||||
"-static-libstdc++",
|
||||
]
|
||||
)
|
||||
# And add some linux dependencies.
|
||||
env.Append(LIBS=["pthread", "dl"])
|
||||
|
||||
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")
|
||||
|
||||
# Dependencies
|
||||
deps_source_dir = "deps"
|
||||
env.Append(BUILDERS={
|
||||
"BuildOpenSSL": env.Builder(action=builders.ssl_action, emitter=builders.ssl_emitter),
|
||||
"BuildLibDataChannel": env.Builder(action=builders.rtc_action, emitter=builders.rtc_emitter),
|
||||
})
|
||||
|
||||
# SSL
|
||||
ssl = env.BuildOpenSSL(env.Dir(builders.get_ssl_build_dir(env)), env.Dir(builders.get_ssl_source_dir(env)))
|
||||
|
||||
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.Append(LIBPATH=[builders.get_rtc_build_dir(env)])
|
||||
env.Append(CPPPATH=[builders.get_rtc_include_dir(env)])
|
||||
env.Prepend(LIBS=[rtc])
|
||||
if env["godot_version"] == "3":
|
||||
result_path = os.path.join("bin", "gdnative", "webrtc" if env["target"] == "release" else "webrtc_debug")
|
||||
elif env["godot_version"] == "4.0":
|
||||
result_path = os.path.join("bin", "extension-4.0", "webrtc")
|
||||
else:
|
||||
result_path = os.path.join("bin", "extension-4.1", "webrtc")
|
||||
|
||||
# Our includes and sources
|
||||
env.Append(CPPPATH=["src/"])
|
||||
env.Append(CPPDEFINES=["RTC_STATIC"])
|
||||
sources = []
|
||||
sources.append(
|
||||
[
|
||||
@@ -109,32 +152,51 @@ sources.append(
|
||||
"src/WebRTCLibPeerConnection.cpp",
|
||||
]
|
||||
)
|
||||
if env["godot_version"] == "4":
|
||||
sources.append("src/init_gdextension.cpp")
|
||||
else:
|
||||
if env["godot_version"] == "3":
|
||||
env.Append(CPPDEFINES=["GDNATIVE_WEBRTC"])
|
||||
sources.append("src/init_gdnative.cpp")
|
||||
add_sources(sources, "src/net/", "cpp")
|
||||
else:
|
||||
sources.append("src/init_gdextension.cpp")
|
||||
if env["godot_version"] == "4.0":
|
||||
env.Append(CPPDEFINES=["GDEXTENSION_WEBRTC_40"])
|
||||
|
||||
env.Depends(sources, [ssl, rtc])
|
||||
# Add our build tools
|
||||
for tool in ["openssl", "cmake", "rtc"]:
|
||||
env.Tool(tool, toolpath=["tools"])
|
||||
|
||||
ssl = env.OpenSSL()
|
||||
|
||||
rtc = env.BuildLibDataChannel(ssl)
|
||||
|
||||
# Forces building our sources after OpenSSL and libdatachannel.
|
||||
# This is because OpenSSL headers are generated by their build system and SCons doesn't know about them.
|
||||
# Note: This might not be necessary in this specific case since our sources doesn't include OpenSSL headers directly,
|
||||
# but it's better to be safe in case of indirect inclusions by one of our other dependencies.
|
||||
env.Depends(sources, ssl + rtc)
|
||||
|
||||
# Make the shared library
|
||||
result_name = "webrtc_native.{}.{}.{}{}".format(env["platform"], env["target"], env["arch_suffix"], env["SHLIBSUFFIX"])
|
||||
env.Depends(sources, ssl)
|
||||
|
||||
if env["platform"] == "windows" and env["use_mingw"]:
|
||||
env.Append(LIBS=["iphlpapi", "ws2_32", "bcrypt"])
|
||||
|
||||
result_name = "libwebrtc_native{}{}".format(env["suffix"], env["SHLIBSUFFIX"])
|
||||
library = env.SharedLibrary(target=os.path.join(result_path, "lib", result_name), source=sources)
|
||||
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.Substfile(
|
||||
os.path.join(result_path, "webrtc.gdextension"),
|
||||
"misc/webrtc.gdextension",
|
||||
SUBST_DICT={"{GODOT_VERSION}": env["godot_version"]},
|
||||
)
|
||||
|
||||
Default(extfile)
|
||||
|
||||
240
builders.py
240
builders.py
@@ -1,240 +0,0 @@
|
||||
import os
|
||||
from SCons.Script import Environment
|
||||
|
||||
|
||||
def get_android_api(env):
|
||||
return env["android_api_level"] if int(env["android_api_level"]) > 28 else "28"
|
||||
|
||||
|
||||
def get_deps_dir(env):
|
||||
return env.Dir("#deps").abspath
|
||||
|
||||
|
||||
def get_deps_build_dir(env):
|
||||
return get_deps_dir(env) + "/build/{}.{}.{}.dir".format(env["platform"], env["target"], env["arch_suffix"])
|
||||
|
||||
|
||||
def get_rtc_source_dir(env):
|
||||
return get_deps_dir(env) + "/libdatachannel"
|
||||
|
||||
|
||||
def get_rtc_build_dir(env):
|
||||
return get_deps_build_dir(env) + "/libdatachannel"
|
||||
|
||||
|
||||
def get_rtc_include_dir(env):
|
||||
return get_rtc_source_dir(env) + "/include"
|
||||
|
||||
|
||||
def get_ssl_source_dir(env):
|
||||
return get_deps_dir(env) + "/openssl"
|
||||
|
||||
|
||||
def get_ssl_build_dir(env):
|
||||
return get_deps_build_dir(env) + "/openssl"
|
||||
|
||||
|
||||
def get_ssl_install_dir(env):
|
||||
return get_ssl_build_dir(env) + "/dest"
|
||||
|
||||
|
||||
def get_ssl_include_dir(env):
|
||||
return get_ssl_install_dir(env) + "/include"
|
||||
|
||||
|
||||
def ssl_emitter(target, source, env):
|
||||
build_dir = get_ssl_build_dir(env)
|
||||
libs = ["libssl.a", "libcrypto.a"]
|
||||
install_dir = get_ssl_install_dir(env)
|
||||
ssl_include = os.path.join(source[0].abspath, "include")
|
||||
return [env.File(build_dir + "/" + l) for l in libs], source
|
||||
|
||||
|
||||
def ssl_action(target, source, env):
|
||||
build_dir = get_ssl_build_dir(env)
|
||||
source_dir = source[0].abspath
|
||||
|
||||
ssl_env = Environment()
|
||||
install_dir = get_ssl_install_dir(env)
|
||||
args = [
|
||||
"no-ssl3",
|
||||
"no-weak-ssl-ciphers",
|
||||
"no-legacy",
|
||||
"--prefix=%s" % install_dir,
|
||||
"--openssldir=%s" % install_dir,
|
||||
]
|
||||
if env["target"] == "debug":
|
||||
args.append("-d")
|
||||
|
||||
if env["platform"] != "windows":
|
||||
args.append("no-shared") # Windows "app" doesn't like static-only builds.
|
||||
if env["platform"] == "linux":
|
||||
if env["arch"] == "x86_32":
|
||||
args.extend(["linux-x86"])
|
||||
else:
|
||||
args.extend(["linux-x86_64"])
|
||||
|
||||
elif env["platform"] == "android":
|
||||
args.extend([
|
||||
{
|
||||
"arm64": "android-arm64",
|
||||
"arm32": "android-arm",
|
||||
"x86_32": "android-x86",
|
||||
"x86_64": "android-x86_64",
|
||||
}[env["arch"]],
|
||||
"-D__ANDROID_API__=%s" % get_android_api(env),
|
||||
])
|
||||
# Setup toolchain path.
|
||||
ssl_env.PrependENVPath("PATH", os.path.dirname(env["CC"]))
|
||||
ssl_env["ENV"]["ANDROID_NDK_ROOT"] = os.environ.get("ANDROID_NDK_ROOT", "")
|
||||
|
||||
elif env["platform"] == "macos":
|
||||
if env["arch"] == "x86_64":
|
||||
args.extend(["darwin64-x86_64"])
|
||||
elif env["arch"] == "arm64":
|
||||
args.extend(["darwin64-arm64"])
|
||||
else:
|
||||
raise ValueError("macOS architecture not supported: %s" % env["arch"])
|
||||
|
||||
elif env["platform"] == "ios":
|
||||
if env["ios_simulator"]:
|
||||
args.extend(["iossimulator-xcrun"])
|
||||
elif env["arch"] == "arm32":
|
||||
args.extend(["ios-xcrun"])
|
||||
elif env["arch"] == "arm64":
|
||||
args.extend(["ios64-xcrun"])
|
||||
else:
|
||||
raise ValueError("iOS architecture not supported: %s" % env["arch"])
|
||||
|
||||
elif env["platform"] == "windows":
|
||||
if env["arch"] == "x86_32":
|
||||
if env["use_mingw"]:
|
||||
args.extend([
|
||||
"mingw",
|
||||
"--cross-compile-prefix=i686-w64-mingw32-",
|
||||
])
|
||||
else:
|
||||
args.extend(["VC-WIN32"])
|
||||
else:
|
||||
if env["use_mingw"]:
|
||||
args.extend([
|
||||
"mingw64",
|
||||
"--cross-compile-prefix=x86_64-w64-mingw32-",
|
||||
])
|
||||
else:
|
||||
args.extend(["VC-WIN64A"])
|
||||
|
||||
jobs = env.GetOption("num_jobs")
|
||||
ssl_env.Execute([
|
||||
"mkdir -p " + build_dir, # TODO python?
|
||||
("cd %s && %s/Configure " % (build_dir, source_dir)) + " ".join(args),
|
||||
"make -C %s -j%s" % (build_dir, jobs),
|
||||
"make -C %s install_sw install_ssldirs -j%s" % (build_dir, jobs),
|
||||
]
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
def rtc_emitter(target, source, env):
|
||||
build_dir = get_rtc_build_dir(env)
|
||||
libs = ["libdatachannel-static.a", "libjuice-static.a", "libsrtp2.a", "libusrsctp.a"]
|
||||
lib_paths = [
|
||||
build_dir,
|
||||
os.path.join(build_dir, "deps/libjuice"),
|
||||
os.path.join(build_dir, "deps/libsrtp"),
|
||||
os.path.join(build_dir, "deps/usrsctp/usrsctplib"),
|
||||
]
|
||||
return [env.File(lib_paths[i] + "/" + libs[i]) for i in range(len(libs))], source
|
||||
|
||||
|
||||
def rtc_action(target, source, env):
|
||||
build_dir = get_rtc_build_dir(env)
|
||||
source_dir = source[0].abspath
|
||||
args = [
|
||||
"-B",
|
||||
build_dir,
|
||||
"-DUSE_NICE=0",
|
||||
"-DNO_WEBSOCKET=1",
|
||||
#"-DNO_MEDIA=1", # Windows builds fail without it.
|
||||
"-DNO_EXAMPLES=1",
|
||||
"-DNO_WEBSOCKET=1",
|
||||
"-DNO_TESTS=1",
|
||||
"-DOPENSSL_USE_STATIC_LIBS=1",
|
||||
"-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"),
|
||||
]
|
||||
if env["platform"] == "android":
|
||||
abi = {
|
||||
"arm64": "arm64-v8a",
|
||||
"arm32": "armeabi-v7a",
|
||||
"x86_32": "x86",
|
||||
"x86_64": "x86_64",
|
||||
}[env["arch"]]
|
||||
args.extend([
|
||||
"-DCMAKE_SYSTEM_NAME=Android",
|
||||
"-DCMAKE_SYSTEM_VERSION=%s" % get_android_api(env),
|
||||
"-DCMAKE_ANDROID_ARCH_ABI=%s" % abi,
|
||||
"-DANDROID_ABI=%s" % abi,
|
||||
"-DCMAKE_TOOLCHAIN_FILE=%s/build/cmake/android.toolchain.cmake" % os.environ.get("ANDROID_NDK_ROOT", ""),
|
||||
"-DCMAKE_ANDROID_STL_TYPE=c++_static",
|
||||
])
|
||||
elif env["platform"] == "linux":
|
||||
if env["arch"] == "x86_32":
|
||||
args.extend([
|
||||
"-DCMAKE_C_FLAGS=-m32",
|
||||
"-DCMAKE_CXX_FLAGS=-m32"
|
||||
])
|
||||
else:
|
||||
args.extend([
|
||||
"-DCMAKE_C_FLAGS=-m64",
|
||||
"-DCMAKE_CXX_FLAGS=-m64"
|
||||
])
|
||||
elif env["platform"] == "macos":
|
||||
if env["macos_deployment_target"] != "default":
|
||||
args.extend(["-DCMAKE_OSX_DEPLOYMENT_TARGET=%s" % env["macos_deployment_target"]])
|
||||
if env["arch"] == "x86_64":
|
||||
args.extend(["-DCMAKE_OSX_ARCHITECTURES=x86_64"])
|
||||
elif env["arch"] == "arm64":
|
||||
args.extend(["-DCMAKE_OSX_ARCHITECTURES=arm64"])
|
||||
else:
|
||||
raise ValueError("OSX architecture not supported: %s" % env["arch"])
|
||||
elif env["platform"] == "ios":
|
||||
if env["arch"] == "universal":
|
||||
raise ValueError("iOS architecture not supported: %s" % env["arch"])
|
||||
args.extend([
|
||||
"-DCMAKE_SYSTEM_NAME=iOS",
|
||||
"-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0",
|
||||
"-DCMAKE_OSX_ARCHITECTURES=%s" % env["arch"],
|
||||
])
|
||||
if env["ios_simulator"]:
|
||||
args.extend(["-DCMAKE_OSX_SYSROOT=iphonesimulator"])
|
||||
elif env["platform"] == "windows":
|
||||
args.extend(["-DOPENSSL_ROOT_DIR=%s" % get_ssl_build_dir(env)])
|
||||
if env["arch"] == "x86_32":
|
||||
if env["use_mingw"]:
|
||||
args.extend([
|
||||
"-G 'Unix Makefiles'",
|
||||
"-DCMAKE_C_COMPILER=i686-w64-mingw32-gcc",
|
||||
"-DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++",
|
||||
"-DCMAKE_SYSTEM_NAME=Windows",
|
||||
])
|
||||
else:
|
||||
if env["use_mingw"]:
|
||||
args.extend([
|
||||
"-G 'Unix Makefiles'",
|
||||
"-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc",
|
||||
"-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++",
|
||||
"-DCMAKE_SYSTEM_NAME=Windows"
|
||||
])
|
||||
|
||||
args.append(source_dir)
|
||||
jobs = env.GetOption("num_jobs")
|
||||
rtc_env = Environment()
|
||||
rtc_env.Execute([
|
||||
"cmake " + " ".join(args),
|
||||
"cmake --build %s -t datachannel-static -j%s" % (build_dir, jobs),
|
||||
]
|
||||
)
|
||||
return None
|
||||
1
deps/libdatachannel
vendored
1
deps/libdatachannel
vendored
Submodule deps/libdatachannel deleted from 93847128f1
1
deps/openssl
vendored
1
deps/openssl
vendored
Submodule deps/openssl deleted from ad4910fad2
Submodule godot-cpp updated: fa4d18f21c...d627942b64
Submodule godot-cpp-3.x updated: ac572d5f84...7c09b5484d
1
godot-cpp-4.0
Submodule
1
godot-cpp-4.0
Submodule
Submodule godot-cpp-4.0 added at 9d1c396c54
29
misc/patches/scons_path.diff
Normal file
29
misc/patches/scons_path.diff
Normal file
@@ -0,0 +1,29 @@
|
||||
diff --git a/godot-cpp-4.0/SConstruct b/godot-cpp-4.0/SConstruct
|
||||
index 27ee137..32b425e 100644
|
||||
--- a/godot-cpp-4.0/SConstruct
|
||||
+++ b/godot-cpp-4.0/SConstruct
|
||||
@@ -54,6 +54,8 @@ else:
|
||||
# Default tools with no platform defaults to gnu toolchain.
|
||||
# We apply platform specific toolchains via our custom tools.
|
||||
env = Environment(tools=["default"], PLATFORM="")
|
||||
+# Allows us to use Godot buildroot toolchain
|
||||
+env.PrependENVPath("PATH", os.getenv("PATH"))
|
||||
|
||||
# Default num_jobs to local cpu count if not user specified.
|
||||
# SCons has a peculiarity where user-specified options won't be overridden
|
||||
|
||||
diff --git a/godot-cpp-3.x/SConstruct b/godot-cpp-3.x/SConstruct
|
||||
index f653d54..6f40377 100644
|
||||
--- a/godot-cpp-3.x/SConstruct
|
||||
+++ b/godot-cpp-3.x/SConstruct
|
||||
@@ -194,6 +194,9 @@ if host_platform == "windows" and env["platform"] != "android":
|
||||
|
||||
opts.Update(env)
|
||||
|
||||
+# Allows us to use Godot buildroot toolchain
|
||||
+env.PrependENVPath("PATH", os.getenv("PATH"))
|
||||
+
|
||||
# Require C++14
|
||||
if host_platform == "windows" and env["platform"] == "windows" and not env["use_mingw"]:
|
||||
# MSVC
|
||||
|
||||
@@ -6,29 +6,21 @@ set -uo pipefail
|
||||
|
||||
# Apply black.
|
||||
echo -e "Formatting Python files..."
|
||||
PY_FILES=$(find \( -path "./.git" \
|
||||
-o -path "./webrtc" \
|
||||
-o -path "./godot-cpp" \
|
||||
\) -prune \
|
||||
-o \( -name "SConstruct" \
|
||||
-o -name "SCsub" \
|
||||
-o -name "*.py" \
|
||||
\) -print)
|
||||
PY_FILES=$(git ls-files -- '*SConstruct' '*SCsub' '*.py' ':!:.git/*' ':!:thirdparty/*')
|
||||
black -l 120 $PY_FILES
|
||||
|
||||
git diff > patch.patch
|
||||
diff=$(git diff --color)
|
||||
|
||||
# If no patch has been generated all is OK, clean up, and exit.
|
||||
if [ ! -s patch.patch ] ; then
|
||||
printf "Files in this commit comply with the black style rules.\n"
|
||||
rm -f patch.patch
|
||||
# If no diff has been generated all is OK, clean up, and exit.
|
||||
if [ -z "$diff" ] ; then
|
||||
printf "\e[1;32m*** Files in this commit comply with the black style rules.\e[0m\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# A patch has been created, notify the user, clean up, and exit.
|
||||
printf "\n*** The following differences were found between the code "
|
||||
printf "and the formatting rules:\n\n"
|
||||
cat patch.patch
|
||||
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
||||
rm -f patch.patch
|
||||
# A diff has been created, notify the user, clean up, and exit.
|
||||
printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n"
|
||||
# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`.
|
||||
printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
|
||||
|
||||
printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n"
|
||||
exit 1
|
||||
|
||||
@@ -4,55 +4,50 @@
|
||||
# This is the primary script responsible for fixing style violations.
|
||||
|
||||
set -uo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
CLANG_FORMAT_FILE_EXTS=(".c" ".h" ".cpp" ".hpp" ".cc" ".hh" ".cxx" ".m" ".mm" ".inc" ".java" ".glsl")
|
||||
if [ $# -eq 0 ]; then
|
||||
# Loop through all code files tracked by Git.
|
||||
files=$(git ls-files -- '*.c' '*.h' '*.cpp' '*.hpp' '*.cc' '*.hh' '*.cxx' '*.m' '*.mm' '*.inc' '*.java' '*.glsl' \
|
||||
':!:.git/*' ':!:thirdparty/*' ':!:*/thirdparty/*' ':!:platform/android/java/lib/src/com/google/*' \
|
||||
':!:*-so_wrap.*' ':!:tests/python_build/*')
|
||||
else
|
||||
# $1 should be a file listing file paths to process. Used in CI.
|
||||
files=$(cat "$1" | grep -v "thirdparty/" | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java|glsl)$" | grep -v "platform/android/java/lib/src/com/google/" | grep -v "\-so_wrap\." | grep -v "tests/python_build/")
|
||||
fi
|
||||
|
||||
# Loops through all text files tracked by Git.
|
||||
git grep -zIl '' |
|
||||
while IFS= read -rd '' f; do
|
||||
# Exclude some files.
|
||||
if [[ "$f" == "thirdparty"* ]]; then
|
||||
if [ ! -z "$files" ]; then
|
||||
clang-format --Wno-error=unknown -i $files
|
||||
fi
|
||||
|
||||
# Fix copyright headers, but not all files get them.
|
||||
for f in $files; do
|
||||
if [[ "$f" == *"inc" ]]; then
|
||||
continue
|
||||
elif [[ "$f" == "platform/android/java/lib/src/com/google"* ]]; then
|
||||
elif [[ "$f" == *"glsl" ]]; then
|
||||
continue
|
||||
elif [[ "$f" == *"-so_wrap."* ]]; then
|
||||
elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView"* ]]; then
|
||||
continue
|
||||
elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper"* ]]; then
|
||||
continue
|
||||
elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix"* ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
for extension in ${CLANG_FORMAT_FILE_EXTS[@]}; do
|
||||
if [[ "$f" == *"$extension" ]]; then
|
||||
# Run clang-format.
|
||||
clang-format -i "$f"
|
||||
# Fix copyright headers, but not all files get them.
|
||||
if [[ "$f" == *"inc" ]]; then
|
||||
continue 2
|
||||
elif [[ "$f" == *"glsl" ]]; then
|
||||
continue 2
|
||||
elif [[ "$f" == *"theme_data.h" ]]; then
|
||||
continue 2
|
||||
elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/input/InputManager"* ]]; then
|
||||
continue 2
|
||||
fi
|
||||
python misc/scripts/copyright_headers.py "$f"
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
python misc/scripts/copyright_headers.py "$f"
|
||||
done
|
||||
|
||||
git diff > patch.patch
|
||||
diff=$(git diff --color)
|
||||
|
||||
# If no patch has been generated all is OK, clean up, and exit.
|
||||
if [ ! -s patch.patch ] ; then
|
||||
printf "Files in this commit comply with the clang-format style rules.\n"
|
||||
rm -f patch.patch
|
||||
# If no diff has been generated all is OK, clean up, and exit.
|
||||
if [ -z "$diff" ] ; then
|
||||
printf "\e[1;32m*** Files in this commit comply with the clang-format style rules.\e[0m\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# A patch has been created, notify the user, clean up, and exit.
|
||||
printf "\n*** The following differences were found between the code "
|
||||
printf "and the formatting rules:\n\n"
|
||||
cat patch.patch
|
||||
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
||||
rm -f patch.patch
|
||||
# A diff has been created, notify the user, clean up, and exit.
|
||||
printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n"
|
||||
# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`.
|
||||
printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
|
||||
|
||||
printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n"
|
||||
exit 1
|
||||
|
||||
@@ -4,35 +4,35 @@
|
||||
import sys
|
||||
|
||||
header = """\
|
||||
/*************************************************************************/
|
||||
/* $filename */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* $filename */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
"""
|
||||
|
||||
fname = sys.argv[1]
|
||||
|
||||
@@ -4,27 +4,52 @@
|
||||
# This is supplementary to clang_format.sh and black_format.sh, but should be
|
||||
# run before them.
|
||||
|
||||
# We need dos2unix and recode.
|
||||
if [ ! -x "$(command -v dos2unix)" -o ! -x "$(command -v recode)" ]; then
|
||||
printf "Install 'dos2unix' and 'recode' to use this script.\n"
|
||||
# We need dos2unix and isutf8.
|
||||
if [ ! -x "$(command -v dos2unix)" -o ! -x "$(command -v isutf8)" ]; then
|
||||
printf "Install 'dos2unix' and 'isutf8' (moreutils package) to use this script.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -uo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# Loops through all text files tracked by Git.
|
||||
git grep -zIl '' |
|
||||
while IFS= read -rd '' f; do
|
||||
if [ $# -eq 0 ]; then
|
||||
# Loop through all code files tracked by Git.
|
||||
mapfile -d '' files < <(git grep -zIl '')
|
||||
else
|
||||
# $1 should be a file listing file paths to process. Used in CI.
|
||||
mapfile -d ' ' < <(cat "$1")
|
||||
fi
|
||||
|
||||
for f in "${files[@]}"; do
|
||||
# Exclude some types of files.
|
||||
if [[ "$f" == "webrtc"* ]]; then
|
||||
if [[ "$f" == *"csproj" ]]; then
|
||||
continue
|
||||
elif [[ "$f" == "godot-cpp"* ]]; then
|
||||
elif [[ "$f" == *"sln" ]]; then
|
||||
continue
|
||||
elif [[ "$f" == "misc/patches"* ]]; then
|
||||
elif [[ "$f" == *".bat" ]]; then
|
||||
continue
|
||||
elif [[ "$f" == *".out" ]]; then
|
||||
# GDScript integration testing files.
|
||||
continue
|
||||
elif [[ "$f" == *"patch" ]]; then
|
||||
continue
|
||||
elif [[ "$f" == *"pot" ]]; then
|
||||
continue
|
||||
elif [[ "$f" == *"po" ]]; then
|
||||
continue
|
||||
elif [[ "$f" == "thirdparty/"* ]]; then
|
||||
continue
|
||||
elif [[ "$f" == *"/thirdparty/"* ]]; then
|
||||
continue
|
||||
elif [[ "$f" == "platform/android/java/lib/src/com/google"* ]]; then
|
||||
continue
|
||||
elif [[ "$f" == *"-so_wrap."* ]]; then
|
||||
continue
|
||||
elif [[ "$f" == *".test.txt" ]]; then
|
||||
continue
|
||||
fi
|
||||
# Ensure that files are UTF-8 formatted.
|
||||
recode UTF-8 "$f" 2> /dev/null
|
||||
isutf8 "$f" >> utf8-validation.txt 2>&1
|
||||
# Ensure that files have LF line endings and do not contain a BOM.
|
||||
dos2unix "$f" 2> /dev/null
|
||||
# Remove trailing space characters and ensures that files end
|
||||
@@ -32,19 +57,33 @@ while IFS= read -rd '' f; do
|
||||
perl -i -ple 's/\s*$//g' "$f"
|
||||
done
|
||||
|
||||
git diff > patch.patch
|
||||
diff=$(git diff --color)
|
||||
|
||||
# If no patch has been generated all is OK, clean up, and exit.
|
||||
if [ ! -s patch.patch ] ; then
|
||||
printf "Files in this commit comply with the formatting rules.\n"
|
||||
rm -f patch.patch
|
||||
if [ ! -s utf8-validation.txt ] && [ -z "$diff" ] ; then
|
||||
# If no UTF-8 violations were collected (the file is empty) and
|
||||
# no diff has been generated all is OK, clean up, and exit.
|
||||
printf "\e[1;32m*** Files in this commit comply with the file formatting rules.\e[0m\n"
|
||||
rm -f utf8-validation.txt
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# A patch has been created, notify the user, clean up, and exit.
|
||||
printf "\n*** The following differences were found between the code "
|
||||
printf "and the formatting rules:\n\n"
|
||||
cat patch.patch
|
||||
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
||||
rm -f patch.patch
|
||||
if [ -s utf8-validation.txt ]
|
||||
then
|
||||
# If the file has content and is not empty, violations
|
||||
# detected, notify the user, clean up, and exit.
|
||||
printf "\n\e[1;33m*** The following files contain invalid UTF-8 character sequences:\e[0m\n\n"
|
||||
cat utf8-validation.txt
|
||||
fi
|
||||
|
||||
rm -f utf8-validation.txt
|
||||
|
||||
if [ ! -z "$diff" ]
|
||||
then
|
||||
# A diff has been created, notify the user, clean up, and exit.
|
||||
printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n"
|
||||
# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`.
|
||||
printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
|
||||
fi
|
||||
|
||||
printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n"
|
||||
exit 1
|
||||
|
||||
33
misc/scripts/package_release.sh
Executable file
33
misc/scripts/package_release.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
ARTIFACTS=${ARTIFACTS:-"artifacts"}
|
||||
DESTINATION=${DESTIONATION:-"release"}
|
||||
VERSION=${VERSION:-"extension"}
|
||||
TYPE=${TYPE:-"webrtc"}
|
||||
|
||||
mkdir -p ${DESTINATION}
|
||||
ls -R ${DESTINATION}
|
||||
ls -R ${ARTIFACTS}
|
||||
|
||||
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 = "gdnative" ]; then
|
||||
find "${ARTIFACTS}" -wholename "*/${VERSION}/${TYPE}/${TYPE}.tres" | head -n 1 | xargs cp -t "${DESTDIR}/"
|
||||
else
|
||||
find "${ARTIFACTS}" -wholename "*/${VERSION}/${TYPE}/${TYPE}.gdextension" | 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}
|
||||
@@ -1,16 +1,30 @@
|
||||
[configuration]
|
||||
|
||||
entry_symbol = "webrtc_extension_init"
|
||||
compatibility_minimum = {GODOT_VERSION}
|
||||
|
||||
[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 = "lib/libwebrtc_native.linux.template_debug.x86_64.so"
|
||||
linux.debug.x86_32 = "lib/libwebrtc_native.linux.template_debug.x86_32.so"
|
||||
linux.debug.arm64 = "lib/libwebrtc_native.linux.template_debug.arm64.so"
|
||||
linux.debug.arm32 = "lib/libwebrtc_native.linux.template_debug.arm32.so"
|
||||
macos.debug = "lib/libwebrtc_native.macos.template_debug.universal.dylib"
|
||||
windows.debug.x86_64 = "lib/libwebrtc_native.windows.template_debug.x86_64.dll"
|
||||
windows.debug.x86_32 = "lib/libwebrtc_native.windows.template_debug.x86_32.dll"
|
||||
android.debug.arm64 = "lib/libwebrtc_native.android.template_debug.arm64.so"
|
||||
android.debug.x86_64 = "lib/libwebrtc_native.android.template_debug.x86_64.so"
|
||||
ios.debug.arm64 = "lib/libwebrtc_native.ios.template_debug.arm64.dylib"
|
||||
ios.debug.x86_64 = "lib/libwebrtc_native.ios.template_debug.x86_64.simulator.dylib"
|
||||
|
||||
linux.release.x86_64 = "lib/libwebrtc_native.linux.template_release.x86_64.so"
|
||||
linux.release.x86_32 = "lib/libwebrtc_native.linux.template_release.x86_32.so"
|
||||
linux.release.arm64 = "lib/libwebrtc_native.linux.template_release.arm64.so"
|
||||
linux.release.arm32 = "lib/libwebrtc_native.linux.template_release.arm32.so"
|
||||
macos.release = "lib/libwebrtc_native.macos.template_release.universal.dylib"
|
||||
windows.release.x86_64 = "lib/libwebrtc_native.windows.template_release.x86_64.dll"
|
||||
windows.release.x86_32 = "lib/libwebrtc_native.windows.template_release.x86_32.dll"
|
||||
android.release.arm64 = "lib/libwebrtc_native.android.template_release.arm64.so"
|
||||
android.release.x86_64 = "lib/libwebrtc_native.android.template_release.x86_64.so"
|
||||
ios.release.arm64 = "lib/libwebrtc_native.ios.template_release.arm64.dylib"
|
||||
ios.release.x86_64 = "lib/libwebrtc_native.ios.template_release.x86_64.simulator.dylib"
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
[resource]
|
||||
singleton = true
|
||||
reloadable = false
|
||||
entry/OSX.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.osx.{TARGET}.x86_64.dylib"
|
||||
entry/OSX.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.osx.{TARGET}.arm64.dylib"
|
||||
entry/OSX.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.macos.{TARGET}.universal.dylib"
|
||||
entry/Windows.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_64.dll"
|
||||
entry/Windows.32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_32.dll"
|
||||
entry/X11.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_64.so"
|
||||
@@ -16,11 +15,3 @@ entry/Android.x64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}
|
||||
entry/iOS.armv7 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.armv32.dylib"
|
||||
entry/iOS.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.arm64.dylib"
|
||||
entry/iOS.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.x86_64.simulator.dylib"
|
||||
dependency/Windows.64 = [ ]
|
||||
dependency/Windows.32 = [ ]
|
||||
dependency/X11.64 = [ ]
|
||||
dependency/X11.32 = [ ]
|
||||
dependency/Server.64 = [ ]
|
||||
dependency/Server.32 = [ ]
|
||||
dependency/Android.armeabi-v7a = [ ]
|
||||
dependency/Android.arm64-v8a = [ ]
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* WebRTCLibDataChannel.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* WebRTCLibDataChannel.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "WebRTCLibDataChannel.hpp"
|
||||
|
||||
@@ -136,17 +136,17 @@ bool WebRTCLibDataChannel::_is_ordered() const {
|
||||
return channel->reliability().unordered == false;
|
||||
}
|
||||
|
||||
int64_t WebRTCLibDataChannel::_get_id() const {
|
||||
int32_t WebRTCLibDataChannel::_get_id() const {
|
||||
ERR_FAIL_COND_V(!channel, -1);
|
||||
return channel->id().value_or(-1);
|
||||
}
|
||||
|
||||
int64_t WebRTCLibDataChannel::_get_max_packet_life_time() const {
|
||||
int32_t WebRTCLibDataChannel::_get_max_packet_life_time() const {
|
||||
ERR_FAIL_COND_V(!channel, 0);
|
||||
return channel->reliability().type == rtc::Reliability::Type::Timed ? std::get<std::chrono::milliseconds>(channel->reliability().rexmit).count() : -1;
|
||||
}
|
||||
|
||||
int64_t WebRTCLibDataChannel::_get_max_retransmits() const {
|
||||
int32_t WebRTCLibDataChannel::_get_max_retransmits() const {
|
||||
ERR_FAIL_COND_V(!channel, 0);
|
||||
return channel->reliability().type == rtc::Reliability::Type::Rexmit ? std::get<int>(channel->reliability().rexmit) : -1;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ bool WebRTCLibDataChannel::_is_negotiated() const {
|
||||
return negotiated;
|
||||
}
|
||||
|
||||
int64_t WebRTCLibDataChannel::_get_buffered_amount() const {
|
||||
int32_t WebRTCLibDataChannel::_get_buffered_amount() const {
|
||||
ERR_FAIL_COND_V(!channel, 0);
|
||||
return channel->bufferedAmount();
|
||||
}
|
||||
@@ -194,7 +194,7 @@ Error WebRTCLibDataChannel::_get_packet(const uint8_t **r_buffer, int32_t *r_len
|
||||
return OK;
|
||||
}
|
||||
|
||||
Error WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int64_t p_len) try {
|
||||
Error WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int32_t p_len) try {
|
||||
ERR_FAIL_COND_V(!channel, FAILED);
|
||||
ERR_FAIL_COND_V(channel->isClosed(), FAILED);
|
||||
if (write_mode == WRITE_MODE_TEXT) {
|
||||
@@ -212,11 +212,11 @@ Error WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int64_t p_len)
|
||||
ERR_FAIL_V(FAILED);
|
||||
}
|
||||
|
||||
int64_t WebRTCLibDataChannel::_get_available_packet_count() const {
|
||||
int32_t WebRTCLibDataChannel::_get_available_packet_count() const {
|
||||
return packet_queue.size();
|
||||
}
|
||||
|
||||
int64_t WebRTCLibDataChannel::_get_max_packet_size() const {
|
||||
int32_t WebRTCLibDataChannel::_get_max_packet_size() const {
|
||||
return 16384; // See RFC-8831 section 6.6: https://datatracker.ietf.org/doc/rfc8831/
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* WebRTCLibDataChannel.hpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* WebRTCLibDataChannel.hpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEBRTC_DATA_CHANNEL_H
|
||||
#define WEBRTC_DATA_CHANNEL_H
|
||||
@@ -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
|
||||
@@ -77,9 +79,9 @@ public:
|
||||
|
||||
/* PacketPeer */
|
||||
virtual godot::Error _get_packet(const uint8_t **r_buffer, int32_t *r_len) override;
|
||||
virtual godot::Error _put_packet(const uint8_t *p_buffer, int64_t p_len) override;
|
||||
virtual int64_t _get_available_packet_count() const override;
|
||||
virtual int64_t _get_max_packet_size() const override;
|
||||
virtual godot::Error _put_packet(const uint8_t *p_buffer, int32_t p_len) override;
|
||||
virtual int32_t _get_available_packet_count() const override;
|
||||
virtual int32_t _get_max_packet_size() const override;
|
||||
|
||||
/* WebRTCDataChannel */
|
||||
godot::Error _poll() override;
|
||||
@@ -92,12 +94,12 @@ public:
|
||||
ChannelState _get_ready_state() const override;
|
||||
godot::String _get_label() const override;
|
||||
bool _is_ordered() const override;
|
||||
int64_t _get_id() const override;
|
||||
int64_t _get_max_packet_life_time() const override;
|
||||
int64_t _get_max_retransmits() const override;
|
||||
int32_t _get_id() const override;
|
||||
int32_t _get_max_packet_life_time() const override;
|
||||
int32_t _get_max_retransmits() const override;
|
||||
godot::String _get_protocol() const override;
|
||||
bool _is_negotiated() const override;
|
||||
int64_t _get_buffered_amount() const override;
|
||||
int32_t _get_buffered_amount() const override;
|
||||
|
||||
WebRTCLibDataChannel();
|
||||
~WebRTCLibDataChannel();
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* WebRTCLibPeerConnection.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* WebRTCLibPeerConnection.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "WebRTCLibPeerConnection.hpp"
|
||||
#include "WebRTCLibDataChannel.hpp"
|
||||
@@ -180,7 +180,11 @@ Error WebRTCLibPeerConnection::_initialize(const Dictionary &p_config) {
|
||||
return _create_pc(config);
|
||||
}
|
||||
|
||||
#if defined(GDNATIVE_WEBRTC) || defined(GDEXTENSION_WEBRTC_40)
|
||||
Object *WebRTCLibPeerConnection::_create_data_channel(const String &p_channel, const Dictionary &p_channel_config) try {
|
||||
#else
|
||||
Ref<WebRTCDataChannel> WebRTCLibPeerConnection::_create_data_channel(const String &p_channel, const Dictionary &p_channel_config) try {
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!peer_connection, nullptr);
|
||||
|
||||
// Read config from dictionary
|
||||
@@ -230,11 +234,15 @@ Error WebRTCLibPeerConnection::_set_local_description(const String &p_type, cons
|
||||
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
|
||||
// XXX Library quirk. It doesn't seem possible to create offers/answers without setting the local description.
|
||||
// Ignore this call for now to avoid crash (it's already set automatically!).
|
||||
//peer_connection->setLocalDescription(p_type == String("offer") ? rtc::Description::Type::Offer : rtc::Description::Type::Answer);
|
||||
// peer_connection->setLocalDescription(p_type == String("offer") ? rtc::Description::Type::Offer : rtc::Description::Type::Answer);
|
||||
return OK;
|
||||
}
|
||||
|
||||
#ifdef GDNATIVE_WEBRTC
|
||||
Error WebRTCLibPeerConnection::_add_ice_candidate(const String &sdpMidName, int64_t sdpMlineIndexName, const String &sdpName) try {
|
||||
#else
|
||||
Error WebRTCLibPeerConnection::_add_ice_candidate(const String &sdpMidName, int32_t sdpMlineIndexName, const String &sdpName) try {
|
||||
#endif
|
||||
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
|
||||
rtc::Candidate candidate(sdpName.utf8().get_data(), sdpMidName.utf8().get_data());
|
||||
peer_connection->addRemoteCandidate(candidate);
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* WebRTCLibPeerConnection.hpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* WebRTCLibPeerConnection.hpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEBRTC_PEER_H
|
||||
#define WEBRTC_PEER_H
|
||||
@@ -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_peer_connection_extension.hpp>
|
||||
#endif
|
||||
@@ -77,11 +79,19 @@ public:
|
||||
SignalingState _get_signaling_state() const override;
|
||||
|
||||
godot::Error _initialize(const godot::Dictionary &p_config) override;
|
||||
#if defined(GDNATIVE_WEBRTC) || defined(GDEXTENSION_WEBRTC_40)
|
||||
godot::Object *_create_data_channel(const godot::String &p_channel, const godot::Dictionary &p_channel_config) override;
|
||||
#else
|
||||
godot::Ref<godot::WebRTCDataChannel> _create_data_channel(const godot::String &p_channel, const godot::Dictionary &p_channel_config) override;
|
||||
#endif
|
||||
godot::Error _create_offer() override;
|
||||
godot::Error _set_remote_description(const godot::String &type, const godot::String &sdp) override;
|
||||
godot::Error _set_local_description(const godot::String &type, const godot::String &sdp) override;
|
||||
#ifdef GDNATIVE_WEBRTC
|
||||
godot::Error _add_ice_candidate(const godot::String &sdpMidName, int64_t sdpMlineIndexName, const godot::String &sdpName) override;
|
||||
#else
|
||||
godot::Error _add_ice_candidate(const godot::String &sdpMidName, int32_t sdpMlineIndexName, const godot::String &sdpName) override;
|
||||
#endif
|
||||
godot::Error _poll() override;
|
||||
void _close() override;
|
||||
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
/*************************************************************************/
|
||||
/* init_gdextension.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* init_gdextension.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
#include <gdextension_interface.h>
|
||||
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
#include <godot_cpp/core/defs.hpp>
|
||||
@@ -66,7 +66,11 @@ void unregister_webrtc_extension_types(ModuleInitializationLevel p_level) {
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
GDNativeBool GDN_EXPORT webrtc_extension_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) {
|
||||
#ifdef GDEXTENSION_WEBRTC_40
|
||||
GDExtensionBool GDE_EXPORT webrtc_extension_init(const GDExtensionInterface *p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
|
||||
#else
|
||||
GDExtensionBool GDE_EXPORT webrtc_extension_init(const GDExtensionInterfaceGetProcAddress p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
|
||||
#endif
|
||||
GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
|
||||
|
||||
init_obj.register_initializer(register_webrtc_extension_types);
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* init_gdnative.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* init_gdnative.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "WebRTCLibDataChannel.hpp"
|
||||
#include "WebRTCLibPeerConnection.hpp"
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* WebRTCDataChannelNative.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* WebRTCDataChannelNative.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "WebRTCDataChannelNative.hpp"
|
||||
#include "net/WebRTCPeerConnectionNative.hpp"
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* WebRTCDataChannelNative.hpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* WebRTCDataChannelNative.hpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEBRTC_DATA_CHANNEL_NATIVE
|
||||
#define WEBRTC_DATA_CHANNEL_NATIVE
|
||||
@@ -119,21 +119,21 @@ public:
|
||||
virtual ChannelState _get_ready_state() const = 0;
|
||||
virtual godot::String _get_label() const = 0;
|
||||
virtual bool _is_ordered() const = 0;
|
||||
virtual int64_t _get_id() const = 0;
|
||||
virtual int64_t _get_max_packet_life_time() const = 0;
|
||||
virtual int64_t _get_max_retransmits() const = 0;
|
||||
virtual int32_t _get_id() const = 0;
|
||||
virtual int32_t _get_max_packet_life_time() const = 0;
|
||||
virtual int32_t _get_max_retransmits() const = 0;
|
||||
virtual godot::String _get_protocol() const = 0;
|
||||
virtual bool _is_negotiated() const = 0;
|
||||
virtual int64_t _get_buffered_amount() const = 0;
|
||||
virtual int32_t _get_buffered_amount() const = 0;
|
||||
|
||||
virtual godot::Error _poll() = 0;
|
||||
virtual void _close() = 0;
|
||||
|
||||
/* PacketPeer */
|
||||
virtual godot::Error _get_packet(const uint8_t **r_buffer, int32_t *r_len) = 0;
|
||||
virtual godot::Error _put_packet(const uint8_t *p_buffer, int64_t p_len) = 0;
|
||||
virtual int64_t _get_available_packet_count() const = 0;
|
||||
virtual int64_t _get_max_packet_size() const = 0;
|
||||
virtual godot::Error _put_packet(const uint8_t *p_buffer, int32_t p_len) = 0;
|
||||
virtual int32_t _get_available_packet_count() const = 0;
|
||||
virtual int32_t _get_max_packet_size() const = 0;
|
||||
|
||||
~WebRTCDataChannelNative();
|
||||
};
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* WebRTCPeerConnectionNative.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* WebRTCPeerConnectionNative.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "WebRTCPeerConnectionNative.hpp"
|
||||
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*************************************************************************/
|
||||
/* WebRTCPeerConnectionNative.hpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
/**************************************************************************/
|
||||
/* WebRTCPeerConnectionNative.hpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEBRTC_PEER_NATIVE
|
||||
#define WEBRTC_PEER_NATIVE
|
||||
|
||||
82
thirdparty/README.md
vendored
Normal file
82
thirdparty/README.md
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
# Third party libraries
|
||||
|
||||
Please keep categories (`##` level) listed alphabetically and matching their
|
||||
respective folder names. Use two empty lines to separate categories for
|
||||
readability.
|
||||
|
||||
|
||||
## json
|
||||
|
||||
- Upstream: https://github.com/nlohmann/json
|
||||
- Version: 3.11.2 (bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d, 2022)
|
||||
- License: MIT
|
||||
|
||||
Module location:
|
||||
|
||||
- thirdparty/libdatachannel/deps/json
|
||||
|
||||
|
||||
## libdatachannel
|
||||
|
||||
- Upstream: https://github.com/paullouisageneau/libdatachannel
|
||||
- Version: 0.19.3 (2cea8358c7d8381c9af2caf06cee0f72ebb91b1b, 2023)
|
||||
- License: MPL 2.0
|
||||
|
||||
Module location:
|
||||
|
||||
- thirdparty/libdatachannel
|
||||
|
||||
|
||||
# libjuice
|
||||
|
||||
- Upstream: https://github.com/paullouisageneau/libjuice
|
||||
- Version: 1.3.3 (5f753cad49059cea4eb492eb5c11a3bbb4dd6324, 2023)
|
||||
- License: MPL 2.0
|
||||
|
||||
Module location:
|
||||
|
||||
- thirdparty/libdatachannel/deps/libjuice
|
||||
|
||||
|
||||
## libsrtp
|
||||
|
||||
- Upstream: https://github.com/cisco/libsrtp
|
||||
- Version: 2.5.0 (a566a9cfcd619e8327784aa7cff4a1276dc1e895, 2023)
|
||||
- License: BSD-3-Clause
|
||||
|
||||
Module location:
|
||||
|
||||
- thirdparty/libdatachannel/deps/libsrtp
|
||||
|
||||
|
||||
## openssl
|
||||
|
||||
- Upstream: git://git.openssl.org/openssl.git
|
||||
- Version: 3.0.11 (6ba3884c3235e1bb474b379026087f8216afacf4, 2023)
|
||||
- License: Apache 2.0
|
||||
|
||||
Module location:
|
||||
|
||||
- thirdparty/openssl
|
||||
|
||||
|
||||
## plog
|
||||
|
||||
- Upstream: https://github.com/SergiusTheBest/plog
|
||||
- Version: 1.1.10 (e21baecd4753f14da64ede979c5a19302618b752, 2023)
|
||||
- License: MIT
|
||||
|
||||
Module location:
|
||||
|
||||
- thirdparty/libdatachannel/deps/plog
|
||||
|
||||
|
||||
## usrsctp
|
||||
|
||||
- Upstream: https://github.com/sctplab/usrsctp
|
||||
- Version: git (5ca29ac7d8055802c7657191325c06386640ac24, 2023)
|
||||
- License: BSD-3-Clause
|
||||
|
||||
Module location:
|
||||
|
||||
- thirdparty/libdatachannel/deps/usrsctp
|
||||
1
thirdparty/libdatachannel
vendored
Submodule
1
thirdparty/libdatachannel
vendored
Submodule
Submodule thirdparty/libdatachannel added at 2cea8358c7
1
thirdparty/openssl
vendored
Submodule
1
thirdparty/openssl
vendored
Submodule
Submodule thirdparty/openssl added at 6ba3884c32
135
tools/cmake.py
Normal file
135
tools/cmake.py
Normal file
@@ -0,0 +1,135 @@
|
||||
import os, sys
|
||||
|
||||
import SCons.Util
|
||||
import SCons.Builder
|
||||
import SCons.Action
|
||||
|
||||
|
||||
def cmake_default_flags(env):
|
||||
if env.get("cmake_default_flags", ""):
|
||||
return SCons.Util.CLVar(env["cmake_default_flags"])
|
||||
|
||||
config = {}
|
||||
|
||||
if "CC" in env:
|
||||
config["CMAKE_C_COMPILER"] = env["CC"]
|
||||
if "CXX" in env:
|
||||
config["CMAKE_CXX_COMPILER"] = env["CXX"]
|
||||
|
||||
if env["platform"] == "android":
|
||||
api = env["android_api_level"]
|
||||
abi = {
|
||||
"arm64": "arm64-v8a",
|
||||
"arm32": "armeabi-v7a",
|
||||
"x86_32": "x86",
|
||||
"x86_64": "x86_64",
|
||||
}[env["arch"]]
|
||||
config["CMAKE_SYSTEM_NAME"] = "Android"
|
||||
config["CMAKE_SYSTEM_VERSION"] = api
|
||||
config["CMAKE_ANDROID_ARCH_ABI"] = abi
|
||||
config["ANDROID_ABI"] = abi
|
||||
config["CMAKE_TOOLCHAIN_FILE"] = "%s/build/cmake/android.toolchain.cmake" % env.get(
|
||||
"ANDROID_NDK_ROOT", os.environ.get("ANDROID_NDK_ROOT", "")
|
||||
)
|
||||
config["CMAKE_ANDROID_STL_TYPE"] = "c++_static"
|
||||
|
||||
elif env["platform"] == "linux":
|
||||
linux_flags = {
|
||||
"x86_64": "-m64",
|
||||
"x86_32": "-m32",
|
||||
}.get(env["arch"], "")
|
||||
if linux_flags:
|
||||
config["CMAKE_C_FLAGS"] = linux_flags
|
||||
config["CMAKE_CXX_FLAGS"] = linux_flags
|
||||
|
||||
elif env["platform"] == "macos":
|
||||
if env["arch"] == "universal":
|
||||
config["CMAKE_OSX_ARCHITECTURES"] = '"x86_64;arm64"'
|
||||
else:
|
||||
config["CMAKE_OSX_ARCHITECTURES"] = env["arch"]
|
||||
if env["macos_deployment_target"] != "default":
|
||||
config["CMAKE_OSX_DEPLOYMENT_TARGET"] = env["macos_deployment_target"]
|
||||
|
||||
if env["platform"] == "macos" and sys.platform != "darwin" and "OSXCROSS_ROOT" in os.environ:
|
||||
config["CMAKE_AR"] = env["AR"]
|
||||
config["CMAKE_RANLIB"] = env["RANLIB"]
|
||||
if env["arch"] == "universal":
|
||||
flags = "-arch x86_64 -arch arm64"
|
||||
else:
|
||||
flags = "-arch " + env["arch"]
|
||||
if env["macos_deployment_target"] != "default":
|
||||
flags += " -mmacosx-version-min=" + env["macos_deployment_target"]
|
||||
config["CMAKE_C_FLAGS"] = flags
|
||||
config["CMAKE_CXX_FLAGS"] = flags
|
||||
|
||||
elif env["platform"] == "ios":
|
||||
if env["arch"] == "universal":
|
||||
raise ValueError("iOS architecture not supported: %s" % env["arch"])
|
||||
config["CMAKE_SYSTEM_NAME"] = "iOS"
|
||||
config["CMAKE_OSX_ARCHITECTURES"] = env["arch"]
|
||||
if env.get("ios_min_version", "default") != "default":
|
||||
config["CMAKE_OSX_DEPLOYMENT_TARGET"] = env["ios_min_version"]
|
||||
if env["ios_simulator"]:
|
||||
config["CMAKE_OSX_SYSROOT"] = "iphonesimulator"
|
||||
|
||||
elif env["platform"] == "windows":
|
||||
config["CMAKE_SYSTEM_NAME"] = "Windows"
|
||||
|
||||
flags = ["-D%s=%s" % it for it in config.items()]
|
||||
if env["CMAKEGENERATOR"]:
|
||||
flags.extend(["-G", env["CMAKEGENERATOR"]])
|
||||
elif env["platform"] == "windows":
|
||||
if env.get("is_msvc", False):
|
||||
flags.extend(["-G", "NMake Makefiles"])
|
||||
elif sys.platform in ["win32", "msys", "cygwin"]:
|
||||
flags.extend(["-G", "Ninja"])
|
||||
else:
|
||||
flags.extend(["-G", "Unix Makefiles"])
|
||||
return flags
|
||||
|
||||
|
||||
def cmake_emitter(target, source, env):
|
||||
return [str(target[0]) + "/CMakeCache.txt"] + target[1:], [str(source[0]) + "/CMakeLists.txt"] + source[1:]
|
||||
|
||||
|
||||
def cmake_generator(target, source, env, for_signature):
|
||||
# Strip the -j option for signature to avoid rebuilding when num_jobs changes.
|
||||
build = env["CMAKEBUILDCOM"].replace("-j$CMAKEBUILDJOBS", "") if for_signature else env["CMAKEBUILDCOM"]
|
||||
return [
|
||||
SCons.Action.Action("$CMAKECONFCOM", "$CMAKECONFCOMSTR"),
|
||||
SCons.Action.Action(build, "$CMAKEBUILDCOMSTR"),
|
||||
]
|
||||
|
||||
|
||||
def cmake_build(env, target_dir, source_dir, cmake_outputs=[], cmake_targets=[], cmake_options=[], dependencies=[]):
|
||||
cmake_env = env.Clone()
|
||||
target = env.Dir("{}/{}/{}".format(target_dir, env["platform"], env["arch"]))
|
||||
source = env.Dir(source_dir)
|
||||
builder_targets = [target] + [str(target) + "/" + f for f in cmake_outputs]
|
||||
builder_sources = [source] + dependencies
|
||||
cmake_env.Append(CMAKECONFFLAGS=["-D%s=%s" % it for it in cmake_options.items()])
|
||||
if len(cmake_targets) > 0:
|
||||
cmake_env.Append(CMAKEBUILDFLAGS=["-t"] + [t for t in cmake_targets])
|
||||
return cmake_env.CMake(builder_targets, builder_sources)
|
||||
|
||||
|
||||
def options(opts):
|
||||
opts.Add("cmake_default_flags", "Default CMake platform flags override, will be autodetected if not specified.", "")
|
||||
|
||||
|
||||
def exists(env):
|
||||
return True
|
||||
|
||||
|
||||
def generate(env):
|
||||
env["CMAKE"] = "cmake"
|
||||
env["_cmake_default_flags"] = cmake_default_flags
|
||||
env["CMAKEDEFAULTFLAGS"] = "${_cmake_default_flags(__env__)}"
|
||||
env["CMAKEGENERATOR"] = ""
|
||||
env["CMAKECONFFLAGS"] = SCons.Util.CLVar("")
|
||||
env["CMAKECONFCOM"] = "$CMAKE -B ${TARGET.dir} $CMAKEDEFAULTFLAGS $CMAKECONFFLAGS ${SOURCE.dir}"
|
||||
env["CMAKEBUILDJOBS"] = "${__env__.GetOption('num_jobs')}"
|
||||
env["CMAKEBUILDFLAGS"] = SCons.Util.CLVar("")
|
||||
env["CMAKEBUILDCOM"] = "$CMAKE --build ${TARGET.dir} $CMAKEBUILDFLAGS -j$CMAKEBUILDJOBS"
|
||||
env["BUILDERS"]["CMake"] = SCons.Builder.Builder(generator=cmake_generator, emitter=cmake_emitter)
|
||||
env.AddMethod(cmake_build, "CMakeBuild")
|
||||
286
tools/openssl.py
Normal file
286
tools/openssl.py
Normal file
@@ -0,0 +1,286 @@
|
||||
import os, sys
|
||||
import SCons.Util
|
||||
import SCons.Builder
|
||||
import SCons.Action
|
||||
from SCons.Defaults import Mkdir
|
||||
from SCons.Variables import PathVariable, BoolVariable
|
||||
|
||||
|
||||
def ssl_platform_target(env):
|
||||
targets = {}
|
||||
platform = env["platform"]
|
||||
if platform == "linux":
|
||||
targets = {
|
||||
"x86_32": "linux-x86",
|
||||
"x86_64": "linux-x86_64",
|
||||
"arm64": "linux-aarch64",
|
||||
"arm32": "linux-armv4",
|
||||
"rv64": "linux64-riscv64",
|
||||
}
|
||||
elif platform == "android":
|
||||
targets = {
|
||||
"arm64": "android-arm64",
|
||||
"arm32": "android-arm",
|
||||
"x86_32": "android-x86",
|
||||
"x86_64": "android-x86_64",
|
||||
}
|
||||
elif platform == "macos":
|
||||
targets = {
|
||||
"x86_64": "darwin64-x86_64",
|
||||
"arm64": "darwin64-arm64",
|
||||
}
|
||||
elif platform == "ios":
|
||||
if env["ios_simulator"]:
|
||||
targets = {
|
||||
"x86_64": "iossimulator-xcrun",
|
||||
"arm64": "iossimulator-xcrun",
|
||||
}
|
||||
else:
|
||||
targets = {
|
||||
"arm64": "ios64-xcrun",
|
||||
"arm32": "ios-xcrun",
|
||||
}
|
||||
elif platform == "windows":
|
||||
if env.get("is_msvc", False):
|
||||
targets = {
|
||||
"x86_32": "VC-WIN32",
|
||||
"x86_64": "VC-WIN64A",
|
||||
}
|
||||
else:
|
||||
targets = {
|
||||
"x86_32": "mingw",
|
||||
"x86_64": "mingw64",
|
||||
}
|
||||
|
||||
arch = env["arch"]
|
||||
target = targets.get(arch, "")
|
||||
if target == "":
|
||||
raise ValueError("Architecture '%s' not supported for platform: '%s'" % (arch, platform))
|
||||
return target
|
||||
|
||||
|
||||
def ssl_platform_options(env):
|
||||
ssl_config_options = [
|
||||
"no-ssl2",
|
||||
"no-ssl3",
|
||||
"no-weak-ssl-ciphers",
|
||||
"no-legacy",
|
||||
"no-shared",
|
||||
"no-tests",
|
||||
]
|
||||
if env["platform"] == "windows":
|
||||
ssl_config_options.append("enable-capieng")
|
||||
return ssl_config_options
|
||||
|
||||
|
||||
def ssl_platform_flags(env):
|
||||
args = []
|
||||
if env["platform"] == "android":
|
||||
if env.get("android_api_level", ""):
|
||||
api = int(env["android_api_level"])
|
||||
args.append("-D__ANDROID_API__=%s" % api)
|
||||
elif env["platform"] == "macos":
|
||||
# OSXCross toolchain setup.
|
||||
if sys.platform != "darwin" and "OSXCROSS_ROOT" in os.environ:
|
||||
for k in ["CC", "CXX", "AR", "AS", "RANLIB"]:
|
||||
args.append("%s=%s" % (k, env[k]))
|
||||
elif env["platform"] == "windows":
|
||||
is_win_host = sys.platform in ["win32", "msys", "cygwin"]
|
||||
if not (is_win_host or env.get("is_msvc", False)):
|
||||
mingw_prefixes = {
|
||||
"x86_32": "--cross-compile-prefix=i686-w64-mingw32-",
|
||||
"x86_64": "--cross-compile-prefix=x86_64-w64-mingw32-",
|
||||
}
|
||||
args.append(mingw_prefixes[env["arch"]])
|
||||
return args
|
||||
|
||||
|
||||
def ssl_configure_args(env):
|
||||
if env.get("openssl_configure_options", ""):
|
||||
opts = SCons.Util.CLVar(env["openssl_configure_options"])
|
||||
else:
|
||||
opts = ssl_platform_options(env)
|
||||
|
||||
if env.get("openssl_configure_target", ""):
|
||||
target = [env["openssl_configure_target"]]
|
||||
else:
|
||||
target = [ssl_platform_target(env)]
|
||||
|
||||
if env.get("openssl_configure_flags", ""):
|
||||
flags = SCons.Util.CLVar(env["openssl_configure_flags"])
|
||||
else:
|
||||
flags = ssl_platform_flags(env)
|
||||
|
||||
return opts + target + flags
|
||||
|
||||
|
||||
def ssl_emitter(target, source, env):
|
||||
return env["SSL_LIBS"], [env.File(env["SSL_SOURCE"] + "/Configure"), env.File(env["SSL_SOURCE"] + "/VERSION.dat")]
|
||||
|
||||
|
||||
def build_openssl(env, jobs=None):
|
||||
if env["SSL_EXTERNAL"]:
|
||||
# Setup the env to use the provided libraries, and return them without building.
|
||||
env.Prepend(CPPPATH=[env["SSL_INCLUDE"]])
|
||||
env.Prepend(LIBPATH=[env["SSL_BUILD"]])
|
||||
if env["platform"] == "windows":
|
||||
env.PrependUnique(LIBS=["crypt32", "ws2_32", "advapi32", "user32"])
|
||||
env.Prepend(LIBS=env["SSL_LIBS"])
|
||||
return [env["SSL_CRYPTO_LIBRARY"], env["SSL_LIBRARY"]]
|
||||
|
||||
if jobs is None:
|
||||
jobs = int(env.GetOption("num_jobs"))
|
||||
|
||||
# Since the OpenSSL build system does not support macOS universal binaries, we first need to build the two libraries
|
||||
# separately, then we join them together using lipo.
|
||||
if env["platform"] == "macos" and env["arch"] == "universal":
|
||||
build_envs = {
|
||||
"x86_64": env.Clone(),
|
||||
"arm64": env.Clone(),
|
||||
}
|
||||
arch_ssl = []
|
||||
for arch in build_envs:
|
||||
benv = build_envs[arch]
|
||||
benv["arch"] = arch
|
||||
generate(benv)
|
||||
benv["SSLBUILDJOBS"] = max([1, int(jobs / len(build_envs))])
|
||||
ssl = benv.OpenSSLBuilder()
|
||||
arch_ssl.extend(ssl)
|
||||
benv.NoCache(ssl) # Needs refactoring to properly cache generated headers.
|
||||
|
||||
# x86_64 and arm64 includes are equivalent.
|
||||
env["SSL_INCLUDE"] = build_envs["arm64"]["SSL_INCLUDE"]
|
||||
|
||||
# Join libraries using lipo.
|
||||
lipo_action = "lipo $SOURCES -create -output $TARGET"
|
||||
ssl_libs = list(map(lambda arch: build_envs[arch]["SSL_LIBRARY"], build_envs))
|
||||
ssl_crypto_libs = list(map(lambda arch: build_envs[arch]["SSL_CRYPTO_LIBRARY"], build_envs))
|
||||
ssl = env.Command(env["SSL_LIBRARY"], ssl_libs, lipo_action)
|
||||
ssl += env.Command(env["SSL_CRYPTO_LIBRARY"], ssl_crypto_libs, lipo_action)
|
||||
env.Depends(ssl, arch_ssl)
|
||||
else:
|
||||
benv = env.Clone()
|
||||
benv["SSLBUILDJOBS"] = jobs
|
||||
ssl = benv.OpenSSLBuilder()
|
||||
benv.NoCache(ssl) # Needs refactoring to properly cache generated headers.
|
||||
|
||||
# Setup the environment to use the freshly built openssl.
|
||||
env.Prepend(CPPPATH=[env["SSL_INCLUDE"]])
|
||||
env.Prepend(LIBPATH=[env["SSL_BUILD"]])
|
||||
if env["platform"] == "windows":
|
||||
env.PrependUnique(LIBS=["crypt32", "ws2_32", "advapi32", "user32"])
|
||||
env.Prepend(LIBS=env["SSL_LIBS"])
|
||||
|
||||
return ssl
|
||||
|
||||
|
||||
def ssl_generator(target, source, env, for_signature):
|
||||
# Strip the -j option for signature to avoid rebuilding when num_jobs changes.
|
||||
build = env["SSLBUILDCOM"].replace("-j$SSLBUILDJOBS", "") if for_signature else env["SSLBUILDCOM"]
|
||||
return [
|
||||
Mkdir("$SSL_BUILD"),
|
||||
Mkdir("$SSL_INSTALL"),
|
||||
SCons.Action.Action("$SSLCONFIGCOM", "$SSLCONFIGCOMSTR"),
|
||||
SCons.Action.Action(build, "$SSLBUILDCOMSTR"),
|
||||
]
|
||||
|
||||
|
||||
def options(opts):
|
||||
opts.Add(PathVariable("openssl_source", "Path to the openssl sources.", "thirdparty/openssl"))
|
||||
opts.Add("openssl_build", "Destination path of the openssl build.", "bin/thirdparty/openssl")
|
||||
opts.Add(
|
||||
"openssl_configure_options",
|
||||
"OpenSSL configure options override. Will use a reasonable default if not specified.",
|
||||
"",
|
||||
)
|
||||
opts.Add(
|
||||
"openssl_configure_target", "OpenSSL configure target override, will be autodetected if not specified.", ""
|
||||
)
|
||||
opts.Add(
|
||||
"openssl_configure_flags",
|
||||
"OpenSSL configure compiler flags override. Will be autodetected if not specified.",
|
||||
"",
|
||||
)
|
||||
opts.Add(
|
||||
"openssl_external_crypto",
|
||||
'An external libcrypto static library (e.g. "/usr/lib/x86_64-linux-gnu/libcrypto.a"). If not provided, OpenSSL will be built from source.',
|
||||
"",
|
||||
)
|
||||
opts.Add(
|
||||
"openssl_external_ssl",
|
||||
'An external libssl static library (e.g. "/usr/lib/x86_64-linux-gnu/libssl.a"). If not provided, OpenSSL will be built from source.',
|
||||
"",
|
||||
)
|
||||
opts.Add(
|
||||
"openssl_external_include",
|
||||
'An external OpenSSL "include" folder (e.g. "/usr/include/openssl").',
|
||||
"",
|
||||
)
|
||||
|
||||
|
||||
def exists(env):
|
||||
return True
|
||||
|
||||
|
||||
def generate(env):
|
||||
env.AddMethod(build_openssl, "OpenSSL")
|
||||
|
||||
# Check if the user specified infos about external OpenSSL files.
|
||||
external_opts = ["openssl_external_crypto", "openssl_external_ssl", "openssl_external_include"]
|
||||
is_set = lambda k: env.get(k, "") != ""
|
||||
if any(map(is_set, external_opts)):
|
||||
# Need provide the whole (crypto, ssl, include) triple to proceed.
|
||||
if not all(map(is_set, external_opts)):
|
||||
print('Error: The options "%s" must all be set to use a external library.' % '", "'.join(external_opts))
|
||||
sys.exit(255)
|
||||
|
||||
env["SSL_CRYPTO_LIBRARY"] = env.File("${openssl_external_crypto}")
|
||||
env["SSL_LIBRARY"] = env.File("${openssl_external_ssl}")
|
||||
env["SSL_BUILD"] = env.Dir("${SSL_LIBRARY.dir}").abspath
|
||||
env["SSL_INSTALL"] = env.Dir("${SSL_LIBRARY.dir}").abspath
|
||||
env["SSL_INCLUDE"] = env.Dir("${openssl_external_include}").abspath
|
||||
env["SSL_LIBS"] = [env["SSL_LIBRARY"], env["SSL_CRYPTO_LIBRARY"]]
|
||||
env["SSL_EXTERNAL"] = True
|
||||
return
|
||||
|
||||
# We will need to build our own OpenSSL library.
|
||||
env["SSL_EXTERNAL"] = False
|
||||
|
||||
# Android needs the NDK in ENV, and proper PATH setup.
|
||||
if env["platform"] == "android" and env["ENV"].get("ANDROID_NDK_ROOT", "") == "":
|
||||
cc_path = os.path.dirname(env["CC"])
|
||||
if cc_path and cc_path not in env["ENV"]:
|
||||
env.PrependENVPath("PATH", cc_path)
|
||||
if "ANDROID_NDK_ROOT" not in env["ENV"]:
|
||||
env["ENV"]["ANDROID_NDK_ROOT"] = env.get("ANDROID_NDK_ROOT", os.environ.get("ANDROID_NDK_ROOT", ""))
|
||||
|
||||
env["SSL_SOURCE"] = env.Dir(env["openssl_source"]).abspath
|
||||
env["SSL_BUILD"] = env.Dir(env["openssl_build"] + "/{}/{}".format(env["platform"], env["arch"])).abspath
|
||||
env["SSL_INSTALL"] = env.Dir(env["SSL_BUILD"] + "/dest").abspath
|
||||
env["SSL_INCLUDE"] = env.Dir(env["SSL_INSTALL"] + "/include").abspath
|
||||
lib_ext = ".lib" if env.get("is_msvc", False) else ".a"
|
||||
env["SSL_LIBRARY"] = env.File(env["SSL_BUILD"] + "/libssl" + lib_ext)
|
||||
env["SSL_CRYPTO_LIBRARY"] = env.File(env["SSL_BUILD"] + "/libcrypto" + lib_ext)
|
||||
env["SSL_LIBS"] = [env["SSL_LIBRARY"], env["SSL_CRYPTO_LIBRARY"]]
|
||||
|
||||
# Configure action
|
||||
env["PERL"] = env.get("PERL", "perl")
|
||||
env["_ssl_configure_args"] = ssl_configure_args
|
||||
env["SSLPLATFORMCONFIG"] = "${_ssl_configure_args(__env__)}"
|
||||
env["SSLCONFFLAGS"] = SCons.Util.CLVar("")
|
||||
# fmt: off
|
||||
env["SSLCONFIGCOM"] = 'cd ${TARGET.dir} && $PERL -- ${SOURCE.abspath} --prefix="${SSL_INSTALL}" --openssldir="${SSL_INSTALL}" $SSLPLATFORMCONFIG $SSLCONFFLAGS'
|
||||
# fmt: on
|
||||
|
||||
# Build action
|
||||
env["SSLBUILDJOBS"] = "${__env__.GetOption('num_jobs')}"
|
||||
# fmt: off
|
||||
env["SSLBUILDCOM"] = "make -j$SSLBUILDJOBS -C ${TARGET.dir} && make -j$SSLBUILDJOBS -C ${TARGET.dir} install_sw install_ssldirs"
|
||||
# fmt: on
|
||||
|
||||
# Windows MSVC needs to build using NMake
|
||||
if env["platform"] == "windows" and env.get("is_msvc", False):
|
||||
env["SSLBUILDCOM"] = "cd ${TARGET.dir} && nmake install_sw install_ssldirs"
|
||||
|
||||
env["BUILDERS"]["OpenSSLBuilder"] = SCons.Builder.Builder(generator=ssl_generator, emitter=ssl_emitter)
|
||||
env.AddMethod(build_openssl, "OpenSSL")
|
||||
51
tools/rtc.py
Normal file
51
tools/rtc.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import os
|
||||
|
||||
|
||||
def build_library(env, ssl):
|
||||
rtc_config = {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo" if env["debug_symbols"] else "Release",
|
||||
"USE_NICE": 0,
|
||||
"NO_WEBSOCKET": 1,
|
||||
"NO_EXAMPLES": 1,
|
||||
"NO_TESTS": 1,
|
||||
"BUILD_WITH_WARNINGS": "0", # Disables werror in libsrtp.
|
||||
"OPENSSL_USE_STATIC_LIBS": 1,
|
||||
"OPENSSL_INCLUDE_DIR": env["SSL_INCLUDE"],
|
||||
"OPENSSL_SSL_LIBRARY": env["SSL_LIBRARY"],
|
||||
"OPENSSL_CRYPTO_LIBRARY": env["SSL_CRYPTO_LIBRARY"],
|
||||
"OPENSSL_ROOT_DIR": env["SSL_INSTALL"],
|
||||
}
|
||||
is_msvc = env.get("is_msvc", False)
|
||||
lib_ext = ".lib" if is_msvc else ".a"
|
||||
lib_prefix = "" if is_msvc else "lib"
|
||||
rtc_libs = [
|
||||
"{}datachannel-static{}".format(lib_prefix, lib_ext),
|
||||
"deps/libjuice/{}juice-static{}".format(lib_prefix, lib_ext),
|
||||
"deps/libsrtp/{}srtp2{}".format(lib_prefix, lib_ext),
|
||||
"deps/usrsctp/usrsctplib/{}usrsctp{}".format(lib_prefix, lib_ext),
|
||||
]
|
||||
# Build libdatachannel
|
||||
rtc = env.CMakeBuild(
|
||||
"#bin/thirdparty/libdatachannel/",
|
||||
"#thirdparty/libdatachannel",
|
||||
cmake_options=rtc_config,
|
||||
cmake_outputs=rtc_libs,
|
||||
cmake_targets=["datachannel-static"],
|
||||
dependencies=ssl,
|
||||
)
|
||||
|
||||
# Configure env.
|
||||
if env["platform"] == "windows":
|
||||
env.PrependUnique(LIBS=["iphlpapi", "bcrypt"])
|
||||
env.Prepend(LIBS=list(filter(lambda f: str(f).endswith(lib_ext), rtc)))
|
||||
env.Append(CPPPATH=["#thirdparty/libdatachannel/include"])
|
||||
|
||||
return rtc
|
||||
|
||||
|
||||
def exists(env):
|
||||
return "CMake" in env
|
||||
|
||||
|
||||
def generate(env):
|
||||
env.AddMethod(build_library, "BuildLibDataChannel")
|
||||
Reference in New Issue
Block a user