cmake: use ALLOW_MEMORY_GROWTH=1 for web examples

The default memory limit for emscripten applications is 16 mergabytes,
which might be to little for some examples, especially given that the
resources are also included in that limit.

Normally, using this option disables some asm.js optimizations, but
there's no such cost for WebAssembly.
This commit is contained in:
Piotr Balcer 2019-01-20 14:49:22 +01:00
parent 0d2cfce18e
commit 1bfa1b8696

View file

@ -56,7 +56,10 @@ if(${PLATFORM} MATCHES "Android")
elseif(${PLATFORM} MATCHES "Web") elseif(${PLATFORM} MATCHES "Web")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1")
# Since WASM is used, ALLOW_MEMORY_GROWTH has no extra overheads
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 --no-heap-copy")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --shell-file ${CMAKE_SOURCE_DIR}/templates/web_shell/shell.html") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --shell-file ${CMAKE_SOURCE_DIR}/templates/web_shell/shell.html")
set(OUTPUT_EXT ".html") set(OUTPUT_EXT ".html")
endif() endif()