Mercurial > hg > orthanc-stone
comparison Applications/Samples/Deprecated/rt-viewer-demo/CMakeLists.txt @ 1347:bfd77672d825 broker
Moved Application/Samples/* to Application/Samples/Deprecated/*
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 07 Apr 2020 14:29:01 +0200 |
parents | Applications/Samples/rt-viewer-demo/CMakeLists.txt@0c0fc20a6902 |
children |
comparison
equal
deleted
inserted
replaced
1346:df8bf351c23f | 1347:bfd77672d825 |
---|---|
1 cmake_minimum_required(VERSION 2.8.3) | |
2 project(RtViewerDemo) | |
3 | |
4 if(MSVC) | |
5 add_definitions(/MP) | |
6 if (CMAKE_BUILD_TYPE MATCHES DEBUG) | |
7 add_definitions(/JMC) | |
8 endif() | |
9 endif() | |
10 | |
11 message("-------------------------------------------------------------------------------------------------------------------") | |
12 message("ORTHANC_FRAMEWORK_ROOT is set to ${ORTHANC_FRAMEWORK_ROOT}") | |
13 message("-------------------------------------------------------------------------------------------------------------------") | |
14 | |
15 if(NOT DEFINED ORTHANC_FRAMEWORK_ROOT) | |
16 message(FATAL_ERROR "The location of the Orthanc source repository must be set in the ORTHANC_FRAMEWORK_ROOT CMake variable") | |
17 endif() | |
18 | |
19 message("-------------------------------------------------------------------------------------------------------------------") | |
20 message("STONE_SOURCES_DIR is set to ${STONE_SOURCES_DIR}") | |
21 message("-------------------------------------------------------------------------------------------------------------------") | |
22 | |
23 if(NOT DEFINED STONE_SOURCES_DIR) | |
24 message(FATAL_ERROR "The location of the Stone of Orthanc source repository must be set in the STONE_SOURCES_DIR CMake variable") | |
25 endif() | |
26 | |
27 include(${STONE_SOURCES_DIR}/Resources/CMake/OrthancStoneParameters.cmake) | |
28 | |
29 if (OPENSSL_NO_CAPIENG) | |
30 add_definitions(-DOPENSSL_NO_CAPIENG=1) | |
31 endif() | |
32 | |
33 set(ENABLE_SDL OFF CACHE BOOL "Target SDL Native application") | |
34 set(ENABLE_QT OFF CACHE BOOL "Target Qt Native application") | |
35 set(ENABLE_WASM OFF CACHE BOOL "Target WASM application") | |
36 | |
37 if (ENABLE_WASM) | |
38 ##################################################################### | |
39 ## Configuration of the Emscripten compiler for WebAssembly target | |
40 ##################################################################### | |
41 | |
42 set(WASM_FLAGS "-s WASM=1") | |
43 set(WASM_FLAGS "${WASM_FLAGS} -s STRICT=1") # drops support for all deprecated build options | |
44 set(WASM_FLAGS "${WASM_FLAGS} -s FILESYSTEM=1") # if we don't include it, gen_uuid.c fails to build because srand, getpid(), ... are not defined | |
45 set(WASM_FLAGS "${WASM_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0") # actually enable exception catching | |
46 set(WASM_FLAGS "${WASM_FLAGS} -s ERROR_ON_MISSING_LIBRARIES=1") | |
47 | |
48 if (CMAKE_BUILD_TYPE MATCHES DEBUG) | |
49 set(WASM_FLAGS "${WASM_FLAGS} -g4") # generate debug information | |
50 set(WASM_FLAGS "${WASM_FLAGS} -s ASSERTIONS=2") # more runtime checks | |
51 else() | |
52 set(WASM_FLAGS "${WASM_FLAGS} -Os") # optimize for web (speed and size) | |
53 endif() | |
54 | |
55 set(WASM_MODULE_NAME "StoneFrameworkModule" CACHE STRING "Name of the WebAssembly module") | |
56 | |
57 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}") | |
58 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}") | |
59 | |
60 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${WASM_FLAGS}") # not always clear which flags are for the compiler and which one are for the linker -> pass them all to the linker too | |
61 # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --js-library ${STONE_SOURCES_DIR}/Applications/Samples/samples-library.js") | |
62 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --js-library ${STONE_SOURCES_DIR}/Platforms/Wasm/WasmWebService.js") | |
63 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --js-library ${STONE_SOURCES_DIR}/Platforms/Wasm/WasmDelayedCallExecutor.js") | |
64 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --js-library ${STONE_SOURCES_DIR}/Platforms/Wasm/default-library.js") | |
65 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'") | |
66 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXPORT_NAME='\"${WASM_MODULE_NAME}\"'") | |
67 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1") | |
68 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s TOTAL_MEMORY=536870912") | |
69 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s TOTAL_STACK=128000000") | |
70 | |
71 add_definitions(-DORTHANC_ENABLE_WASM=1) | |
72 set(ORTHANC_SANDBOXED ON) | |
73 | |
74 elseif (ENABLE_QT OR ENABLE_SDL) | |
75 | |
76 set(ENABLE_NATIVE ON) | |
77 set(ORTHANC_SANDBOXED OFF) | |
78 set(ENABLE_CRYPTO_OPTIONS ON) | |
79 set(ENABLE_GOOGLE_TEST ON) | |
80 set(ENABLE_WEB_CLIENT ON) | |
81 | |
82 endif() | |
83 | |
84 | |
85 ##################################################################### | |
86 ## Configuration for Orthanc | |
87 ##################################################################### | |
88 | |
89 if (ORTHANC_STONE_VERSION STREQUAL "mainline") | |
90 set(ORTHANC_FRAMEWORK_VERSION "mainline") | |
91 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") | |
92 else() | |
93 set(ORTHANC_FRAMEWORK_VERSION "1.4.1") | |
94 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") | |
95 endif() | |
96 | |
97 set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc source code (can be \"hg\", \"archive\", \"web\" or \"path\")") | |
98 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"") | |
99 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"") | |
100 | |
101 add_definitions( | |
102 -DORTHANC_ENABLE_LOGGING_PLUGIN=0 | |
103 ) | |
104 | |
105 | |
106 ##################################################################### | |
107 ## Build a static library containing the Orthanc Stone framework | |
108 ##################################################################### | |
109 | |
110 LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options) | |
111 | |
112 include(${STONE_SOURCES_DIR}/Resources/CMake/OrthancStoneConfiguration.cmake) | |
113 | |
114 add_library(OrthancStone STATIC | |
115 ${ORTHANC_STONE_SOURCES} | |
116 ) | |
117 | |
118 ##################################################################### | |
119 ## Build all the sample applications | |
120 ##################################################################### | |
121 | |
122 include_directories(${ORTHANC_STONE_ROOT}) | |
123 | |
124 list(APPEND RTVIEWERDEMO_APPLICATION_SOURCES | |
125 ${ORTHANC_STONE_ROOT}/Applications/Samples/SampleInteractor.h | |
126 ${ORTHANC_STONE_ROOT}/Applications/Samples/SampleApplicationBase.h | |
127 ) | |
128 | |
129 if (ENABLE_WASM) | |
130 list(APPEND RTVIEWERDEMO_APPLICATION_SOURCES | |
131 ${STONE_WASM_SOURCES} | |
132 ) | |
133 endif() | |
134 | |
135 add_executable(RtViewerDemo | |
136 main.cpp | |
137 ${RTVIEWERDEMO_APPLICATION_SOURCES} | |
138 ) | |
139 set_target_properties(RtViewerDemo PROPERTIES COMPILE_DEFINITIONS ORTHANC_STONE_SAMPLE=3) | |
140 target_include_directories(RtViewerDemo PRIVATE ${ORTHANC_STONE_ROOT}) | |
141 target_link_libraries(RtViewerDemo OrthancStone) | |
142 |