annotate Platforms/WebAssembly/CMakeLists.txt @ 147:f48c5d422d45 wasm

removed meaningless ImageInterpolation_Linear value
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 23 Jan 2018 17:50:19 +0100
parents c993693e9e63
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
128
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 115
diff changeset
1 # Usage (Linux):
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 115
diff changeset
2 # source ~/Downloads/emsdk/emsdk_env.sh && cmake -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake ..
114
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 cmake_minimum_required(VERSION 2.8.3)
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 #####################################################################
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 set(WASM_FLAGS "-s WASM=1")
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}")
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}")
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --js-library ${CMAKE_SOURCE_DIR}/library.js")
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 # Handling of memory
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1") # Resize
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s TOTAL_MEMORY=536870912") # 512MB
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=536870912") # 512MB + resize
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=1073741824") # 1GB + resize
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 # To debug exceptions
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DEMANGLE_SUPPORT=1 -s ASSERTIONS=2")
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #####################################################################
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 ## Build a static library containing the Orthanc Stone framework
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #####################################################################
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 add_library(OrthancStone STATIC ${ORTHANC_STONE_SOURCES})
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 # Regenerate a dummy "library.c" file each time the "library.js" file
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 # is modified, so as to force a new execution of the linking
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 add_custom_command(
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 OUTPUT "${AUTOGENERATED_DIR}/library.c"
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 COMMAND ${CMAKE_COMMAND} -E touch "${AUTOGENERATED_DIR}/library.c" ""
3541fc81331a starting WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 DEPENDS "${CMAKE_SOURCE_DIR}/library.js")