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

Unified Diff: compile

Issue 29425555: Issue 5201 - [emscripten] Replace EM_ASM calls by a custom JavaScript library (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Created April 30, 2017, 6:54 a.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 | « no previous file | compiled/FilterNotifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compile
===================================================================
--- a/compile
+++ b/compile
@@ -17,16 +17,17 @@
import argparse
import os
import subprocess
import sys
BASE_DIR = os.path.dirname(__file__)
SOURCE_DIR = os.path.join(BASE_DIR, 'compiled')
+JS_LIBRARY = os.path.join(SOURCE_DIR, 'library.js')
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,
@@ -37,17 +38,17 @@ GENERATION_PARAMS = {
'NO_FILESYSTEM': 1,
'INVOKE_RUN': 0,
'TEXTDECODER': 0,
'EXPORTED_RUNTIME_METHODS': ['cwrap', 'ccall', 'stringToAscii'],
}
DEFINES = []
ADDITIONAL_PARAMS = ['-O3', '-m32', '-std=gnu++14', '--memory-init-file', '0',
'--emit-symbol-map', '-Wall', '-Werror', '-fno-exceptions',
- '-fno-rtti']
+ '-fno-rtti', '--js-library', JS_LIBRARY]
def get_source_files(phase):
for (path, dirs, files) in os.walk(SOURCE_DIR):
for f in files:
if os.path.splitext(f)[1] != '.cpp':
continue
if (
@@ -69,17 +70,17 @@ def getenv(emscripten_config):
'NODE_JS': scope.get('NODE_JS', 'node'),
})
return env
def generate_bindings(env):
params = [
env['PYTHON'], os.path.join(env['EMSCRIPTEN'], 'emcc'),
- '-o', BINDINGS_GENERATOR, '-std=gnu++14', '-DPRINT_BINDINGS',
+ '-o', BINDINGS_GENERATOR, '-std=gnu++14', '--js-library', JS_LIBRARY,
] + list(get_source_files('bindings'))
subprocess.check_call(params, env=env)
with open(BINDINGS_OUTPUT, 'w') as file:
subprocess.check_call([env['NODE_JS'], BINDINGS_GENERATOR],
stdout=file)
« no previous file with comments | « no previous file | compiled/FilterNotifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld