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

Unified Diff: compile

Issue 29398655: Issue 5062 - [emscripten] Allow generation of custom bindings code (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Rebased Created April 13, 2017, 1:06 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « README.md ('k') | compiled/bindings.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compile
===================================================================
--- a/compile
+++ b/compile
@@ -23,17 +23,16 @@ import sys
BASE_DIR = os.path.dirname(__file__)
SOURCE_DIR = os.path.join(BASE_DIR, 'compiled')
SOURCE_FILES = [
os.path.join(path, f)
for (path, dirs, files) in os.walk(SOURCE_DIR)
for f in files
if f.endswith('.cpp')
]
-BINDINGS_FILE = os.path.join(SOURCE_DIR, 'bindings.cpp')
BINDINGS_GENERATOR = os.path.join(SOURCE_DIR, 'bindings.cpp.js')
BINDINGS_OUTPUT = os.path.join(SOURCE_DIR, 'bindings.js')
COMPILER_OUTPUT = os.path.join(BASE_DIR, 'lib', 'compiled.js')
GENERATION_PARAMS = {
'SHELL_FILE': "'{}'".format(os.path.abspath(os.path.join(SOURCE_DIR,
'shell.js'))),
'ASM_JS': 2, # "almost asm"
'TOTAL_MEMORY': 16*1024*1024,
@@ -61,20 +60,19 @@ def getenv(emscripten_config):
'PYTHON': scope.get('PYTHON', sys.executable),
'NODE_JS': scope.get('NODE_JS', 'node'),
})
return env
def generate_bindings(env):
params = [
- env['PYTHON'], os.path.join(env['EMSCRIPTEN'], 'emcc'), BINDINGS_FILE,
+ env['PYTHON'], os.path.join(env['EMSCRIPTEN'], 'emcc'),
'-o', BINDINGS_GENERATOR, '-std=gnu++14', '-DPRINT_BINDINGS',
- '-s', 'WARN_ON_UNDEFINED_SYMBOLS=0',
- ]
+ ] + SOURCE_FILES
subprocess.check_call(params, env=env)
with open(BINDINGS_OUTPUT, 'w') as file:
subprocess.check_call([env['NODE_JS'], BINDINGS_GENERATOR],
stdout=file)
def run_compiler(env, debug=False, tracing=False):
« no previous file with comments | « README.md ('k') | compiled/bindings.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld