Skip to content

Commit

Permalink
update cmake for new emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-jentzsch committed Jul 12, 2020
1 parent 71c37bb commit 7061c57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions c/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions wasm/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@
# with this program. If not, see <https://www.gnu.org/licenses/>.
###############################################################################

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)
Expand Down

0 comments on commit 7061c57

Please sign in to comment.