Merge pull request #26 from prestomation/master

Modularize emscripten build.
This commit is contained in:
Rich Geldreich
2019-06-26 16:58:33 -07:00
committed by GitHub
5 changed files with 26 additions and 6 deletions

View File

@@ -15,7 +15,7 @@
<body>
<script>
Module.onRuntimeInitialized = () => {
BASIS().then(Module => {
const { BasisFile, initializeBasis } = Module;
@@ -97,7 +97,7 @@
}, false );
}
});
function log(s) {

View File

@@ -258,7 +258,7 @@ function viewAlpha() { drawMode = 2; redraw(); }
<div id='logger'></div>
</body>
<script>
Module.onRuntimeInitialized = () => {
BASIS({onRuntimeInitialized : () => {
var gl = elem('canvas').getContext('webgl');
// Load the DXT extension, and verify it exists.
if (!gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc') && !gl.getExtension('WEBGL_compressed_texture_s3tc')) {
@@ -275,6 +275,6 @@ function viewAlpha() { drawMode = 2; redraw(); }
}, false);
runLoadFile();
}
}}).then(module => window.Module = module);
</script>
</html>

View File

@@ -17,5 +17,5 @@ if (EMSCRIPTEN)
set_target_properties(basis_transcoder.js PROPERTIES
OUTPUT_NAME "basis_transcoder"
SUFFIX ".js"
LINK_FLAGS "--bind -s ALLOW_MEMORY_GROWTH=1 -O3 -s ASSERTIONS=0 -s MALLOC=emmalloc")
LINK_FLAGS "--bind -s ALLOW_MEMORY_GROWTH=1 -O3 -s ASSERTIONS=0 -s MALLOC=emmalloc -s MODULARIZE=1 -s EXPORT_NAME=BASIS ")
endif()

File diff suppressed because one or more lines are too long