comparison Resources/CMake/OrthancStoneConfiguration.cmake @ 115:f598ffb81cda wasm

fix sandboxed build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 Sep 2017 17:02:58 +0200
parents Resources/CMake/OrthancStone.cmake@3541fc81331a
children 42c05a3baee3
comparison
equal deleted inserted replaced
114:3541fc81331a 115:f598ffb81cda
1 # Stone of Orthanc
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
3 # Department, University Hospital of Liege, Belgium
4 # Copyright (C) 2017 Osimis, Belgium
5 #
6 # This program is free software: you can redistribute it and/or
7 # modify it under the terms of the GNU Affero General Public License
8 # as published by the Free Software Foundation, either version 3 of
9 # the License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Affero General Public License for more details.
15 #
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19
20
21 #####################################################################
22 ## Configure the Orthanc Framework
23 #####################################################################
24
25 SET(ENABLE_JPEG ON)
26 SET(ENABLE_PNG ON)
27
28 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
29
30 include_directories(${ORTHANC_ROOT})
31
32
33 #####################################################################
34 ## Sanity check of the configuration
35 #####################################################################
36
37 if (ORTHANC_SANDBOXED)
38 if (ENABLE_CURL)
39 message(FATAL_ERROR "Cannot enable curl in sandboxed environments")
40 endif()
41
42 if (ENABLE_LOGGING)
43 message(FATAL_ERROR "Cannot enable logging in sandboxed environments")
44 endif()
45
46 if (ENABLE_SDL)
47 message(FATAL_ERROR "Cannot enable SDL in sandboxed environments")
48 endif()
49
50 if (ENABLE_SSL)
51 message(FATAL_ERROR "Cannot enable SSL in sandboxed environments")
52 endif()
53 endif()
54
55
56 #####################################################################
57 ## Configure mandatory third-party components
58 #####################################################################
59
60 SET(ORTHANC_STONE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
61
62 include(FindPkgConfig)
63 include(${CMAKE_CURRENT_LIST_DIR}/BoostExtendedConfiguration.cmake)
64 include(${CMAKE_CURRENT_LIST_DIR}/CairoConfiguration.cmake)
65 include(${CMAKE_CURRENT_LIST_DIR}/PixmanConfiguration.cmake)
66
67
68
69 #####################################################################
70 ## Configure optional third-party components
71 #####################################################################
72
73 if (NOT ORTHANC_SANDBOXED)
74 list(APPEND ORTHANC_STONE_SOURCES
75 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancHttpConnection.cpp
76 )
77 endif()
78
79
80 if (ENABLE_SDL)
81 include(${CMAKE_CURRENT_LIST_DIR}/SdlConfiguration.cmake)
82 add_definitions(-DORTHANC_ENABLE_SDL=1)
83 else()
84 unset(USE_SYSTEM_SDL CACHE)
85 add_definitions(-DORTHANC_ENABLE_SDL=0)
86 endif()
87
88
89
90 #####################################################################
91 ## Configuration of the C/C++ macros
92 #####################################################################
93
94 if (MSVC)
95 # Remove some warnings on Visual Studio 2015
96 add_definitions(-D_SCL_SECURE_NO_WARNINGS=1)
97 endif()
98
99 add_definitions(
100 -DHAS_ORTHANC_EXCEPTION=1
101 -DORTHANC_ENABLE_LOGGING_PLUGIN=0
102 )
103
104
105
106 #####################################################################
107 ## Embed the colormaps into the binaries
108 #####################################################################
109
110 EmbedResources(
111 COLORMAP_HOT ${ORTHANC_STONE_DIR}/Resources/Colormaps/hot.lut
112 COLORMAP_JET ${ORTHANC_STONE_DIR}/Resources/Colormaps/jet.lut
113 COLORMAP_RED ${ORTHANC_STONE_DIR}/Resources/Colormaps/red.lut
114 COLORMAP_GREEN ${ORTHANC_STONE_DIR}/Resources/Colormaps/green.lut
115 COLORMAP_BLUE ${ORTHANC_STONE_DIR}/Resources/Colormaps/blue.lut
116 )
117
118
119
120 #####################################################################
121 ## System-specific patches
122 #####################################################################
123
124 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND
125 NOT MSVC AND
126 ENABLE_SDL)
127 # This is necessary when compiling EXE for Windows using MinGW
128 link_libraries(mingw32)
129 endif()
130
131 if (ORTHANC_SANDBOXED)
132 # Remove functions not suitable for a sandboxed environment
133 list(REMOVE_ITEM ORTHANC_CORE_SOURCES
134 ${ZLIB_SOURCES_DIR}/gzlib.c
135 ${ZLIB_SOURCES_DIR}/gzwrite.c
136 ${ZLIB_SOURCES_DIR}/gzread.c
137 )
138 endif()
139
140
141
142 #####################################################################
143 ## All the source files required to build Stone of Orthanc
144 #####################################################################
145
146 if (NOT ORTHANC_SANDBOXED)
147 set(PLATFORM_SOURCES
148 ${ORTHANC_STONE_DIR}/Platforms/Generic/WebServiceGetCommand.cpp
149 ${ORTHANC_STONE_DIR}/Platforms/Generic/WebServicePostCommand.cpp
150 ${ORTHANC_STONE_DIR}/Platforms/Generic/Oracle.cpp
151 )
152
153 set(APPLICATIONS_SOURCES
154 ${ORTHANC_STONE_DIR}/Applications/BasicApplicationContext.cpp
155 ${ORTHANC_STONE_DIR}/Applications/IBasicApplication.cpp
156 ${ORTHANC_STONE_DIR}/Applications/Sdl/SdlEngine.cpp
157 ${ORTHANC_STONE_DIR}/Applications/Sdl/SdlSurface.cpp
158 ${ORTHANC_STONE_DIR}/Applications/Sdl/SdlWindow.cpp
159 )
160 endif()
161
162 list(APPEND ORTHANC_STONE_SOURCES
163 #${ORTHANC_STONE_DIR}/Framework/Layers/DicomStructureSetRendererFactory.cpp
164 #${ORTHANC_STONE_DIR}/Framework/Layers/SeriesFrameRendererFactory.cpp
165 #${ORTHANC_STONE_DIR}/Framework/Layers/SiblingSliceLocationFactory.cpp
166 #${ORTHANC_STONE_DIR}/Framework/Layers/SingleFrameRendererFactory.cpp
167 ${ORTHANC_STONE_DIR}/Framework/Layers/CircleMeasureTracker.cpp
168 ${ORTHANC_STONE_DIR}/Framework/Layers/ColorFrameRenderer.cpp
169 ${ORTHANC_STONE_DIR}/Framework/Layers/FrameRenderer.cpp
170 ${ORTHANC_STONE_DIR}/Framework/Layers/GrayscaleFrameRenderer.cpp
171 ${ORTHANC_STONE_DIR}/Framework/Layers/LayerSourceBase.cpp
172 ${ORTHANC_STONE_DIR}/Framework/Layers/LineLayerRenderer.cpp
173 ${ORTHANC_STONE_DIR}/Framework/Layers/LineMeasureTracker.cpp
174 ${ORTHANC_STONE_DIR}/Framework/Layers/OrthancFrameLayerSource.cpp
175 ${ORTHANC_STONE_DIR}/Framework/Layers/RenderStyle.cpp
176 ${ORTHANC_STONE_DIR}/Framework/Layers/SliceOutlineRenderer.cpp
177 ${ORTHANC_STONE_DIR}/Framework/Toolbox/CoordinateSystem3D.cpp
178 ${ORTHANC_STONE_DIR}/Framework/Toolbox/DicomFrameConverter.cpp
179 ${ORTHANC_STONE_DIR}/Framework/Toolbox/DicomStructureSet.cpp
180 ${ORTHANC_STONE_DIR}/Framework/Toolbox/DownloadStack.cpp
181 ${ORTHANC_STONE_DIR}/Framework/Toolbox/Extent2D.cpp
182 ${ORTHANC_STONE_DIR}/Framework/Toolbox/GeometryToolbox.cpp
183 ${ORTHANC_STONE_DIR}/Framework/Toolbox/MessagingToolbox.cpp
184 ${ORTHANC_STONE_DIR}/Framework/Toolbox/OrthancSeriesLoader.cpp
185 ${ORTHANC_STONE_DIR}/Framework/Toolbox/OrthancSlicesLoader.cpp
186 ${ORTHANC_STONE_DIR}/Framework/Toolbox/ParallelSlices.cpp
187 ${ORTHANC_STONE_DIR}/Framework/Toolbox/ParallelSlicesCursor.cpp
188 ${ORTHANC_STONE_DIR}/Framework/Toolbox/Slice.cpp
189 ${ORTHANC_STONE_DIR}/Framework/Toolbox/SlicesSorter.cpp
190 ${ORTHANC_STONE_DIR}/Framework/Toolbox/ViewportGeometry.cpp
191 ${ORTHANC_STONE_DIR}/Framework/Viewport/CairoContext.cpp
192 ${ORTHANC_STONE_DIR}/Framework/Viewport/CairoFont.cpp
193 ${ORTHANC_STONE_DIR}/Framework/Viewport/CairoSurface.cpp
194 ${ORTHANC_STONE_DIR}/Framework/Viewport/WidgetViewport.cpp
195 ${ORTHANC_STONE_DIR}/Framework/Volumes/ImageBuffer3D.cpp
196 ${ORTHANC_STONE_DIR}/Framework/Volumes/SlicedVolumeBase.cpp
197 ${ORTHANC_STONE_DIR}/Framework/Widgets/CairoWidget.cpp
198 ${ORTHANC_STONE_DIR}/Framework/Widgets/EmptyWidget.cpp
199 ${ORTHANC_STONE_DIR}/Framework/Widgets/LayerWidget.cpp
200 ${ORTHANC_STONE_DIR}/Framework/Widgets/LayoutWidget.cpp
201 ${ORTHANC_STONE_DIR}/Framework/Widgets/TestCairoWidget.cpp
202 ${ORTHANC_STONE_DIR}/Framework/Widgets/TestWorldSceneWidget.cpp
203 ${ORTHANC_STONE_DIR}/Framework/Widgets/WidgetBase.cpp
204 ${ORTHANC_STONE_DIR}/Framework/Widgets/WorldSceneWidget.cpp
205
206 ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomPath.cpp
207 ${ORTHANC_ROOT}/Plugins/Samples/Common/IOrthancConnection.cpp
208 ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomDatasetReader.cpp
209 ${ORTHANC_ROOT}/Plugins/Samples/Common/FullOrthancDataset.cpp
210
211 ${PLATFORM_SOURCES}
212 ${ORTHANC_CORE_SOURCES}
213 ${AUTOGENERATED_SOURCES}
214
215 # Mandatory components
216 ${CAIRO_SOURCES}
217 ${PIXMAN_SOURCES}
218
219 # Optional components
220 ${SDL_SOURCES}
221 )