From 7061c572b0953357a9d5d3e8677855fe65f93dbb Mon Sep 17 00:00:00 2001 From: Simon Jentzsch Date: Sun, 12 Jul 2020 16:59:21 +0200 Subject: [PATCH] update cmake for new emscripten --- c/compiler.cmake | 4 ++++ wasm/src/CMakeLists.txt | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/c/compiler.cmake b/c/compiler.cmake index 53235f1fe..cfc42ca98 100644 --- a/c/compiler.cmake +++ b/c/compiler.cmake @@ -12,6 +12,10 @@ endif(MSVC) if (WASM) set (CMAKE_C_FLAGS "-Wall -funsigned-char -Wextra -std=c99") set (CMAKE_CXX_FLAGS "-Wall -funsigned-char -Wextra -std=c99 -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'") + if (CMAKE_BUILD_TYPE MATCHES Debug) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined,address -fsanitize-minimal-runtime") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined,address -fsanitize-minimal-runtime") + endif() else (WASM) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif(WASM) diff --git a/wasm/src/CMakeLists.txt b/wasm/src/CMakeLists.txt index 95478ddfc..0f72b4928 100644 --- a/wasm/src/CMakeLists.txt +++ b/wasm/src/CMakeLists.txt @@ -32,18 +32,19 @@ # with this program. If not, see . ############################################################################### +set(EMC_PROPS "-Oz -s ALLOW_MEMORY_GROWTH=1 -s NODEJS_CATCH_REJECTION=0 -s EXPORT_NAME=in3w -s FILESYSTEM=0 -s 'EXTRA_EXPORTED_RUNTIME_METHODS=[\"ccall\", \"cwrap\"]'") + IF (ASMJS) set(WASM_EMBED true) set(CMAKE_EXECUTABLE_SUFFIX ".js") - set(EMC_PROPS "-O2 -s ALLOW_MEMORY_GROWTH=1 -s FINALIZE_ASM_JS=1 -s NODEJS_CATCH_REJECTION=0 -s SEPARATE_ASM=1 -s WASM=0 -s ASM_JS=1 -s EXPORT_NAME=in3w -s FILESYSTEM=0 -s 'EXTRA_EXPORTED_RUNTIME_METHODS=[\"ccall\", \"cwrap\"]'") + set(EMC_PROPS "${EMC_PROPS} -s FINALIZE_ASM_JS=1 -s SEPARATE_ASM=1 -s WASM=0 -s ASM_JS=1 ") else(ASMJS) - set(EMC_PROPS "-Oz -s ALLOW_MEMORY_GROWTH=1 -s NODEJS_CATCH_REJECTION=0 -s EXPORT_NAME=in3w -s WASM=1 -s FILESYSTEM=0 -s 'EXTRA_EXPORTED_RUNTIME_METHODS=[\"ccall\", \"cwrap\"]'") + set(EMC_PROPS "${EMC_PROPS} WASM=1") endif(ASMJS) IF (CMAKE_BUILD_TYPE MATCHES Debug) - set(EMC_PROPS "${EMC_PROPS} -g -s SAFE_HEAP=1 -s ASSERTIONS=1 -s STACK_OVERFLOW_CHECK=1 -s RUNTIME_LOGGING=1") -# set(EMC_PROPS "${EMC_PROPS} --source-map-base 'http://localhost/build/bin/' --emit-symbol-map -g -s ASSERTIONS=1 ") + set(EMC_PROPS "${EMC_PROPS} -g -s SAFE_HEAP=1 -s ASSERTIONS=1 -s STACK_OVERFLOW_CHECK=1 -s RUNTIME_LOGGING=1 ") ENDIF (CMAKE_BUILD_TYPE MATCHES Debug) if (WASM_EMBED)