Mercurial > hg > orthanc-stone
annotate Platforms/WebAssembly/CMakeLists.txt @ 152:2e023be0563c wasm
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 01 Feb 2018 18:42:34 +0100 |
parents | c993693e9e63 |
children |
rev | line source |
---|---|
128 | 1 # Usage (Linux): |
2 # source ~/Downloads/emsdk/emsdk_env.sh && cmake -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake .. | |
114 | 3 |
4 cmake_minimum_required(VERSION 2.8.3) | |
5 | |
6 | |
7 ##################################################################### | |
115
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
8 ## Configuration of the Emscripten compiler for WebAssembly target |
114 | 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 | |
115
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
30 include(../../Resources/CMake/OrthancStoneParameters.cmake) |
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
31 |
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
32 SET(ORTHANC_SANDBOXED ON) |
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
33 SET(ENABLE_SDL OFF) |
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
34 |
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
35 include(../../Resources/CMake/OrthancStoneConfiguration.cmake) |
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
36 |
114 | 37 add_library(OrthancStone STATIC ${ORTHANC_STONE_SOURCES}) |
38 | |
115
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
39 |
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
40 |
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
41 |
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
42 |
f598ffb81cda
fix sandboxed build
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
43 |
114 | 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") |