Left: | ||
Right: |
OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 import argparse | 3 import argparse |
4 import os | 4 import os |
5 import subprocess | 5 import subprocess |
6 import sys | 6 import sys |
7 | 7 |
8 BASE_DIR = os.path.dirname(__file__) | 8 BASE_DIR = os.path.dirname(__file__) |
9 SOURCE_DIR = os.path.join(BASE_DIR, 'compiled') | 9 SOURCE_DIR = os.path.join(BASE_DIR, 'compiled') |
10 SOURCE_FILES = [ | 10 SOURCE_FILES = [ |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 subprocess.check_call([env['NODE_JS'], BINDINGS_GENERATOR], | 61 subprocess.check_call([env['NODE_JS'], BINDINGS_GENERATOR], |
62 stdout=file) | 62 stdout=file) |
63 | 63 |
64 | 64 |
65 def run_compiler(env, debug=False, tracing=False): | 65 def run_compiler(env, debug=False, tracing=False): |
66 params = [ | 66 params = [ |
67 env['PYTHON'], os.path.join(env['EMSCRIPTEN'], 'emcc'), | 67 env['PYTHON'], os.path.join(env['EMSCRIPTEN'], 'emcc'), |
68 '-o', COMPILER_OUTPUT, | 68 '-o', COMPILER_OUTPUT, |
69 '--post-js', BINDINGS_OUTPUT, | 69 '--post-js', BINDINGS_OUTPUT, |
70 ] | 70 ] |
71 params.extend(SOURCE_FILES) | 71 # Order matters. We sort source files so that we always get the same |
sergei
2017/03/23 15:06:15
It looks strange, what is the difference between d
Wladimir Palant
2017/03/24 06:02:13
There is no "correct" order but each order will pr
| |
72 # results for the same source code. | |
73 params.extend(sorted(SOURCE_FILES)) | |
72 params.extend('-D' + flag for flag in DEFINES) | 74 params.extend('-D' + flag for flag in DEFINES) |
73 for key, value in GENERATION_PARAMS.iteritems(): | 75 for key, value in GENERATION_PARAMS.iteritems(): |
74 params.extend(['-s', '{}={}'.format(key, str(value))]) | 76 params.extend(['-s', '{}={}'.format(key, str(value))]) |
75 if debug: | 77 if debug: |
76 params.append('-g1') | 78 params.append('-g1') |
77 if tracing: | 79 if tracing: |
78 params.append('--tracing') | 80 params.append('--tracing') |
79 params.extend(ADDITIONAL_PARAMS) | 81 params.extend(ADDITIONAL_PARAMS) |
80 subprocess.check_call(params, env=env) | 82 subprocess.check_call(params, env=env) |
81 | 83 |
(...skipping 16 matching lines...) Expand all Loading... | |
98 parser.add_argument( | 100 parser.add_argument( |
99 '-t', '--tracing', | 101 '-t', '--tracing', |
100 action='store_true', | 102 action='store_true', |
101 help='Enable memory tracing' | 103 help='Enable memory tracing' |
102 ) | 104 ) |
103 args = parser.parse_args() | 105 args = parser.parse_args() |
104 | 106 |
105 env = getenv(args.emscripten_config) | 107 env = getenv(args.emscripten_config) |
106 generate_bindings(env) | 108 generate_bindings(env) |
107 run_compiler(env, debug=args.debug, tracing=args.tracing) | 109 run_compiler(env, debug=args.debug, tracing=args.tracing) |
OLD | NEW |