Mercurial > hg > orthanc-stone
comparison Platforms/Wasm/CMakeLists.txt @ 236:f73d722d98c8 am
renamed folder
author | am@osimis.io |
---|---|
date | Tue, 19 Jun 2018 16:06:32 +0200 |
parents | Platforms/WebAssembly/CMakeLists.txt@c993693e9e63 |
children | b4642964c355 |
comparison
equal
deleted
inserted
replaced
235:ce4405d98b92 | 236:f73d722d98c8 |
---|---|
1 # Usage (Linux): | |
2 # source ~/Downloads/emsdk/emsdk_env.sh && cmake -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake .. | |
3 | |
4 cmake_minimum_required(VERSION 2.8.3) | |
5 | |
6 | |
7 ##################################################################### | |
8 ## Configuration of the Emscripten compiler for WebAssembly target | |
9 ##################################################################### | |
10 | |
11 set(WASM_FLAGS "-s WASM=1") | |
12 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}") | |
13 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}") | |
14 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --js-library ${CMAKE_SOURCE_DIR}/library.js") | |
15 | |
16 # Handling of memory | |
17 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1") # Resize | |
18 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s TOTAL_MEMORY=536870912") # 512MB | |
19 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=536870912") # 512MB + resize | |
20 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=1073741824") # 1GB + resize | |
21 | |
22 # To debug exceptions | |
23 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DEMANGLE_SUPPORT=1 -s ASSERTIONS=2") | |
24 | |
25 | |
26 ##################################################################### | |
27 ## Build a static library containing the Orthanc Stone framework | |
28 ##################################################################### | |
29 | |
30 include(../../Resources/CMake/OrthancStoneParameters.cmake) | |
31 | |
32 SET(ORTHANC_SANDBOXED ON) | |
33 SET(ENABLE_SDL OFF) | |
34 | |
35 include(../../Resources/CMake/OrthancStoneConfiguration.cmake) | |
36 | |
37 add_library(OrthancStone STATIC ${ORTHANC_STONE_SOURCES}) | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 # Regenerate a dummy "library.c" file each time the "library.js" file | |
45 # is modified, so as to force a new execution of the linking | |
46 add_custom_command( | |
47 OUTPUT "${AUTOGENERATED_DIR}/library.c" | |
48 COMMAND ${CMAKE_COMMAND} -E touch "${AUTOGENERATED_DIR}/library.c" "" | |
49 DEPENDS "${CMAKE_SOURCE_DIR}/library.js") |