Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: compile

Issue 29333474: Issue 4125 - [emscripten] Convert filter classes to C++ (Closed)
Left Patch Set: Replaced old filter classes unit tests completely Created Feb. 18, 2016, 4:40 p.m.
Right Patch Set: Addressed comments from Patch Set 28 Created March 21, 2017, 10:04 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « README.md ('k') | compiled/ActiveFilter.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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'
(...skipping 28 matching lines...) Expand all
39 env = {} 39 env = {}
40 output = subprocess.check_output([ 40 output = subprocess.check_output([
41 '/bin/bash', '-c', os.path.join(EMSCRIPTEN_PATH, 'emsdk_env.sh')]) 41 '/bin/bash', '-c', os.path.join(EMSCRIPTEN_PATH, 'emsdk_env.sh')])
42 for line in output.splitlines(): 42 for line in output.splitlines():
43 match = re.search(r'^\s*PATH\s*\+=\s*(.*)', line) 43 match = re.search(r'^\s*PATH\s*\+=\s*(.*)', line)
44 if match: 44 if match:
45 path.append(match.group(1)) 45 path.append(match.group(1))
46 match = re.search(r'^\s*(\w+)\s*=\s*(.*)', line) 46 match = re.search(r'^\s*(\w+)\s*=\s*(.*)', line)
47 if match: 47 if match:
48 env[match.group(1)] = match.group(2) 48 env[match.group(1)] = match.group(2)
49 env['PATH'] = ':'.join([os.environ['PATH']] + path) 49 env['PATH'] = os.pathsep.join([os.environ['PATH']] + path)
50 return env 50 return env
51 51
52 def generate_bindings(env): 52 def generate_bindings(env):
53 params = [os.path.join(env['EMSCRIPTEN'], 'emcc'), BINDINGS_FILE, 53 params = [os.path.join(env['EMSCRIPTEN'], 'emcc'), BINDINGS_FILE,
54 '-o', BINDINGS_GENERATOR, '-std=gnu++14', '-DPRINT_BINDINGS', 54 '-o', BINDINGS_GENERATOR, '-std=gnu++14', '-DPRINT_BINDINGS',
55 '-s', 'SAFE_HEAP=1', '-s', 'WARN_ON_UNDEFINED_SYMBOLS=0', 55 '-s', 'WARN_ON_UNDEFINED_SYMBOLS=0',
56 ] 56 ]
57 subprocess.check_call(params, env=env) 57 subprocess.check_call(params, env=env)
58 58
59 node = subprocess.check_output('which node', env=env, shell=True).strip(); 59 node = subprocess.check_output('which node', env=env, shell=True).strip();
60 with open(BINDINGS_OUTPUT, 'w') as file: 60 with open(BINDINGS_OUTPUT, 'w') as file:
61 subprocess.check_call([node, BINDINGS_GENERATOR], env=env, stdout=file) 61 subprocess.check_call([node, BINDINGS_GENERATOR], env=env, stdout=file)
62 62
63 def run_compiler(env): 63 def run_compiler(env):
64 params = [ 64 params = [
65 os.path.join(env['EMSCRIPTEN'], 'emcc'), 65 os.path.join(env['EMSCRIPTEN'], 'emcc'),
66 '-o', COMPILER_OUTPUT, 66 '-o', COMPILER_OUTPUT,
67 '--post-js', BINDINGS_OUTPUT, 67 '--post-js', BINDINGS_OUTPUT,
68 ] 68 ]
69 params.extend(SOURCE_FILES) 69 params.extend(SOURCE_FILES)
70 params.extend('-D' + flag for flag in DEFINES) 70 params.extend('-D' + flag for flag in DEFINES)
71 for key, value in GENERATION_PARAMS.iteritems(): 71 for key, value in GENERATION_PARAMS.iteritems():
72 params.extend(['-s', '%s=%s' % (key, str(value))]) 72 params.extend(['-s', '%s=%s' % (key, str(value))])
73 params.extend(ADDITIONAL_PARAMS) 73 params.extend(ADDITIONAL_PARAMS)
74 subprocess.check_call(params, env=env) 74 subprocess.check_call(params, env=env)
75 75
76 if __name__ == '__main__': 76 if __name__ == '__main__':
77 env = getenv() 77 env = getenv()
78 generate_bindings(env) 78 generate_bindings(env)
79 run_compiler(env) 79 run_compiler(env)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld