Fix LZ4 file packaging support when MODULARIZE=1 (#13161)
This is based on work by @mdboom in #7107
This commit is contained in:
Родитель
5dc63ff777
Коммит
dd827d65d2
1
AUTHORS
1
AUTHORS
|
@ -533,4 +533,5 @@ a license to everyone to use it as detailed in LICENSE.)
|
|||
* Aleksey Kliger <aleksey@lambdageek.org> (copyright owned by Microsoft, Inc.)
|
||||
* Nicolas Ollinger <nopid@free.fr>
|
||||
* Michael R. Crusoe <crusoe@debian.org>
|
||||
* Dexter Chua <dec41@srcf.net>
|
||||
* Thomas Ballinger <thomasballinger@gmail.com>
|
||||
|
|
3
emcc.py
3
emcc.py
|
@ -1148,6 +1148,9 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
|
|||
# we also do not support standalone mode in fastcomp.
|
||||
shared.Settings.STANDALONE_WASM = 1
|
||||
|
||||
if shared.Settings.LZ4:
|
||||
shared.Settings.EXPORTED_RUNTIME_METHODS += ['LZ4']
|
||||
|
||||
if shared.Settings.WASM2C:
|
||||
# wasm2c only makes sense with standalone wasm - there will be no JS,
|
||||
# just wasm and then C
|
||||
|
|
|
@ -1383,6 +1383,15 @@ keydown(100);keyup(100); // trigger the end
|
|||
self.btest(os.path.join('fs', 'test_lz4fs.cpp'), '2', args=['--pre-js', 'files.js', '-s', 'LZ4=1', '-s', 'FORCE_FILESYSTEM'])
|
||||
print(' opts')
|
||||
self.btest(os.path.join('fs', 'test_lz4fs.cpp'), '2', args=['--pre-js', 'files.js', '-s', 'LZ4=1', '-s', 'FORCE_FILESYSTEM', '-O2'])
|
||||
print(' modularize')
|
||||
self.compile_btest([path_from_root('tests', 'fs', 'test_lz4fs.cpp'), '--pre-js', 'files.js', '-s', 'LZ4=1', '-s', 'FORCE_FILESYSTEM', '-s', 'MODULARIZE=1'])
|
||||
create_test_file('a.html', '''
|
||||
<script src="a.out.js"></script>
|
||||
<script>
|
||||
Module()
|
||||
</script>
|
||||
''')
|
||||
self.run_browser('a.html', '.', '/report_result?2')
|
||||
|
||||
# load the data into LZ4FS manually at runtime. This means we compress on the client. This is generally not recommended
|
||||
print('manual')
|
||||
|
|
|
@ -514,8 +514,8 @@ def main():
|
|||
use_data = '''
|
||||
var compressedData = %s;
|
||||
compressedData['data'] = byteArray;
|
||||
assert(typeof LZ4 === 'object', 'LZ4 not present - was your app build with -s LZ4=1 ?');
|
||||
LZ4.loadPackage({ 'metadata': metadata, 'compressedData': compressedData });
|
||||
assert(typeof Module.LZ4 === 'object', 'LZ4 not present - was your app build with -s LZ4=1 ?');
|
||||
Module.LZ4.loadPackage({ 'metadata': metadata, 'compressedData': compressedData });
|
||||
Module['removeRunDependency']('datafile_%s');
|
||||
''' % (meta, shared.JS.escape_for_js_string(data_target))
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче