OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 import json | 3 import json |
4 import os | 4 import os |
5 import re | 5 import re |
6 import subprocess | 6 import subprocess |
7 import warnings | 7 import warnings |
8 | 8 |
9 EMSCRIPTEN_PATH = '../emscripten' | 9 EMSCRIPTEN_PATH = '../emscripten' |
10 SOURCE_DIR = './compiled' | 10 SOURCE_DIR = './compiled' |
11 SOURCE_FILES = [ | 11 SOURCE_FILES = [ |
12 os.path.join(SOURCE_DIR, f) | 12 os.path.join(path, f) |
13 for f in os.listdir(SOURCE_DIR) | 13 for (path, dirs, files) in os.walk(SOURCE_DIR) |
| 14 for f in files |
14 if f.endswith('.cpp') | 15 if f.endswith('.cpp') |
15 ] | 16 ] |
16 BINDINGS_FILE = os.path.join(SOURCE_DIR, 'bindings.cpp') | 17 BINDINGS_FILE = os.path.join(SOURCE_DIR, 'bindings.cpp') |
17 BINDINGS_GENERATOR = os.path.join(SOURCE_DIR, 'bindings.cpp.js') | 18 BINDINGS_GENERATOR = os.path.join(SOURCE_DIR, 'bindings.cpp.js') |
18 BINDINGS_OUTPUT = os.path.join(SOURCE_DIR, 'bindings.js') | 19 BINDINGS_OUTPUT = os.path.join(SOURCE_DIR, 'bindings.js') |
19 COMPILER_OUTPUT = './lib/compiled.js' | 20 COMPILER_OUTPUT = './lib/compiled.js' |
20 GENERATION_PARAMS = { | 21 GENERATION_PARAMS = { |
21 'SHELL_FILE': "'%s'" % os.path.abspath(os.path.join(SOURCE_DIR, 'shell.js')), | 22 'SHELL_FILE': "'%s'" % os.path.abspath(os.path.join(SOURCE_DIR, 'shell.js')), |
22 'ASM_JS': 2, # "almost asm" | 23 'ASM_JS': 2, # "almost asm" |
23 'TOTAL_MEMORY': 16*1024*1024, | 24 'TOTAL_MEMORY': 16*1024*1024, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 params.extend('-D' + flag for flag in DEFINES) | 71 params.extend('-D' + flag for flag in DEFINES) |
71 for key, value in GENERATION_PARAMS.iteritems(): | 72 for key, value in GENERATION_PARAMS.iteritems(): |
72 params.extend(['-s', '%s=%s' % (key, str(value))]) | 73 params.extend(['-s', '%s=%s' % (key, str(value))]) |
73 params.extend(ADDITIONAL_PARAMS) | 74 params.extend(ADDITIONAL_PARAMS) |
74 subprocess.check_call(params, env=env) | 75 subprocess.check_call(params, env=env) |
75 | 76 |
76 if __name__ == '__main__': | 77 if __name__ == '__main__': |
77 env = getenv() | 78 env = getenv() |
78 generate_bindings(env) | 79 generate_bindings(env) |
79 run_compiler(env) | 80 run_compiler(env) |
OLD | NEW |