mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 05:38:22 +01:00
cmake,emscripten: explicitly set stack size
The default was changed from 5MB to 64KB in 3.1.27 [1] causing image decodes to fail. This restores the old default. In testing, 1536KB was enough for the sample image, 1024KB was not. [1]: https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#3127---112922 Bug: webp:614 Change-Id: I1ff7afc72fa49d88d2efe88d2a04dfadbea3b1a5 Fixed: webp:614 Test: emcc 3.1.18 & 3.1.41
This commit is contained in:
parent
59a2b1f9e3
commit
ebb6f949f4
@ -651,6 +651,16 @@ if(WEBP_BUILD_EXTRAS)
|
||||
endif()
|
||||
|
||||
if(WEBP_BUILD_WEBP_JS)
|
||||
# The default stack size changed from 5MB to 64KB in 3.1.27. See
|
||||
# https://crbug.com/webp/614.
|
||||
if(EMSCRIPTEN_VERSION VERSION_GREATER_EQUAL "3.1.27")
|
||||
# TOTAL_STACK size was renamed to STACK_SIZE in 3.1.27. The old name was
|
||||
# kept for compatibility, but prefer the new one in case it is removed in
|
||||
# the future.
|
||||
set(emscripten_stack_size "-sSTACK_SIZE=5MB")
|
||||
else()
|
||||
set(emscripten_stack_size "-sTOTAL_STACK=5MB")
|
||||
endif()
|
||||
# wasm2js does not support SIMD.
|
||||
if(NOT WEBP_ENABLE_SIMD)
|
||||
# JavaScript version
|
||||
@ -660,7 +670,7 @@ if(WEBP_BUILD_WEBP_JS)
|
||||
set(WEBP_HAVE_SDL 1)
|
||||
set_target_properties(
|
||||
webp_js
|
||||
PROPERTIES LINK_FLAGS "-sWASM=0 \
|
||||
PROPERTIES LINK_FLAGS "-sWASM=0 ${emscripten_stack_size} \
|
||||
-sEXPORTED_FUNCTIONS=_WebPToSDL -sINVOKE_RUN=0 \
|
||||
-sEXPORTED_RUNTIME_METHODS=cwrap")
|
||||
set_target_properties(webp_js PROPERTIES OUTPUT_NAME webp)
|
||||
@ -673,7 +683,7 @@ if(WEBP_BUILD_WEBP_JS)
|
||||
target_include_directories(webp_wasm PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(
|
||||
webp_wasm
|
||||
PROPERTIES LINK_FLAGS "-sWASM=1 \
|
||||
PROPERTIES LINK_FLAGS "-sWASM=1 ${emscripten_stack_size} \
|
||||
-sEXPORTED_FUNCTIONS=_WebPToSDL -sINVOKE_RUN=0 \
|
||||
-sEXPORTED_RUNTIME_METHODS=cwrap")
|
||||
target_compile_definitions(webp_wasm PUBLIC EMSCRIPTEN WEBP_HAVE_SDL)
|
||||
|
Loading…
Reference in New Issue
Block a user