Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit f109b8e

Browse files
authored
Add a new argument sio_root for Socket.IO headers. (#686)
* Add a new argument sio_root for Socket.IO headers. With this argument, it would be easier for developers to upgrade Socket.IO cpp lib. * Remove check for socket.io from GN. setup-gn.py automatically generate configured build directories for iOS, which reports error because owt_sio_header_root is not set at that moment. https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/ios/build_instructions.md#setting-up-the-build
1 parent 8a3dd51 commit f109b8e

File tree

11 files changed

+50
-566
lines changed

11 files changed

+50
-566
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ Common build options shared by Windows and Linux:
6565
- By default `x86|Debug` library will be created. Specify `--arch x64` if you want to build x64 libraries; Specify `--scheme release` if release version of library is to be built.
6666
- The built binary will be under path specified by `--output_path`. If `--output_path` is not set, the built binary will be under `src/out` directory.
6767
- The optional `--ssl_root` should be set to the root directory of lastest OpenSSL 3.0 series directory. If specified, build tool will search external OpenSSL headers in `ssl_root/include` and OpenSSL binaries in `ssl_root/lib`. But binaries are not included in OWT SDK, so applications still need to link libcrypto and libssl.
68+
- The argument `--sio_root` should be set to the root directory of Socket.IO cpp 3.x SDK, with headers in `include` sub-folder, libsioclient_tls.a in `lib` sub-folder.
6869
- Use `--gn_gen` to generate args.gn during the first build or when you change either `ssl_root`/`msdk_root` options.
6970
- The optional `--tests` will trigger unit tests after build.
7071
- Run `build*.py` with `--help` for argument description.
7172

7273
#### iOS
73-
Update to latest macOS(Big Sur) and Xcode. iOS SDK can only be built on macOS.
74+
Update to latest macOS and Xcode. iOS SDK can only be built on macOS.
7475
1. Replace the last line of .gclient with target_os=["ios"]
7576
1. Run `gclient sync`. It may take a long time to download a large amount of data.
7677
1. Run `scripts\build.py`.

scripts/build-win.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
]
3838

3939

