support --proxy-to-worker with js target, emitting 2 files for client and worker
This commit is contained in:
Родитель
8e234c8bb4
Коммит
ac2c7bda57
18
emcc
18
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
|
||||
|
@ -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 }}}', 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')
|
||||
|
||||
|
|
|
@ -746,6 +746,13 @@ window.close = function() {
|
|||
def test_glgears_proxy(self):
|
||||
self.btest('hello_world_gles_proxy.c', reference='gears.png', args=['--proxy-to-worker', '-s', 'GL_TESTING=1'], manual_reference=True, post_build=self.post_manual_reftest)
|
||||
|
||||
def test_glgears_proxy_jstarget(self):
|
||||
# test .js target with --proxy-worker; emits 2 js files, client and worker
|
||||
Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_gles_proxy.c'), '-o', 'test.js', '--proxy-to-worker', '-s', 'GL_TESTING=1']).communicate()
|
||||
open('test.html', 'w').write(open(path_from_root('src', 'shell_minimal.html')).read().replace('{{{ SCRIPT }}}', '<script src="test.js"></script>'))
|
||||
self.post_manual_reftest()
|
||||
self.run_browser('test.html', None, '/report_result?0')
|
||||
|
||||
def test_sdl_canvas_alpha(self):
|
||||
self.btest('sdl_canvas_alpha.c', reference='sdl_canvas_alpha.png', reference_slack=9)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче