Mercurial > hg > orthanc-stone
annotate Samples/WebAssembly/CMakeLists.txt @ 879:12b591d5d63c am-dev
some Qt integration (wip)
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Fri, 05 Jul 2019 14:52:43 +0200 |
parents | 0c0fc20a6902 |
children | 50cd372e2460 6073c980323a |
rev | line source |
---|---|
616
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 cmake_minimum_required(VERSION 2.8.3) |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 ##################################################################### |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 ## Configuration of the Emscripten compiler for WebAssembly target |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 ##################################################################### |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 set(WASM_FLAGS "-s WASM=1 -s FETCH=1") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0") |
820 | 16 #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXIT_RUNTIME=1") |
616
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 ##################################################################### |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 ## Configuration of the Orthanc framework |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 ##################################################################### |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 # This CMake file defines the "ORTHANC_STONE_VERSION" macro, so it |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 # must be the first inclusion |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 include(${CMAKE_SOURCE_DIR}/../../Resources/CMake/Version.cmake) |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 if (ORTHANC_STONE_VERSION STREQUAL "mainline") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 set(ORTHANC_FRAMEWORK_VERSION "mainline") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 else() |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 set(ORTHANC_FRAMEWORK_VERSION "1.5.7") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 endif() |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc source code (can be \"hg\", \"archive\", \"web\" or \"path\")") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 ##################################################################### |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 ## Configuration of the Stone framework |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 ##################################################################### |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 include(${CMAKE_SOURCE_DIR}/../../Resources/CMake/OrthancStoneParameters.cmake) |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 DownloadPackage( |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 "a24b8136b8f3bb93f166baf97d9328de" |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip" |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83") |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 set(ORTHANC_STONE_APPLICATION_RESOURCES |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 UBUNTU_FONT ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 ) |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 SET(ENABLE_GOOGLE_TEST OFF) |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 SET(ENABLE_LOCALE ON) |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 SET(ORTHANC_SANDBOXED ON) |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 SET(ENABLE_WASM ON) |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 include(${CMAKE_SOURCE_DIR}/../../Resources/CMake/OrthancStoneConfiguration.cmake) |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 |
857
0c0fc20a6902
macro ORTHANC_ENABLE_LOGGING_PLUGIN must be defined per app, not by stone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
63 add_definitions( |
0c0fc20a6902
macro ORTHANC_ENABLE_LOGGING_PLUGIN must be defined per app, not by stone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
64 -DORTHANC_ENABLE_LOGGING_PLUGIN=0 |
0c0fc20a6902
macro ORTHANC_ENABLE_LOGGING_PLUGIN must be defined per app, not by stone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
65 ) |
0c0fc20a6902
macro ORTHANC_ENABLE_LOGGING_PLUGIN must be defined per app, not by stone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
66 |
616
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 ##################################################################### |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 ## Build the samples |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 ##################################################################### |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 add_library(OrthancStone STATIC |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 ${ORTHANC_STONE_SOURCES} |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 ) |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 |
820 | 76 |
826 | 77 if (ON) |
820 | 78 add_executable(BasicScene |
79 BasicScene.cpp | |
80 ) | |
81 | |
82 target_link_libraries(BasicScene OrthancStone) | |
83 | |
84 install( | |
85 TARGETS BasicScene | |
86 RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} | |
87 ) | |
88 endif() | |
616
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 |
820 | 90 |
91 if (ON) | |
92 add_executable(BasicMPR | |
93 BasicMPR.cpp | |
94 ) | |
616
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 |
820 | 96 target_link_libraries(BasicMPR OrthancStone) |
97 | |
98 install( | |
99 TARGETS BasicMPR | |
100 RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} | |
101 ) | |
102 endif() | |
103 | |
616
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 install( |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 FILES |
820 | 107 ${CMAKE_CURRENT_BINARY_DIR}/BasicMPR.wasm |
616
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 ${CMAKE_CURRENT_BINARY_DIR}/BasicScene.wasm |
820 | 109 ${CMAKE_SOURCE_DIR}/BasicMPR.html |
616
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 ${CMAKE_SOURCE_DIR}/BasicScene.html |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 ${CMAKE_SOURCE_DIR}/Configuration.json |
831
d71cf8504159
handling of GET arguments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
826
diff
changeset
|
112 ${CMAKE_SOURCE_DIR}/app.js |
616
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 ${CMAKE_SOURCE_DIR}/index.html |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 DESTINATION ${CMAKE_INSTALL_PREFIX} |
97926984d5d0
WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 ) |