forked from tplgy/qwebrtc
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild_webrtc.py
executable file
·54 lines (44 loc) · 1.62 KB
/
build_webrtc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/python
import argparse
import os
import shutil
import subprocess
import sys
from multiprocessing import cpu_count
from distutils import spawn
parser = argparse.ArgumentParser()
#parser.add_argument("-o", "--out_dir", help="WebRTC build directory", action="store_true")
parser.add_argument("-c", "--clean", help="Clean WebRTC build", action="store_true")
parser.add_argument("-r", "--release", help="Build in release mode", action="store_true")
args = parser.parse_args()
if not spawn.find_executable("gclient"):
print("Could not find depot tools (https://www.chromium.org/developers/how-tos/install-depot-tools)")
exit(1)
main_dir = os.getcwd()
webrtc_dir = os.path.join(main_dir, "webrtc")
webrtc_src_dir = os.path.join(webrtc_dir, "src")
#WebRTC
if args.clean and os.path.exists(webrtc_dir):
shutil.rmtree(webrtc_dir)
print(webrtc_dir)
if not os.path.exists(webrtc_dir):
os.makedirs(webrtc_dir)
os.chdir(webrtc_dir)
r = subprocess.call("fetch --nohooks webrtc", shell=True)
if r != 0:
exit(r)
os.chdir(webrtc_src_dir)
r = subprocess.call("git checkout branch-heads/59", shell=True)
if r != 0:
exit(r)
r = subprocess.call("gclient sync --shallow", shell=True)
if r != 0:
exit(r)
os.chdir(webrtc_src_dir)
is_debug = "true"
if args.release:
is_debug = "false"
r = subprocess.call("gn gen out/Default --args='rtc_include_tests=false is_component_ffmpeg=true proprietary_codecs=true is_debug="+is_debug+" libyuv_include_tests=false rtc_use_h264=true rtc_use_gtk=false'", shell=True)
if r != 0:
exit(r)
exit(subprocess.call("ninja -C out/Default", shell=True))