changeset 3492:cfaa9eded17e

Added flag to control the emscripten backend (which, in turn, tweaks the compiler flags)
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 19 Aug 2019 10:17:01 +0200
parents 786fce009be8
children c465c6ee2bfb
files Resources/CMake/Compiler.cmake Resources/CMake/OrthancFrameworkParameters.cmake
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/Compiler.cmake	Sat Aug 10 13:42:38 2019 +0200
+++ b/Resources/CMake/Compiler.cmake	Mon Aug 19 10:17:01 2019 +0200
@@ -193,7 +193,11 @@
   # 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.
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]' -s BINARYEN_TRAP_MODE='\"clamp\"'")
+  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\"'")
+  endif()
 
 elseif (CMAKE_SYSTEM_NAME STREQUAL "Android")
 
--- a/Resources/CMake/OrthancFrameworkParameters.cmake	Sat Aug 10 13:42:38 2019 +0200
+++ b/Resources/CMake/OrthancFrameworkParameters.cmake	Mon Aug 19 10:17:01 2019 +0200
@@ -72,6 +72,7 @@
 set(USE_LEGACY_JSONCPP OFF CACHE BOOL "Use the old branch 0.x.y of JsonCpp, that does not require a C++11 compiler (for LSB and old versions of Visual Studio)")
 set(USE_LEGACY_LIBICU OFF CACHE BOOL "Use icu icu4c-58_2, latest version not requiring a C++11 compiler (for LSB and old versions of Visual Studio)")
 set(MSVC_MULTIPLE_PROCESSES OFF CACHE BOOL "Add the /MP option to build with multiple processes if using Visual Studio")
+set(EMSCRIPTEN_SET_LLVM_WASM_BACKEND OFF CACHE BOOL "Sets the compiler flags required to use the LLVM Web Assembly backend in emscripten")
 
 mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE)
 mark_as_advanced(SYSTEM_MONGOOSE_USE_CALLBACKS)