diff options
author | Ben Smith <binji@chromium.org> | 2020-06-18 15:59:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-18 15:59:01 -0700 |
commit | 51db8c621d95e6037f8d5455558d8935c98b5a22 (patch) | |
tree | 56bd307320f695464f2269c12a87e4b7fedc77f1 /CMakeLists.txt | |
parent | f80108f417951064f6082dd2bfc52d6af75a8e65 (diff) | |
download | wabt-51db8c621d95e6037f8d5455558d8935c98b5a22.tar.gz wabt-51db8c621d95e6037f8d5455558d8935c98b5a22.tar.bz2 wabt-51db8c621d95e6037f8d5455558d8935c98b5a22.zip |
Update libwabt.js; fix some runtime issues (#1468)
libwabt.js is meant to be included in multiple environments (web,
node.js, etc.) so it shouldn't be using NODERAWFS. A recent change to
the build system include `-s NODERAWFS` for all link steps, but those
are only needed for the wabt executables (e.g. wasm2wast.js).
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index dd12d663..7f5c28b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -381,6 +381,15 @@ function(wabt_executable) set_property(TARGET ${EXE_NAME} PROPERTY CXX_STANDARD 11) set_property(TARGET ${EXE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) + if (EMSCRIPTEN) + # build to JS for now, as node.js doesn't have code caching for wasm yet, + # and wasm startup times are slower + set_target_properties(${EXE_NAME} + PROPERTIES + LINK_FLAGS "-s NODERAWFS -s SINGLE_FILE -s WASM=0 -Oz -s ALLOW_MEMORY_GROWTH=1" + ) + endif () + if (EXE_INSTALL) list(APPEND WABT_EXECUTABLES ${EXE_NAME}) set(WABT_EXECUTABLES ${WABT_EXECUTABLES} PARENT_SCOPE) @@ -637,12 +646,6 @@ if (EMSCRIPTEN) # exceptions are never needed set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") - # build to JS for now, as node.js doesn't have code caching for wasm yet, and - # wasm startup times are slower - foreach(variable CMAKE_EXE_LINKER_FLAGS) - set(${variable} "${${variable}} -s NODERAWFS -s SINGLE_FILE -s WASM=0 -Oz -s ALLOW_MEMORY_GROWTH=1") - endforeach(variable) - # wabt.js # just dump everything into one binary so we can reference it from JavaScript @@ -656,13 +659,16 @@ if (EMSCRIPTEN) set(EMSCRIPTEN_EXPORTED_JSON ${WABT_SOURCE_DIR}/src/emscripten-exported.json) set(LIBWABT_LINK_FLAGS - --memory-init-file 0 + -s SINGLE_FILE --post-js ${WABT_POST_JS} -s EXPORTED_FUNCTIONS=\"@${EMSCRIPTEN_EXPORTED_JSON}\" -s RESERVED_FUNCTION_POINTERS=10 -s NO_EXIT_RUNTIME=1 + -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1 -s EXPORT_NAME=\"'WabtModule'\" + -s WASM=0 + -Oz ) string(REPLACE ";" " " LIBWABT_LINK_FLAGS_STR "${LIBWABT_LINK_FLAGS}") |