comparison Applications/Samples/rt-viewer-demo/CMakeLists.txt @ 549:1d9deb4ee84c ct-pet-dose-struct

Added RTSTRUCT demo viewer based on captain + fix in dev.h (wrong override signature)
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 02 Apr 2019 15:08:31 +0200
parents
children 0c0fc20a6902
comparison
equal deleted inserted replaced
548:d10a295b607a 549:1d9deb4ee84c
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 ## Configuration for Orthanc
86 #####################################################################
87
88 if (ORTHANC_STONE_VERSION STREQUAL "mainline")
89 set(ORTHANC_FRAMEWORK_VERSION "mainline")
90 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
91 else()
92 set(ORTHANC_FRAMEWORK_VERSION "1.4.1")
93 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
94 endif()
95
96 set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc source code (can be \"hg\", \"archive\", \"web\" or \"path\")")
97 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"")
98 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"")
99
100
101 #####################################################################
102 ## Build a static library containing the Orthanc Stone framework
103 #####################################################################
104
105 LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options)
106
107 include(${STONE_SOURCES_DIR}/Resources/CMake/OrthancStoneConfiguration.cmake)
108
109 add_library(OrthancStone STATIC
110 ${ORTHANC_STONE_SOURCES}
111 )
112
113 #####################################################################
114 ## Build all the sample applications
115 #####################################################################
116
117 include_directories(${ORTHANC_STONE_ROOT})
118
119 list(APPEND RTVIEWERDEMO_APPLICATION_SOURCES
120 ${ORTHANC_STONE_ROOT}/Applications/Samples/SampleInteractor.h
121 ${ORTHANC_STONE_ROOT}/Applications/Samples/SampleApplicationBase.h
122 )
123
124 if (ENABLE_WASM)
125 list(APPEND RTVIEWERDEMO_APPLICATION_SOURCES
126 ${STONE_WASM_SOURCES}
127 )
128 endif()
129
130 add_executable(RtViewerDemo
131 main.cpp
132 ${RTVIEWERDEMO_APPLICATION_SOURCES}
133 )
134 set_target_properties(RtViewerDemo PROPERTIES COMPILE_DEFINITIONS ORTHANC_STONE_SAMPLE=3)
135 target_include_directories(RtViewerDemo PRIVATE ${ORTHANC_STONE_ROOT})
136 target_link_libraries(RtViewerDemo OrthancStone)
137