40-
def gngen(arch, ssl_root, msdk_root, quic_root, scheme, tests, runtime, cloud_gaming):
40+
def gngen(arch, sio_root, ssl_root, msdk_root, quic_root, scheme, tests, runtime, cloud_gaming):
4141
gn_args = list(GN_ARGS)
4242
gn_args.append('target_cpu="%s"' % arch)
4343
using_llvm = False
@@ -86,6 +86,9 @@ def gngen(arch, ssl_root, msdk_root, quic_root, scheme, tests, runtime, cloud_ga
8686
gn_args.append('owt_include_tests=false')
8787
if cloud_gaming:
8888
gn_args.append('owt_cloud_gaming=true')
89+
if sio_root:
90+
# If sio_root is not specified, conference SDK is not able to build.
91+
gn_args.append('owt_sio_header_root="%s"' % (sio_root + r'\include'))
8992
flattened_args = ' '.join(gn_args)
9093
ret = subprocess.call(['gn.bat', 'gen', getoutputpath(arch, scheme), '--args=%s' % flattened_args],
9194
cwd=HOME_PATH, shell=False)
@@ -100,7 +103,7 @@ def getoutputpath(arch, scheme):
100103

101104
def ninjabuild(arch, scheme):
102105
out_path = getoutputpath(arch, scheme)
103-
if subprocess.call(['ninja', '-C', out_path], cwd=HOME_PATH) != 0:
106+
if subprocess.call(['ninja.bat', '-C', out_path], cwd=HOME_PATH) != 0:
104107
return False
105108
return True
106109

@@ -169,6 +172,7 @@ def main():
169172
parser.add_argument('--ssl_root', help='Path for OpenSSL.')
170173
parser.add_argument('--msdk_root', help='Path for MSDK.')
171174
parser.add_argument('--quic_root', help='Path to QUIC library. Not supported yet.')
175+
parser.add_argument('--sio_root', required=True, help='Path to Socket.IO cpp. Headers in include sub-folder, libsioclient_tls.a in lib sub-folder.')
172176
parser.add_argument('--scheme', default='debug', choices=('debug', 'release'),
173177
help='Schemes for building. Supported value: debug, release')
174178
parser.add_argument('--gn_gen', default=False, action='store_true',
@@ -195,7 +199,7 @@ def main():
195199
print('Invalid quic_root')
196200
return 1
197201
if opts.gn_gen:
198-
if not gngen(opts.arch, opts.ssl_root, opts.msdk_root, opts.quic_root,
202+
if not gngen(opts.arch, opts.sio_root, opts.ssl_root, opts.msdk_root, opts.quic_root,
199203
opts.scheme, opts.tests, opts.runtime, opts.cloud_gaming):
200204
return 1
201205
if opts.sdk:

scripts/build.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
TEST_SCHEME = 'debug'
5454
TEST_SIMULATOR_DEVICE = 'iPhone X'
5555

56-
def gngen(arch, ssl_root, scheme):
56+
def gngen(arch, sio_root, ssl_root, scheme):
5757
gn_args = 'target_os="ios" target_cpu="%s" is_component_build=false '\
5858
'ios_enable_code_signing=false ios_deployment_target="11.0" '\
5959
'rtc_enable_symbol_export=true enable_dsyms=true use_custom_libcxx=false '\
@@ -62,6 +62,9 @@ def gngen(arch, ssl_root, scheme):
6262
gn_args += (' is_debug=false enable_stripping=true')
6363
else:
6464
gn_args += (' is_debug=true')
65+
if sio_root:
66+
# If sio_root is not specified, conference SDK is not able to build.
67+
gn_args += (' owt_sio_header_root="%s"' % (sio_root + '/include'))
6568
if ssl_root:
6669
gn_args += (' rtc_build_ssl=false rtc_ssl_root="%s" '\
6770
'libsrtp_ssl_root="%s"'%(ssl_root+'/include', ssl_root+'/include'))
@@ -164,6 +167,7 @@ def main():
164167
parser.add_argument('--arch', default='arm64', dest='target_arch',
165168
help='Target architectures. Could be multiple values separated by comma.')
166169
parser.add_argument('--ssl_root', help='Path for OpenSSL. Headers in include sub-folder, libcrypto.a and libssl.a in lib sub-folder.')
170+
parser.add_argument('--sio_root', required=True, help='Path to Socket.IO cpp. Headers in include sub-folder, libsioclient_tls.a in lib sub-folder.')
167171
parser.add_argument('--scheme', default='debug',
168172
help='Schemes for building. Supported value: debug, release')
169173
parser.add_argument('--skip_gn_gen', default=False, action='store_true',
@@ -186,14 +190,14 @@ def main():
186190
return 1
187191
else:
188192
if not opts.skip_gn_gen:
189-
if not gngen(arch_item, opts.ssl_root, opts.scheme):
193+
if not gngen(arch_item, opts.sio_root, opts.ssl_root, opts.scheme):
190194
return 1
191195
if not ninjabuild(arch_item, opts.scheme, SDK_TARGETS):
192196
return 1
193197
dist(opts.arch, opts.scheme)
194198
if not opts.skip_tests:
195199
if not opts.skip_gn_gen:
196-
if not gngen(TEST_ARCH, opts.ssl_root, TEST_SCHEME):
200+
if not gngen(TEST_ARCH, opts.sio_root, opts.ssl_root, TEST_SCHEME):
197201
return 1
198202
if not runtest(opts.ssl_root):
199203
return 1

talk/owt/BUILD.gn

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ declare_args() {
1111
include_internal_audio_device = true
1212
owt_msdk_lib_root = ""
1313
owt_msdk_header_root = ""
14+
owt_sio_header_root = ""
1415
}
1516

1617
# Introduced for using libvpx config files. We only enable libvpx rate
@@ -71,6 +72,8 @@ config("owt_common") {
7172
static_library("owt_deps") {
7273
deps = [
7374
"//third_party/webrtc/api:create_peerconnection_factory",
75+
"//third_party/webrtc/api/video_codecs:builtin_video_decoder_factory",
76+
"//third_party/webrtc/api/video_codecs:builtin_video_encoder_factory",
7477
"//third_party/webrtc/rtc_base:rtc_json",
7578
]
7679

@@ -417,6 +420,9 @@ static_library("owt_sdk_conf") {
417420
"sdk/include/cpp",
418421
"//third_party",
419422
]
423+
if (owt_sio_header_root != "") {
424+
include_dirs += [ owt_sio_header_root ]
425+
}
420426
sources = [
421427
"sdk/conference/conferenceclient.cc",
422428
"sdk/conference/conferencepeerconnectionchannel.cc",
@@ -466,6 +472,9 @@ if (is_ios) {
466472
"sdk/include/cpp",
467473
"sdk/include/objc",
468474
]
475+
if (owt_sio_header_root != "") {
476+
include_dirs += [ owt_sio_header_root ]
477+
}
469478
configs += [
470479
"//build/config/compiler:enable_arc",
471480
":owt_sdk_objc_warnings_config",

talk/owt/docs/cpp/cpp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ channel implementation, you can optionally link sioclient.lib or sioclient_tls.l
1919
OWT, please define WEBRTC_WIN for Windows build. If the OWT lib was built with Intel Media SDK (msdk_root is specified for
2020
build-win.py, or owt_msdk_header_root is defined in GN args), your app needs to define OWT_USE_MSDK as well.
2121
# 4 Socket.IO {#section4}
22-
Socket.IO cpp client is an open source project hosted on [Github](https://github.com/socketio/socket.io-client-cpp). Please follow official guide on GitHub to build and link it. The version works with OWT is b1216ee428dd7d1e72368da9b12aa43bfc487c93.
23-
The Socket.IO TLS feature is determined at compile time and cannot be switched at runtime. If you are using secure connections, link your application statically with sioclient_tls.lib; otherwise, link it with sioclient.lib. Please be noted the SDK library is linking to OpenSSL 1.1.1, so sioclient_tls.lib must be compiled using the same OpenSSL version.
22+
Socket.IO cpp client is an open source project hosted on [Github](https://github.com/socketio/socket.io-client-cpp). Please follow official guide on GitHub to build and link it. The version tested is 3e01111ddf9778a162c4c4bb91f795d2dd59f065.
23+
The Socket.IO TLS feature is determined at compile time and cannot be switched at runtime. If you are using secure connections, link your application statically with sioclient_tls.lib; otherwise, link it with sioclient.lib. Please be noted the SDK library and sioclient_tls.lib must be compiled using the same OpenSSL version.
2424
# 5 NAT and firewall traversal {#section5}
2525
Open WebRTC Toolkit Client SDK for Windows fully supports NAT and firewall traversal with STUN / TURN / ICE. The Coturn TURN server from https://github.com/coturn/coturn can be one choice.
2626
# 6 Customize signaling channel {#section6}

talk/owt/docs/ios/ios.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ Refer to the Release Notes for the latest information in the SDK release package
77
# 2 Supported platforms {#section2}
88
Open WebRTC Toolkit Client SDK for iOS supports in iOS 9.0 and later versions.
99
The following devices have been tested using this SDK:
10-
- iPhone* 6, 7 Plus and X.
11-
- iPad Air*
10+
- iPhone* X
11+
- iPad* Air
1212
# 3 Getting started {#section3}
1313
The release package includes two sample applications to get you started quickly with the SDK. The following three static libraries are provided in the SDK along with their respective headers:
1414
- OWT.framework - a framework providing the abilities to connect to conference server or another Open WebRTC Toolkit P2P endpoints.
1515
- WebRTC.framework - a framework providing WebRTC features. You can find its source code at https://webrtc.googlesource.com/src. We modified some code make it work with OpenSSL.
1616

1717
Please add -ObjC to "Other Linker Flags" in the your project's build settings.
1818
# 4 Socket.IO {#section4}
19-
OWT iOS SDK depends on Socket.IO cpp client, which is an open source project host on [Github](https://github.com/socketio/socket.io-client-cpp). Please follow official guide on GitHub to build and link it. The version works with OWT is b1216ee428dd7d1e72368da9b12aa43bfc487c93. OpenSSL version is 1.1.1 with the latest patch release.
19+
OWT iOS SDK depends on Socket.IO cpp client, which is an open source project host on [Github](https://github.com/socketio/socket.io-client-cpp). Please follow official guide on GitHub to build and link it. The version tested with OWT is 3e01111ddf9778a162c4c4bb91f795d2dd59f065. OpenSSL version is 1.1.1 with the latest patch release.
2020
Please make sure your app has network access before making Socket.IO connection. As Socket.IO cpp client uses low level network APIs, iOS system may not ask user for network permission. Thus, Socket.IO connection will fail because app does not have network access.
2121
The Socket.IO TLS feature is determined at compile time and cannot be switched at runtime. If you are using secure connections, link your application with libsioclient_tls.a; otherwise, link it with libsioclient.a.
2222
# 5 Background modes {#section5}

talk/owt/include/sio_client.h

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

0 commit comments

Comments
 (0)