diff Resources/CMake/Compiler.cmake @ 3599:e01900f913e7

fix duplicate symbol "jaritab" in wasm
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jan 2020 10:53:32 +0100
parents 589238dcd782
children d5cf43519a49
line wrap: on
line diff
--- a/Resources/CMake/Compiler.cmake	Mon Jan 06 19:57:11 2020 +0100
+++ b/Resources/CMake/Compiler.cmake	Tue Jan 07 10:53:32 2020 +0100
@@ -199,12 +199,15 @@
   # zero (and similar conditions like integer overflows) are
   # encountered: The "clamp" mode avoids throwing errors, as they
   # cannot be properly catched by "try {} catch (...)" constructions.
-  if (EMSCRIPTEN_SET_LLVM_WASM_BACKEND)
-    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'")
-  else()
-    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]' -s BINARYEN_TRAP_MODE='\"clamp\"'")
+  # Setting this option to "ON" fixes error: "shared:ERROR:
+  # BINARYEN_TRAP_MODE is not supported by the LLVM wasm backend" if
+  # using the "upstream" backend of Emscripten.
+  if (NOT EMSCRIPTEN_SET_LLVM_WASM_BACKEND)
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s BINARYEN_TRAP_MODE='\"clamp\"'")
   endif()
 
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'")
+  
 elseif (CMAKE_SYSTEM_NAME STREQUAL "Android")
 
 else()