Mercurial > hg > orthanc-stone
view Platforms/WebAssembly/CMakeLists.txt @ 138:77c4fef7f4a5 wasm
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 16 Jan 2018 13:47:54 +0100 |
parents | c993693e9e63 |
children |
line wrap: on
line source
# Usage (Linux): # source ~/Downloads/emsdk/emsdk_env.sh && cmake -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake .. cmake_minimum_required(VERSION 2.8.3) ##################################################################### ## Configuration of the Emscripten compiler for WebAssembly target ##################################################################### set(WASM_FLAGS "-s WASM=1") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --js-library ${CMAKE_SOURCE_DIR}/library.js") # Handling of memory #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1") # Resize #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s TOTAL_MEMORY=536870912") # 512MB set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=536870912") # 512MB + resize #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=1073741824") # 1GB + resize # To debug exceptions #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DEMANGLE_SUPPORT=1 -s ASSERTIONS=2") ##################################################################### ## Build a static library containing the Orthanc Stone framework ##################################################################### include(../../Resources/CMake/OrthancStoneParameters.cmake) SET(ORTHANC_SANDBOXED ON) SET(ENABLE_SDL OFF) include(../../Resources/CMake/OrthancStoneConfiguration.cmake) add_library(OrthancStone STATIC ${ORTHANC_STONE_SOURCES}) # Regenerate a dummy "library.c" file each time the "library.js" file # is modified, so as to force a new execution of the linking add_custom_command( OUTPUT "${AUTOGENERATED_DIR}/library.c" COMMAND ${CMAKE_COMMAND} -E touch "${AUTOGENERATED_DIR}/library.c" "" DEPENDS "${CMAKE_SOURCE_DIR}/library.js")