summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Massimino <pascal.massimino@gmail.com>2018-04-03 13:55:33 +0200
committerPascal Massimino <pascal.massimino@gmail.com>2018-04-03 13:56:53 +0200
commitfc1b8e3a8bd5fc7bac79cfe7f46daf6441f4ef7c (patch)
treed70afd2ab997fdb696f456c3512d67c3f40e6bd6
parent15aa48d905a7a00f13d018ed9574c3c9b70d96af (diff)
downloadlibwebp-fc1b8e3a8bd5fc7bac79cfe7f46daf6441f4ef7c.tar.gz
webp_js: fix webp_js demo html
We need to export 'Module.cwrap' method. Change-Id: I2986c5a4c06630ae3f95086a114e727a86c99a2b
-rw-r--r--CMakeLists.txt6
-rw-r--r--README.webp_js3
2 files changed, 6 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 79477a45..a3b7a436 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -289,7 +289,8 @@ if(WEBP_BUILD_WEBP_JS)
target_link_libraries(webp_js webpdecoder SDL)
set(WEBP_HAVE_SDL 1)
set_target_properties(webp_js PROPERTIES LINK_FLAGS
- "-s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0")
+ "-s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0 \
+ -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"cwrap\"]'")
set_target_properties(webp_js PROPERTIES OUTPUT_NAME webp)
target_compile_definitions(webp_js PUBLIC EMSCRIPTEN WEBP_HAVE_SDL)
@@ -299,7 +300,8 @@ if(WEBP_BUILD_WEBP_JS)
target_link_libraries(webp_wasm webpdecoder SDL)
set_target_properties(webp_wasm PROPERTIES LINK_FLAGS
"-s WASM=1 -s 'BINARYEN_METHOD=\"native-wasm\"' \
- -s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0")
+ -s EXPORTED_FUNCTIONS='[\"_WebpToSDL\"]' -s INVOKE_RUN=0 \
+ -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"cwrap\"]'")
target_compile_definitions(webp_wasm PUBLIC EMSCRIPTEN WEBP_HAVE_SDL)
target_compile_definitions(webpdecoder PUBLIC EMSCRIPTEN)
diff --git a/README.webp_js b/README.webp_js
index 04f4970b..2805354d 100644
--- a/README.webp_js
+++ b/README.webp_js
@@ -32,7 +32,8 @@ using Emscripten and CMake.
webp.js.mem files generated.
The callable JavaScript function is WebPToSDL(), which decodes a raw WebP
-bitstream into a canvas. See webp_js/index.html for a simple usage sample.
+bitstream into a canvas. See webp_js/index.html for a simple usage sample
+(see below for instructions).
Demo HTML page:
===============