forked from langhuihui/jessibuca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.py
49 lines (43 loc) · 1.3 KB
/
make.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
#!/usr/bin/python
# import tools.shared as emscripten
import os
import sys
import getopt
from subprocess import Popen, PIPE, STDOUT
# exec(open(os.path.expanduser('~/.emscripten'), 'r').read())
# sys.path.append(EMSCRIPTEN_ROOT)
opts, args = getopt.getopt(sys.argv[1:], "o:", ["wasm"])
args = {'-o': 'demo/public/ff'}
for op, value in opts:
args[op] = value
# args['-o'] = args['-o'] + ('_wasm' if '--wasm' in args else '')
sargs = {
# 'USE_PTHREADS': 0 if '--cocos' in args else 1,
'WASM': 1 if '--wasm' in args else 0,
'TOTAL_MEMORY': 67108864,
'ASSERTIONS': 0,
'ERROR_ON_UNDEFINED_SYMBOLS': 0,
'DISABLE_EXCEPTION_CATCHING': 1,
# 'ALLOW_MEMORY_GROWTH':1,
# 'ENVIRONMENT':'"worker"',
'INVOKE_RUN':0,
'USE_PTHREADS': 0
# 'DEMANGLE_SUPPORT':1
}
emcc_args = [
# '-m32',
'-Oz',
'--memory-init-file', '0',
# '--closure', '1',
# '--llvm-lto','1',
'--bind',
'-I.', '-Iobj/include',
'--post-js','src/post.js'
]+["-s "+k+"="+str(v) for k, v in sargs.items()]
# if '--cocos' in args:
# emcc_args.append('--post-js cocosCom.js')
print ('building...')
emcc_args = ['obj/lib/libavcodec.a','obj/lib/libavutil.a','obj/lib/libswresample.a']+emcc_args
os.system('emcc Jessibuca.cpp ' +
(' '.join(emcc_args)) + ' -o '+args['-o']+'.js')
print ('done')