Mercurial > hg > orthanc
comparison Resources/CMake/OrthancFrameworkConfiguration.cmake @ 2388:50cde8246542
CMake to build the Orthanc framework without the Orthanc server
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Aug 2017 11:26:08 +0200 |
parents | |
children | cf0eb76c5e81 |
comparison
equal
deleted
inserted
replaced
2387:a60a79929007 | 2388:50cde8246542 |
---|---|
1 ## | |
2 ## This is a CMake configuration file that configures the core | |
3 ## libraries of Orthanc. This file can be used by external projects so | |
4 ## as to gain access to the Orthanc APIs (the most prominent examples | |
5 ## are currently "Stone of Orthanc" and "Orthanc for whole-slide | |
6 ## imaging plugin"). | |
7 ## | |
8 | |
9 | |
10 ##################################################################### | |
11 ## Configuration of the components | |
12 ##################################################################### | |
13 | |
14 # Path to the root folder of the Orthanc distribution | |
15 set(ORTHANC_ROOT ${CMAKE_CURRENT_LIST_DIR}/../..) | |
16 | |
17 # Some basic inclusions | |
18 include(CheckIncludeFiles) | |
19 include(CheckIncludeFileCXX) | |
20 include(CheckFunctionExists) | |
21 include(CheckLibraryExists) | |
22 include(FindPythonInterp) | |
23 | |
24 include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake) | |
25 include(${CMAKE_CURRENT_LIST_DIR}/DownloadPackage.cmake) | |
26 include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake) | |
27 | |
28 | |
29 ##################################################################### | |
30 ## List of source files | |
31 ##################################################################### | |
32 | |
33 set(ORTHANC_CORE_SOURCES_INTERNAL | |
34 ${ORTHANC_ROOT}/Core/Cache/MemoryCache.cpp | |
35 ${ORTHANC_ROOT}/Core/Cache/SharedArchive.cpp | |
36 ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp | |
37 ${ORTHANC_ROOT}/Core/Compression/DeflateBaseCompressor.cpp | |
38 ${ORTHANC_ROOT}/Core/Compression/GzipCompressor.cpp | |
39 ${ORTHANC_ROOT}/Core/Compression/HierarchicalZipWriter.cpp | |
40 ${ORTHANC_ROOT}/Core/Compression/ZipWriter.cpp | |
41 ${ORTHANC_ROOT}/Core/Compression/ZlibCompressor.cpp | |
42 ${ORTHANC_ROOT}/Core/DicomFormat/DicomArray.cpp | |
43 ${ORTHANC_ROOT}/Core/DicomFormat/DicomImageInformation.cpp | |
44 ${ORTHANC_ROOT}/Core/DicomFormat/DicomInstanceHasher.cpp | |
45 ${ORTHANC_ROOT}/Core/DicomFormat/DicomIntegerPixelAccessor.cpp | |
46 ${ORTHANC_ROOT}/Core/DicomFormat/DicomMap.cpp | |
47 ${ORTHANC_ROOT}/Core/DicomFormat/DicomTag.cpp | |
48 ${ORTHANC_ROOT}/Core/DicomFormat/DicomValue.cpp | |
49 ${ORTHANC_ROOT}/Core/Enumerations.cpp | |
50 ${ORTHANC_ROOT}/Core/FileStorage/FilesystemStorage.cpp | |
51 ${ORTHANC_ROOT}/Core/FileStorage/StorageAccessor.cpp | |
52 ${ORTHANC_ROOT}/Core/Images/Font.cpp | |
53 ${ORTHANC_ROOT}/Core/Images/FontRegistry.cpp | |
54 ${ORTHANC_ROOT}/Core/Images/IImageWriter.cpp | |
55 ${ORTHANC_ROOT}/Core/Images/Image.cpp | |
56 ${ORTHANC_ROOT}/Core/Images/ImageAccessor.cpp | |
57 ${ORTHANC_ROOT}/Core/Images/ImageBuffer.cpp | |
58 ${ORTHANC_ROOT}/Core/Images/ImageProcessing.cpp | |
59 ${ORTHANC_ROOT}/Core/Logging.cpp | |
60 ${ORTHANC_ROOT}/Core/MultiThreading/BagOfTasksProcessor.cpp | |
61 ${ORTHANC_ROOT}/Core/MultiThreading/Mutex.cpp | |
62 ${ORTHANC_ROOT}/Core/MultiThreading/ReaderWriterLock.cpp | |
63 ${ORTHANC_ROOT}/Core/MultiThreading/RunnableWorkersPool.cpp | |
64 ${ORTHANC_ROOT}/Core/MultiThreading/Semaphore.cpp | |
65 ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp | |
66 ${ORTHANC_ROOT}/Core/SystemToolbox.cpp | |
67 ${ORTHANC_ROOT}/Core/TemporaryFile.cpp | |
68 ${ORTHANC_ROOT}/Core/Toolbox.cpp | |
69 ${ORTHANC_ROOT}/Core/WebServiceParameters.cpp | |
70 ) | |
71 | |
72 | |
73 ##################################################################### | |
74 ## Configuration of optional third-party dependencies | |
75 ##################################################################### | |
76 | |
77 | |
78 ## | |
79 ## Embedded database: SQLite | |
80 ## | |
81 | |
82 if (ENABLE_SQLITE) | |
83 include(${CMAKE_CURRENT_LIST_DIR}/SQLiteConfiguration.cmake) | |
84 add_definitions(-DORTHANC_ENABLE_SQLITE=1) | |
85 | |
86 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL | |
87 ${ORTHANC_ROOT}/Core/SQLite/Connection.cpp | |
88 ${ORTHANC_ROOT}/Core/SQLite/FunctionContext.cpp | |
89 ${ORTHANC_ROOT}/Core/SQLite/Statement.cpp | |
90 ${ORTHANC_ROOT}/Core/SQLite/StatementId.cpp | |
91 ${ORTHANC_ROOT}/Core/SQLite/StatementReference.cpp | |
92 ${ORTHANC_ROOT}/Core/SQLite/Transaction.cpp | |
93 ) | |
94 else() | |
95 unset(USE_SYSTEM_SQLITE CACHE) | |
96 add_definitions(-DORTHANC_ENABLE_SQLITE=0) | |
97 endif() | |
98 | |
99 | |
100 ## | |
101 ## Cryptography: OpenSSL and libp11 | |
102 ## Must be above "ENABLE_WEB_CLIENT" and "ENABLE_WEB_SERVER" | |
103 ## | |
104 | |
105 if (ENABLE_CRYPTO_OPTIONS) | |
106 if (ENABLE_SSL) | |
107 include(${CMAKE_CURRENT_LIST_DIR}/OpenSslConfiguration.cmake) | |
108 add_definitions(-DORTHANC_ENABLE_SSL=1) | |
109 else() | |
110 unset(USE_SYSTEM_OPENSSL CACHE) | |
111 add_definitions(-DORTHANC_ENABLE_SSL=0) | |
112 endif() | |
113 | |
114 if (ENABLE_PKCS11) | |
115 if (ENABLE_SSL) | |
116 include(${CMAKE_CURRENT_LIST_DIR}/LibP11Configuration.cmake) | |
117 | |
118 add_definitions(-DORTHANC_ENABLE_PKCS11=1) | |
119 list(APPEND ORTHANC_CORE_SOURCES | |
120 ${ORTHANC_ROOT}/Core/Pkcs11.cpp | |
121 ) | |
122 else() | |
123 message(FATAL_ERROR "OpenSSL is required to enable PKCS#11 support") | |
124 endif() | |
125 else() | |
126 add_definitions(-DORTHANC_ENABLE_PKCS11=0) | |
127 endif() | |
128 | |
129 else() # ENABLE_CRYPTO_OPTIONS == OFF | |
130 unset(ENABLE_SSL CACHE) | |
131 unset(ENABLE_PKCS11 CACHE) | |
132 unset(USE_SYSTEM_OPENSSL CACHE) | |
133 unset(USE_SYSTEM_LIBP11 CACHE) | |
134 add_definitions( | |
135 -DORTHANC_ENABLE_SSL=0 | |
136 -DORTHANC_ENABLE_PKCS11=0 | |
137 ) | |
138 endif() | |
139 | |
140 | |
141 ## | |
142 ## HTTP client: libcurl | |
143 ## | |
144 | |
145 if (ENABLE_WEB_CLIENT) | |
146 include(${CMAKE_CURRENT_LIST_DIR}/LibCurlConfiguration.cmake) | |
147 add_definitions(-DORTHANC_ENABLE_CURL=1) | |
148 | |
149 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL | |
150 ${ORTHANC_ROOT}/Core/HttpClient.cpp | |
151 ) | |
152 else() | |
153 unset(USE_SYSTEM_CURL CACHE) | |
154 add_definitions(-DORTHANC_ENABLE_CURL=0) | |
155 endif() | |
156 | |
157 | |
158 ## | |
159 ## HTTP server: Mongoose 3.8 or Civetweb | |
160 ## | |
161 | |
162 if (ENABLE_WEB_SERVER) | |
163 if (ENABLE_CIVETWEB) | |
164 include(${CMAKE_CURRENT_LIST_DIR}/CivetwebConfiguration.cmake) | |
165 add_definitions( | |
166 -DORTHANC_ENABLE_CIVETWEB=1 | |
167 -DORTHANC_ENABLE_MONGOOSE=0 | |
168 ) | |
169 else() | |
170 include(${CMAKE_CURRENT_LIST_DIR}/MongooseConfiguration.cmake) | |
171 add_definitions( | |
172 -DORTHANC_ENABLE_CIVETWEB=0 | |
173 -DORTHANC_ENABLE_MONGOOSE=1 | |
174 ) | |
175 endif() | |
176 | |
177 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL | |
178 ${ORTHANC_ROOT}/Core/HttpServer/BufferHttpSender.cpp | |
179 ${ORTHANC_ROOT}/Core/HttpServer/FilesystemHttpHandler.cpp | |
180 ${ORTHANC_ROOT}/Core/HttpServer/FilesystemHttpSender.cpp | |
181 ${ORTHANC_ROOT}/Core/HttpServer/HttpContentNegociation.cpp | |
182 ${ORTHANC_ROOT}/Core/HttpServer/HttpFileSender.cpp | |
183 ${ORTHANC_ROOT}/Core/HttpServer/HttpOutput.cpp | |
184 ${ORTHANC_ROOT}/Core/HttpServer/HttpStreamTranscoder.cpp | |
185 ${ORTHANC_ROOT}/Core/HttpServer/HttpToolbox.cpp | |
186 ${ORTHANC_ROOT}/Core/HttpServer/MongooseServer.cpp | |
187 ${ORTHANC_ROOT}/Core/HttpServer/StringHttpOutput.cpp | |
188 ${ORTHANC_ROOT}/Core/RestApi/RestApi.cpp | |
189 ${ORTHANC_ROOT}/Core/RestApi/RestApiCall.cpp | |
190 ${ORTHANC_ROOT}/Core/RestApi/RestApiGetCall.cpp | |
191 ${ORTHANC_ROOT}/Core/RestApi/RestApiHierarchy.cpp | |
192 ${ORTHANC_ROOT}/Core/RestApi/RestApiOutput.cpp | |
193 ${ORTHANC_ROOT}/Core/RestApi/RestApiPath.cpp | |
194 ) | |
195 | |
196 else() | |
197 unset(ENABLE_CIVETWEB CACHE) | |
198 unset(USE_SYSTEM_CIVETWEB CACHE) | |
199 unset(USE_SYSTEM_MONGOOSE CACHE) | |
200 add_definitions( | |
201 -DORTHANC_ENABLE_CIVETWEB=0 | |
202 -DORTHANC_ENABLE_MONGOOSE=0 | |
203 ) | |
204 endif() | |
205 | |
206 | |
207 ## | |
208 ## JPEG support: libjpeg | |
209 ## | |
210 | |
211 if (ENABLE_JPEG) | |
212 include(${CMAKE_CURRENT_LIST_DIR}/LibJpegConfiguration.cmake) | |
213 add_definitions(-DORTHANC_ENABLE_JPEG=1) | |
214 | |
215 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL | |
216 ${ORTHANC_ROOT}/Core/Images/JpegErrorManager.cpp | |
217 ${ORTHANC_ROOT}/Core/Images/JpegReader.cpp | |
218 ${ORTHANC_ROOT}/Core/Images/JpegWriter.cpp | |
219 ) | |
220 | |
221 else() | |
222 unset(USE_SYSTEM_LIBJPEG CACHE) | |
223 add_definitions(-DORTHANC_ENABLE_JPEG=0) | |
224 endif() | |
225 | |
226 | |
227 ## | |
228 ## PNG support: libpng (in conjunction with zlib) | |
229 ## | |
230 | |
231 if (ENABLE_PNG) | |
232 include(${CMAKE_CURRENT_LIST_DIR}/LibPngConfiguration.cmake) | |
233 add_definitions(-DORTHANC_ENABLE_PNG=1) | |
234 | |
235 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL | |
236 ${ORTHANC_ROOT}/Core/Images/PngReader.cpp | |
237 ${ORTHANC_ROOT}/Core/Images/PngWriter.cpp | |
238 ) | |
239 | |
240 else() | |
241 unset(USE_SYSTEM_LIBPNG CACHE) | |
242 add_definitions(-DORTHANC_ENABLE_PNG=0) | |
243 endif() | |
244 | |
245 | |
246 ## | |
247 ## Lua support | |
248 ## | |
249 | |
250 if (ENABLE_LUA) | |
251 include(${CMAKE_CURRENT_LIST_DIR}/LuaConfiguration.cmake) | |
252 add_definitions(-DORTHANC_ENABLE_LUA=1) | |
253 | |
254 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL | |
255 ${ORTHANC_ROOT}/Core/Lua/LuaContext.cpp | |
256 ${ORTHANC_ROOT}/Core/Lua/LuaFunctionCall.cpp | |
257 ) | |
258 else() | |
259 unset(USE_SYSTEM_LUA CACHE) | |
260 add_definitions(-DORTHANC_ENABLE_LUA=0) | |
261 endif() | |
262 | |
263 | |
264 ## | |
265 ## XML support: pugixml | |
266 ## | |
267 | |
268 if (ENABLE_PUGIXML) | |
269 include(${CMAKE_CURRENT_LIST_DIR}/PugixmlConfiguration.cmake) | |
270 add_definitions(-DORTHANC_ENABLE_PUGIXML=1) | |
271 else() | |
272 unset(USE_SYSTEM_PUGIXML CACHE) | |
273 add_definitions(-DORTHANC_ENABLE_PUGIXML=0) | |
274 endif() | |
275 | |
276 | |
277 ## | |
278 ## Locale support: libiconv | |
279 ## | |
280 | |
281 if (ENABLE_LOCALE) | |
282 include(${CMAKE_CURRENT_LIST_DIR}/LibIconvConfiguration.cmake) | |
283 add_definitions(-DORTHANC_ENABLE_LOCALE=1) | |
284 else() | |
285 unset(USE_SYSTEM_LIBICONV CACHE) | |
286 add_definitions(-DORTHANC_ENABLE_LOCALE=0) | |
287 endif() | |
288 | |
289 | |
290 ##################################################################### | |
291 ## Inclusion of mandatory third-party dependencies | |
292 ##################################################################### | |
293 | |
294 include(${CMAKE_CURRENT_LIST_DIR}/JsonCppConfiguration.cmake) | |
295 include(${CMAKE_CURRENT_LIST_DIR}/ZlibConfiguration.cmake) | |
296 | |
297 # We put Boost as the last dependency, as it is the heaviest to | |
298 # configure, which allows to quickly spot problems when configuring | |
299 # static builds in other dependencies | |
300 include(${CMAKE_CURRENT_LIST_DIR}/BoostConfiguration.cmake) | |
301 | |
302 | |
303 ##################################################################### | |
304 ## Optional configuration of DCMTK | |
305 ##################################################################### | |
306 | |
307 if (ENABLE_DCMTK) | |
308 if (NOT ENABLE_LOCALE) | |
309 message(FATAL_ERROR "Support for locales must be enabled if enabling DICOM support") | |
310 endif() | |
311 | |
312 include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfiguration.cmake) | |
313 | |
314 add_definitions(-DORTHANC_ENABLE_DCMTK=1) | |
315 | |
316 if (ENABLE_DCMTK_JPEG) | |
317 add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG=1) | |
318 else() | |
319 add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG=0) | |
320 endif() | |
321 | |
322 if (ENABLE_DCMTK_JPEG_LOSSLESS) | |
323 add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=1) | |
324 else() | |
325 add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=0) | |
326 endif() | |
327 | |
328 set(ORTHANC_DICOM_SOURCES | |
329 ${ORTHANC_ROOT}/Core/DicomParsing/DicomDirWriter.cpp | |
330 ${ORTHANC_ROOT}/Core/DicomParsing/DicomModification.cpp | |
331 ${ORTHANC_ROOT}/Core/DicomParsing/FromDcmtkBridge.cpp | |
332 ${ORTHANC_ROOT}/Core/DicomParsing/ParsedDicomFile.cpp | |
333 ${ORTHANC_ROOT}/Core/DicomParsing/ToDcmtkBridge.cpp | |
334 | |
335 ${ORTHANC_ROOT}/Core/DicomParsing/Internals/DicomFrameIndex.cpp | |
336 ${ORTHANC_ROOT}/Core/DicomParsing/Internals/DicomImageDecoder.cpp | |
337 | |
338 ${DCMTK_SOURCES} | |
339 ) | |
340 | |
341 if (ENABLE_DCMTK_NETWORKING) | |
342 add_definitions(-DORTHANC_ENABLE_DCMTK_NETWORKING=1) | |
343 list(APPEND ORTHANC_DICOM_SOURCES | |
344 ${ORTHANC_ROOT}/Core/DicomNetworking/DicomFindAnswers.cpp | |
345 ${ORTHANC_ROOT}/Core/DicomNetworking/DicomServer.cpp | |
346 ${ORTHANC_ROOT}/Core/DicomNetworking/DicomUserConnection.cpp | |
347 ${ORTHANC_ROOT}/Core/DicomNetworking/RemoteModalityParameters.cpp | |
348 ${ORTHANC_ROOT}/Core/DicomNetworking/ReusableDicomUserConnection.cpp | |
349 | |
350 ${ORTHANC_ROOT}/Core/DicomNetworking/Internals/CommandDispatcher.cpp | |
351 ${ORTHANC_ROOT}/Core/DicomNetworking/Internals/FindScp.cpp | |
352 ${ORTHANC_ROOT}/Core/DicomNetworking/Internals/MoveScp.cpp | |
353 ${ORTHANC_ROOT}/Core/DicomNetworking/Internals/StoreScp.cpp | |
354 ) | |
355 else() | |
356 add_definitions(-DORTHANC_ENABLE_DCMTK_NETWORKING=0) | |
357 endif() | |
358 | |
359 else() | |
360 add_definitions( | |
361 -DORTHANC_ENABLE_DCMTK=0 | |
362 -DORTHANC_ENABLE_DCMTK_NETWORKING=0 | |
363 ) | |
364 unset(DCMTK_DICTIONARY_DIR CACHE) | |
365 unset(USE_DCMTK_360 CACHE) | |
366 unset(USE_DCMTK_362_PRIVATE_DIC CACHE) | |
367 unset(USE_SYSTEM_DCMTK CACHE) | |
368 unset(ENABLE_DCMTK_JPEG CACHE) | |
369 unset(ENABLE_DCMTK_JPEG_LOSSLESS CACHE) | |
370 endif() | |
371 | |
372 | |
373 ##################################################################### | |
374 ## Configuration of the C/C++ macros | |
375 ##################################################################### | |
376 | |
377 add_definitions( | |
378 -DORTHANC_DATABASE_VERSION=${ORTHANC_DATABASE_VERSION} | |
379 -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1 | |
380 -DORTHANC_ENABLE_BASE64=1 | |
381 -DORTHANC_ENABLE_LOGGING=1 | |
382 -DORTHANC_ENABLE_LOGGING_PLUGIN=0 | |
383 -DORTHANC_ENABLE_MD5=1 | |
384 -DORTHANC_MAXIMUM_TAG_LENGTH=256 | |
385 -DORTHANC_SANDBOXED=0 | |
386 -DORTHANC_VERSION="${ORTHANC_VERSION}" | |
387 ) | |
388 | |
389 | |
390 if (HAS_EMBEDDED_RESOURCES) | |
391 add_definitions(-DORTHANC_HAS_EMBEDDED_RESOURCES=1) | |
392 | |
393 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL | |
394 ${ORTHANC_ROOT}/Core/HttpServer/EmbeddedResourceHttpHandler.cpp | |
395 ) | |
396 else() | |
397 add_definitions(-DORTHANC_HAS_EMBEDDED_RESOURCES=0) | |
398 endif() | |
399 | |
400 | |
401 ##################################################################### | |
402 ## Gathering of all the source code | |
403 ##################################################################### | |
404 | |
405 set(ORTHANC_CORE_SOURCES | |
406 ${ORTHANC_CORE_SOURCES_INTERNAL} | |
407 | |
408 ${BOOST_SOURCES} | |
409 ${CIVETWEB_SOURCES} | |
410 ${CURL_SOURCES} | |
411 ${JSONCPP_SOURCES} | |
412 ${LIBICONV_SOURCES} | |
413 ${LIBJPEG_SOURCES} | |
414 ${LIBP11_SOURCES} | |
415 ${LIBPNG_SOURCES} | |
416 ${LUA_SOURCES} | |
417 ${MONGOOSE_SOURCES} | |
418 ${OPENSSL_SOURCES} | |
419 ${PUGIXML_SOURCES} | |
420 ${SQLITE_SOURCES} | |
421 ${ZLIB_SOURCES} | |
422 | |
423 ${ORTHANC_ROOT}/Resources/ThirdParty/md5/md5.c | |
424 ${ORTHANC_ROOT}/Resources/ThirdParty/base64/base64.cpp | |
425 | |
426 # This is the minizip distribution to create ZIP files using zlib | |
427 ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/ioapi.c | |
428 ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/zip.c | |
429 ) |