aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc23
1 files changed, 15 insertions, 8 deletions
diff --git a/emcc b/emcc
index 20f04dd1..e10d260d 100755
--- a/emcc
+++ b/emcc
@@ -503,8 +503,13 @@ Options that are modified or new in %s include:
to hide these warnings and acknowledge that the
explicit use of absolute paths is intentional.
- --proxy-to-worker Generates both html and js files. The main
- program is in js, and the html proxies to/from it.
+ --proxy-to-worker Runs the main application code in a worker, proxying
+ events to it and output from it.
+ If emitting htmlL, this emits an html and a js file,
+ with the js to be run in a worker. If emitting
+ js, the target filename contains the part to be run
+ on the main thread, while a second js file with
+ suffix ".worker.js" will contain the worker portion.
--emrun Enables the generated output to be aware of the
emrun command line tool. This allows stdout, stderr
@@ -1832,7 +1837,7 @@ try:
js_target = unsuffixed(target) + '.js'
base_js_target = os.path.basename(js_target)
if proxy_to_worker:
- html.write(shell.replace('{{{ SCRIPT }}}', '<script>' + open(shared.path_from_root('src', 'proxyClient.js')).read().replace('{{{ filename }}}', target_basename) + '</script>'))
+ html.write(shell.replace('{{{ SCRIPT }}}', '<script>' + open(shared.path_from_root('src', 'webGLClient.js')).read() + '\n' + open(shared.path_from_root('src', 'proxyClient.js')).read().replace('{{{ filename }}}', shared.Settings.PROXY_TO_WORKER_FILENAME or target_basename) + '</script>'))
shutil.move(final, js_target)
elif not Compression.on:
# Normal code generation path
@@ -1977,8 +1982,13 @@ try {
split_javascript_file(final, unsuffixed(target), split_js_file)
else:
if debug_level >= 4: generate_source_map(target)
- # copy final JS to output
- shutil.move(final, target)
+ if proxy_to_worker:
+ worker_target_basename = target_basename + '.worker'
+ open(target, 'w').write(open(shared.path_from_root('src', 'webGLClient.js')).read() + '\n' + open(shared.path_from_root('src', 'proxyClient.js')).read().replace('{{{ filename }}}', shared.Settings.PROXY_TO_WORKER_FILENAME or worker_target_basename))
+ shutil.move(final, target[:-3] + '.worker.js')
+ else:
+ # copy final JS to output normally
+ shutil.move(final, target)
log_time('final emitting')
@@ -1993,6 +2003,3 @@ finally:
else:
logging.info('emcc saved files are in:' + temp_dir)
-#//eliminate a = a in js opt. will kill STACKTOP = STACKTOP in funcs that do not use the C stack! add test for no STACKTOP or sp in such a func
-#// minify if into ?: ?
-