comparison OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake @ 4044:d25f4c0fa160 framework

splitting code into OrthancFramework and OrthancServer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 20:30:34 +0200
parents Resources/CMake/OrthancFrameworkConfiguration.cmake@052dc48c15be
children 05b8fd21089c
comparison
equal deleted inserted replaced
4043:6c6239aec462 4044:d25f4c0fa160
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(CMakePushCheckState)
19 include(CheckFunctionExists)
20 include(CheckIncludeFile)
21 include(CheckIncludeFileCXX)
22 include(CheckIncludeFiles)
23 include(CheckLibraryExists)
24 include(CheckStructHasMember)
25 include(CheckSymbolExists)
26 include(CheckTypeSize)
27 include(FindPythonInterp)
28
29 include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake)
30 include(${CMAKE_CURRENT_LIST_DIR}/DownloadPackage.cmake)
31 include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake)
32
33
34 #####################################################################
35 ## Disable unneeded macros
36 #####################################################################
37
38 if (NOT ENABLE_SQLITE)
39 unset(USE_SYSTEM_SQLITE CACHE)
40 add_definitions(-DORTHANC_ENABLE_SQLITE=0)
41 endif()
42
43 if (NOT ENABLE_CRYPTO_OPTIONS)
44 unset(ENABLE_SSL CACHE)
45 unset(ENABLE_PKCS11 CACHE)
46 unset(ENABLE_OPENSSL_ENGINES CACHE)
47 unset(OPENSSL_STATIC_VERSION CACHE)
48 unset(USE_SYSTEM_OPENSSL CACHE)
49 unset(USE_SYSTEM_LIBP11 CACHE)
50 add_definitions(
51 -DORTHANC_ENABLE_SSL=0
52 -DORTHANC_ENABLE_PKCS11=0
53 )
54 endif()
55
56 if (NOT ENABLE_WEB_CLIENT)
57 unset(USE_SYSTEM_CURL CACHE)
58 add_definitions(-DORTHANC_ENABLE_CURL=0)
59 endif()
60
61 if (NOT ENABLE_WEB_SERVER)
62 unset(ENABLE_CIVETWEB CACHE)
63 unset(USE_SYSTEM_CIVETWEB CACHE)
64 unset(USE_SYSTEM_MONGOOSE CACHE)
65 add_definitions(
66 -DORTHANC_ENABLE_CIVETWEB=0
67 -DORTHANC_ENABLE_MONGOOSE=0
68 )
69 endif()
70
71 if (NOT ENABLE_JPEG)
72 unset(USE_SYSTEM_LIBJPEG CACHE)
73 add_definitions(-DORTHANC_ENABLE_JPEG=0)
74 endif()
75
76 if (NOT ENABLE_ZLIB)
77 unset(USE_SYSTEM_ZLIB CACHE)
78 add_definitions(-DORTHANC_ENABLE_ZLIB=0)
79 endif()
80
81 if (NOT ENABLE_PNG)
82 unset(USE_SYSTEM_LIBPNG CACHE)
83 add_definitions(-DORTHANC_ENABLE_PNG=0)
84 endif()
85
86 if (NOT ENABLE_LUA)
87 unset(USE_SYSTEM_LUA CACHE)
88 unset(ENABLE_LUA_MODULES CACHE)
89 add_definitions(-DORTHANC_ENABLE_LUA=0)
90 endif()
91
92 if (NOT ENABLE_PUGIXML)
93 unset(USE_SYSTEM_PUGIXML CACHE)
94 add_definitions(-DORTHANC_ENABLE_PUGIXML=0)
95 endif()
96
97 if (NOT ENABLE_LOCALE)
98 unset(BOOST_LOCALE_BACKEND CACHE)
99 add_definitions(-DORTHANC_ENABLE_LOCALE=0)
100 endif()
101
102 if (NOT ENABLE_GOOGLE_TEST)
103 unset(USE_SYSTEM_GOOGLE_TEST CACHE)
104 unset(USE_GOOGLE_TEST_DEBIAN_PACKAGE CACHE)
105 endif()
106
107 if (NOT ENABLE_DCMTK)
108 add_definitions(
109 -DORTHANC_ENABLE_DCMTK=0
110 -DORTHANC_ENABLE_DCMTK_NETWORKING=0
111 -DORTHANC_ENABLE_DCMTK_TRANSCODING=0
112 )
113 unset(DCMTK_DICTIONARY_DIR CACHE)
114 unset(DCMTK_VERSION CACHE)
115 unset(USE_DCMTK_362_PRIVATE_DIC CACHE)
116 unset(USE_SYSTEM_DCMTK CACHE)
117 unset(ENABLE_DCMTK_JPEG CACHE)
118 unset(ENABLE_DCMTK_JPEG_LOSSLESS CACHE)
119 unset(DCMTK_STATIC_VERSION CACHE)
120 unset(ENABLE_DCMTK_LOG CACHE)
121 endif()
122
123
124 #####################################################################
125 ## List of source files
126 #####################################################################
127
128 set(ORTHANC_CORE_SOURCES_INTERNAL
129 ${ORTHANC_ROOT}/Core/Cache/MemoryCache.cpp
130 ${ORTHANC_ROOT}/Core/Cache/MemoryObjectCache.cpp
131 ${ORTHANC_ROOT}/Core/Cache/MemoryStringCache.cpp
132 ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp
133 ${ORTHANC_ROOT}/Core/DicomFormat/DicomTag.cpp
134 ${ORTHANC_ROOT}/Core/EnumerationDictionary.h
135 ${ORTHANC_ROOT}/Core/Enumerations.cpp
136 ${ORTHANC_ROOT}/Core/FileStorage/MemoryStorageArea.cpp
137 ${ORTHANC_ROOT}/Core/HttpServer/MultipartStreamReader.cpp
138 ${ORTHANC_ROOT}/Core/HttpServer/StringMatcher.cpp
139 ${ORTHANC_ROOT}/Core/Logging.cpp
140 ${ORTHANC_ROOT}/Core/OrthancFramework.cpp
141 ${ORTHANC_ROOT}/Core/SerializationToolbox.cpp
142 ${ORTHANC_ROOT}/Core/Toolbox.cpp
143 ${ORTHANC_ROOT}/Core/WebServiceParameters.cpp
144 )
145
146 if (ENABLE_MODULE_IMAGES)
147 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
148 ${ORTHANC_ROOT}/Core/Images/Font.cpp
149 ${ORTHANC_ROOT}/Core/Images/FontRegistry.cpp
150 ${ORTHANC_ROOT}/Core/Images/IImageWriter.cpp
151 ${ORTHANC_ROOT}/Core/Images/Image.cpp
152 ${ORTHANC_ROOT}/Core/Images/ImageAccessor.cpp
153 ${ORTHANC_ROOT}/Core/Images/ImageBuffer.cpp
154 ${ORTHANC_ROOT}/Core/Images/ImageProcessing.cpp
155 ${ORTHANC_ROOT}/Core/Images/PamReader.cpp
156 ${ORTHANC_ROOT}/Core/Images/PamWriter.cpp
157 )
158 endif()
159
160 if (ENABLE_MODULE_DICOM)
161 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
162 ${ORTHANC_ROOT}/Core/DicomFormat/DicomArray.cpp
163 ${ORTHANC_ROOT}/Core/DicomFormat/DicomImageInformation.cpp
164 ${ORTHANC_ROOT}/Core/DicomFormat/DicomInstanceHasher.cpp
165 ${ORTHANC_ROOT}/Core/DicomFormat/DicomIntegerPixelAccessor.cpp
166 ${ORTHANC_ROOT}/Core/DicomFormat/DicomMap.cpp
167 ${ORTHANC_ROOT}/Core/DicomFormat/DicomValue.cpp
168 )
169 endif()
170
171 if (ENABLE_MODULE_JOBS)
172 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
173 ${ORTHANC_ROOT}/Core/JobsEngine/GenericJobUnserializer.cpp
174 ${ORTHANC_ROOT}/Core/JobsEngine/JobInfo.cpp
175 ${ORTHANC_ROOT}/Core/JobsEngine/JobStatus.cpp
176 ${ORTHANC_ROOT}/Core/JobsEngine/JobStepResult.cpp
177 ${ORTHANC_ROOT}/Core/JobsEngine/Operations/JobOperationValues.cpp
178 ${ORTHANC_ROOT}/Core/JobsEngine/Operations/LogJobOperation.cpp
179 ${ORTHANC_ROOT}/Core/JobsEngine/Operations/SequenceOfOperationsJob.cpp
180 ${ORTHANC_ROOT}/Core/JobsEngine/SetOfCommandsJob.cpp
181 ${ORTHANC_ROOT}/Core/JobsEngine/SetOfInstancesJob.cpp
182 )
183 endif()
184
185
186
187 #####################################################################
188 ## Configuration of optional third-party dependencies
189 #####################################################################
190
191
192 ##
193 ## Embedded database: SQLite
194 ##
195
196 if (ENABLE_SQLITE)
197 include(${CMAKE_CURRENT_LIST_DIR}/SQLiteConfiguration.cmake)
198 add_definitions(-DORTHANC_ENABLE_SQLITE=1)
199
200 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
201 ${ORTHANC_ROOT}/Core/SQLite/Connection.cpp
202 ${ORTHANC_ROOT}/Core/SQLite/FunctionContext.cpp
203 ${ORTHANC_ROOT}/Core/SQLite/Statement.cpp
204 ${ORTHANC_ROOT}/Core/SQLite/StatementId.cpp
205 ${ORTHANC_ROOT}/Core/SQLite/StatementReference.cpp
206 ${ORTHANC_ROOT}/Core/SQLite/Transaction.cpp
207 )
208 endif()
209
210
211 ##
212 ## Cryptography: OpenSSL and libp11
213 ## Must be above "ENABLE_WEB_CLIENT" and "ENABLE_WEB_SERVER"
214 ##
215
216 if (ENABLE_CRYPTO_OPTIONS)
217 if (ENABLE_SSL)
218 include(${CMAKE_CURRENT_LIST_DIR}/OpenSslConfiguration.cmake)
219 add_definitions(-DORTHANC_ENABLE_SSL=1)
220 else()
221 unset(ENABLE_OPENSSL_ENGINES CACHE)
222 unset(USE_SYSTEM_OPENSSL CACHE)
223 add_definitions(-DORTHANC_ENABLE_SSL=0)
224 endif()
225
226 if (ENABLE_PKCS11)
227 if (ENABLE_SSL)
228 include(${CMAKE_CURRENT_LIST_DIR}/LibP11Configuration.cmake)
229
230 add_definitions(-DORTHANC_ENABLE_PKCS11=1)
231 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
232 ${ORTHANC_ROOT}/Core/Pkcs11.cpp
233 )
234 else()
235 message(FATAL_ERROR "OpenSSL is required to enable PKCS#11 support")
236 endif()
237 else()
238 add_definitions(-DORTHANC_ENABLE_PKCS11=0)
239 endif()
240 endif()
241
242
243 ##
244 ## HTTP client: libcurl
245 ##
246
247 if (ENABLE_WEB_CLIENT)
248 include(${CMAKE_CURRENT_LIST_DIR}/LibCurlConfiguration.cmake)
249 add_definitions(-DORTHANC_ENABLE_CURL=1)
250
251 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
252 ${ORTHANC_ROOT}/Core/HttpClient.cpp
253 )
254 endif()
255
256
257 ##
258 ## HTTP server: Mongoose 3.8 or Civetweb
259 ##
260
261 if (ENABLE_WEB_SERVER)
262 if (ENABLE_CIVETWEB)
263 include(${CMAKE_CURRENT_LIST_DIR}/CivetwebConfiguration.cmake)
264 add_definitions(
265 -DORTHANC_ENABLE_CIVETWEB=1
266 -DORTHANC_ENABLE_MONGOOSE=0
267 )
268 set(ORTHANC_ENABLE_CIVETWEB 1)
269 else()
270 include(${CMAKE_CURRENT_LIST_DIR}/MongooseConfiguration.cmake)
271 endif()
272
273 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
274 ${ORTHANC_ROOT}/Core/HttpServer/BufferHttpSender.cpp
275 ${ORTHANC_ROOT}/Core/HttpServer/FilesystemHttpHandler.cpp
276 ${ORTHANC_ROOT}/Core/HttpServer/FilesystemHttpSender.cpp
277 ${ORTHANC_ROOT}/Core/HttpServer/HttpContentNegociation.cpp
278 ${ORTHANC_ROOT}/Core/HttpServer/HttpFileSender.cpp
279 ${ORTHANC_ROOT}/Core/HttpServer/HttpOutput.cpp
280 ${ORTHANC_ROOT}/Core/HttpServer/HttpServer.cpp
281 ${ORTHANC_ROOT}/Core/HttpServer/HttpStreamTranscoder.cpp
282 ${ORTHANC_ROOT}/Core/HttpServer/HttpToolbox.cpp
283 ${ORTHANC_ROOT}/Core/HttpServer/StringHttpOutput.cpp
284 ${ORTHANC_ROOT}/Core/RestApi/RestApi.cpp
285 ${ORTHANC_ROOT}/Core/RestApi/RestApiCall.cpp
286 ${ORTHANC_ROOT}/Core/RestApi/RestApiGetCall.cpp
287 ${ORTHANC_ROOT}/Core/RestApi/RestApiHierarchy.cpp
288 ${ORTHANC_ROOT}/Core/RestApi/RestApiOutput.cpp
289 ${ORTHANC_ROOT}/Core/RestApi/RestApiPath.cpp
290 )
291 endif()
292
293 if (ORTHANC_ENABLE_CIVETWEB)
294 add_definitions(-DORTHANC_ENABLE_CIVETWEB=1)
295 else()
296 add_definitions(-DORTHANC_ENABLE_CIVETWEB=0)
297 endif()
298
299 if (ORTHANC_ENABLE_MONGOOSE)
300 add_definitions(-DORTHANC_ENABLE_MONGOOSE=1)
301 else()
302 add_definitions(-DORTHANC_ENABLE_MONGOOSE=0)
303 endif()
304
305
306
307 ##
308 ## JPEG support: libjpeg
309 ##
310
311 if (ENABLE_JPEG)
312 if (NOT ENABLE_MODULE_IMAGES)
313 message(FATAL_ERROR "Image processing primitives must be enabled if enabling libjpeg support")
314 endif()
315
316 include(${CMAKE_CURRENT_LIST_DIR}/LibJpegConfiguration.cmake)
317 add_definitions(-DORTHANC_ENABLE_JPEG=1)
318
319 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
320 ${ORTHANC_ROOT}/Core/Images/JpegErrorManager.cpp
321 ${ORTHANC_ROOT}/Core/Images/JpegReader.cpp
322 ${ORTHANC_ROOT}/Core/Images/JpegWriter.cpp
323 )
324 endif()
325
326
327 ##
328 ## zlib support
329 ##
330
331 if (ENABLE_ZLIB)
332 include(${CMAKE_CURRENT_LIST_DIR}/ZlibConfiguration.cmake)
333 add_definitions(-DORTHANC_ENABLE_ZLIB=1)
334
335 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
336 ${ORTHANC_ROOT}/Core/Compression/DeflateBaseCompressor.cpp
337 ${ORTHANC_ROOT}/Core/Compression/GzipCompressor.cpp
338 ${ORTHANC_ROOT}/Core/Compression/ZlibCompressor.cpp
339 )
340
341 if (NOT ORTHANC_SANDBOXED)
342 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
343 ${ORTHANC_ROOT}/Core/Compression/HierarchicalZipWriter.cpp
344 ${ORTHANC_ROOT}/Core/Compression/ZipWriter.cpp
345 ${ORTHANC_ROOT}/Core/FileStorage/StorageAccessor.cpp
346 )
347 endif()
348 endif()
349
350
351 ##
352 ## PNG support: libpng (in conjunction with zlib)
353 ##
354
355 if (ENABLE_PNG)
356 if (NOT ENABLE_ZLIB)
357 message(FATAL_ERROR "Support for zlib must be enabled if enabling libpng support")
358 endif()
359
360 if (NOT ENABLE_MODULE_IMAGES)
361 message(FATAL_ERROR "Image processing primitives must be enabled if enabling libpng support")
362 endif()
363
364 include(${CMAKE_CURRENT_LIST_DIR}/LibPngConfiguration.cmake)
365 add_definitions(-DORTHANC_ENABLE_PNG=1)
366
367 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
368 ${ORTHANC_ROOT}/Core/Images/PngReader.cpp
369 ${ORTHANC_ROOT}/Core/Images/PngWriter.cpp
370 )
371 endif()
372
373
374 ##
375 ## Lua support
376 ##
377
378 if (ENABLE_LUA)
379 include(${CMAKE_CURRENT_LIST_DIR}/LuaConfiguration.cmake)
380 add_definitions(-DORTHANC_ENABLE_LUA=1)
381
382 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
383 ${ORTHANC_ROOT}/Core/Lua/LuaContext.cpp
384 ${ORTHANC_ROOT}/Core/Lua/LuaFunctionCall.cpp
385 )
386 endif()
387
388
389 ##
390 ## XML support: pugixml
391 ##
392
393 if (ENABLE_PUGIXML)
394 include(${CMAKE_CURRENT_LIST_DIR}/PugixmlConfiguration.cmake)
395 add_definitions(-DORTHANC_ENABLE_PUGIXML=1)
396 endif()
397
398
399 ##
400 ## Locale support
401 ##
402
403 if (ENABLE_LOCALE)
404 if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
405 # In WebAssembly or asm.js, we rely on the version of iconv that
406 # is shipped with the stdlib
407 unset(BOOST_LOCALE_BACKEND CACHE)
408 else()
409 if (BOOST_LOCALE_BACKEND STREQUAL "gcc")
410 elseif (BOOST_LOCALE_BACKEND STREQUAL "libiconv")
411 include(${CMAKE_CURRENT_LIST_DIR}/LibIconvConfiguration.cmake)
412 elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
413 include(${CMAKE_CURRENT_LIST_DIR}/LibIcuConfiguration.cmake)
414 elseif (BOOST_LOCALE_BACKEND STREQUAL "wconv")
415 message("Using Microsoft Window's wconv")
416 else()
417 message(FATAL_ERROR "Invalid value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}")
418 endif()
419 endif()
420
421 add_definitions(-DORTHANC_ENABLE_LOCALE=1)
422 endif()
423
424
425 ##
426 ## Google Test for unit testing
427 ##
428
429 if (ENABLE_GOOGLE_TEST)
430 include(${CMAKE_CURRENT_LIST_DIR}/GoogleTestConfiguration.cmake)
431 endif()
432
433
434
435 #####################################################################
436 ## Inclusion of mandatory third-party dependencies
437 #####################################################################
438
439 include(${CMAKE_CURRENT_LIST_DIR}/JsonCppConfiguration.cmake)
440 include(${CMAKE_CURRENT_LIST_DIR}/UuidConfiguration.cmake)
441
442 # We put Boost as the last dependency, as it is the heaviest to
443 # configure, which allows one to quickly spot problems when configuring
444 # static builds in other dependencies
445 include(${CMAKE_CURRENT_LIST_DIR}/BoostConfiguration.cmake)
446
447
448 #####################################################################
449 ## Optional configuration of DCMTK
450 #####################################################################
451
452 if (ENABLE_DCMTK)
453 if (NOT ENABLE_LOCALE)
454 message(FATAL_ERROR "Support for locales must be enabled if enabling DCMTK support")
455 endif()
456
457 if (NOT ENABLE_MODULE_DICOM)
458 message(FATAL_ERROR "DICOM module must be enabled if enabling DCMTK support")
459 endif()
460
461 include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfiguration.cmake)
462
463 add_definitions(-DORTHANC_ENABLE_DCMTK=1)
464
465 if (ENABLE_DCMTK_JPEG)
466 add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG=1)
467 else()
468 add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG=0)
469 endif()
470
471 if (ENABLE_DCMTK_JPEG_LOSSLESS)
472 add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=1)
473 else()
474 add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=0)
475 endif()
476
477 set(ORTHANC_DICOM_SOURCES_INTERNAL
478 ${ORTHANC_ROOT}/Core/DicomParsing/DicomModification.cpp
479 ${ORTHANC_ROOT}/Core/DicomParsing/DicomWebJsonVisitor.cpp
480 ${ORTHANC_ROOT}/Core/DicomParsing/FromDcmtkBridge.cpp
481 ${ORTHANC_ROOT}/Core/DicomParsing/ParsedDicomDir.cpp
482 ${ORTHANC_ROOT}/Core/DicomParsing/ParsedDicomFile.cpp
483 ${ORTHANC_ROOT}/Core/DicomParsing/ToDcmtkBridge.cpp
484
485 ${ORTHANC_ROOT}/Core/DicomParsing/Internals/DicomFrameIndex.cpp
486 ${ORTHANC_ROOT}/Core/DicomParsing/Internals/DicomImageDecoder.cpp
487 )
488
489 if (NOT ORTHANC_SANDBOXED)
490 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
491 ${ORTHANC_ROOT}/Core/DicomParsing/DicomDirWriter.cpp
492 )
493 endif()
494
495 if (ENABLE_DCMTK_NETWORKING)
496 add_definitions(-DORTHANC_ENABLE_DCMTK_NETWORKING=1)
497 list(APPEND ORTHANC_DICOM_SOURCES_INTERNAL
498 ${ORTHANC_ROOT}/Core/DicomNetworking/DicomAssociation.cpp
499 ${ORTHANC_ROOT}/Core/DicomNetworking/DicomAssociationParameters.cpp
500 ${ORTHANC_ROOT}/Core/DicomNetworking/DicomControlUserConnection.cpp
501 ${ORTHANC_ROOT}/Core/DicomNetworking/DicomFindAnswers.cpp
502 ${ORTHANC_ROOT}/Core/DicomNetworking/DicomServer.cpp
503 ${ORTHANC_ROOT}/Core/DicomNetworking/DicomStoreUserConnection.cpp
504 ${ORTHANC_ROOT}/Core/DicomNetworking/Internals/CommandDispatcher.cpp
505 ${ORTHANC_ROOT}/Core/DicomNetworking/Internals/FindScp.cpp
506 ${ORTHANC_ROOT}/Core/DicomNetworking/Internals/MoveScp.cpp
507 ${ORTHANC_ROOT}/Core/DicomNetworking/Internals/GetScp.cpp
508 ${ORTHANC_ROOT}/Core/DicomNetworking/Internals/StoreScp.cpp
509 ${ORTHANC_ROOT}/Core/DicomNetworking/RemoteModalityParameters.cpp
510 ${ORTHANC_ROOT}/Core/DicomNetworking/TimeoutDicomConnectionManager.cpp
511 )
512 else()
513 add_definitions(-DORTHANC_ENABLE_DCMTK_NETWORKING=0)
514 endif()
515
516 # New in Orthanc 1.6.0
517 if (ENABLE_DCMTK_TRANSCODING)
518 add_definitions(-DORTHANC_ENABLE_DCMTK_TRANSCODING=1)
519 list(APPEND ORTHANC_DICOM_SOURCES_INTERNAL
520 ${ORTHANC_ROOT}/Core/DicomParsing/DcmtkTranscoder.cpp
521 ${ORTHANC_ROOT}/Core/DicomParsing/IDicomTranscoder.cpp
522 ${ORTHANC_ROOT}/Core/DicomParsing/MemoryBufferTranscoder.cpp
523 )
524 else()
525 add_definitions(-DORTHANC_ENABLE_DCMTK_TRANSCODING=0)
526 endif()
527 endif()
528
529
530 #####################################################################
531 ## Configuration of the C/C++ macros
532 #####################################################################
533
534 add_definitions(
535 -DORTHANC_API_VERSION=${ORTHANC_API_VERSION}
536 -DORTHANC_DATABASE_VERSION=${ORTHANC_DATABASE_VERSION}
537 -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1
538 -DORTHANC_ENABLE_BASE64=1
539 -DORTHANC_ENABLE_MD5=1
540 -DORTHANC_MAXIMUM_TAG_LENGTH=256
541 -DORTHANC_VERSION="${ORTHANC_VERSION}"
542 )
543
544
545 if (ORTHANC_BUILDING_FRAMEWORK_LIBRARY)
546 add_definitions(-DORTHANC_BUILDING_FRAMEWORK_LIBRARY=1)
547 else()
548 add_definitions(-DORTHANC_BUILDING_FRAMEWORK_LIBRARY=0)
549 endif()
550
551
552 if (ORTHANC_SANDBOXED)
553 add_definitions(
554 -DORTHANC_SANDBOXED=1
555 )
556
557 if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
558 set(ORTHANC_ENABLE_LOGGING ON)
559 set(ORTHANC_ENABLE_LOGGING_STDIO ON)
560 else()
561 set(ORTHANC_ENABLE_LOGGING OFF)
562 endif()
563
564 else()
565 set(ORTHANC_ENABLE_LOGGING ON)
566 set(ORTHANC_ENABLE_LOGGING_STDIO OFF)
567
568 add_definitions(
569 -DORTHANC_SANDBOXED=0
570 )
571
572 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
573 ${ORTHANC_ROOT}/Core/Cache/SharedArchive.cpp
574 ${ORTHANC_ROOT}/Core/FileBuffer.cpp
575 ${ORTHANC_ROOT}/Core/FileStorage/FilesystemStorage.cpp
576 ${ORTHANC_ROOT}/Core/MetricsRegistry.cpp
577 ${ORTHANC_ROOT}/Core/MultiThreading/RunnableWorkersPool.cpp
578 ${ORTHANC_ROOT}/Core/MultiThreading/Semaphore.cpp
579 ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp
580 ${ORTHANC_ROOT}/Core/SharedLibrary.cpp
581 ${ORTHANC_ROOT}/Core/SystemToolbox.cpp
582 ${ORTHANC_ROOT}/Core/TemporaryFile.cpp
583 )
584
585 if (ENABLE_MODULE_JOBS)
586 list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
587 ${ORTHANC_ROOT}/Core/JobsEngine/JobsEngine.cpp
588 ${ORTHANC_ROOT}/Core/JobsEngine/JobsRegistry.cpp
589 )
590 endif()
591 endif()
592
593
594
595 if (ORTHANC_ENABLE_LOGGING)
596 add_definitions(-DORTHANC_ENABLE_LOGGING=1)
597 else()
598 add_definitions(-DORTHANC_ENABLE_LOGGING=0)
599 endif()
600
601 if (ORTHANC_ENABLE_LOGGING_STDIO)
602 add_definitions(-DORTHANC_ENABLE_LOGGING_STDIO=1)
603 else()
604 add_definitions(-DORTHANC_ENABLE_LOGGING_STDIO=0)
605 endif()
606
607
608
609 #####################################################################
610 ## Configuration of Orthanc versioning macros (new in Orthanc 1.5.0)
611 #####################################################################
612
613 if (ORTHANC_VERSION STREQUAL "mainline")
614 set(ORTHANC_VERSION_MAJOR "999")
615 set(ORTHANC_VERSION_MINOR "999")
616 set(ORTHANC_VERSION_REVISION "999")
617 else()
618 string(REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\1" ORTHANC_VERSION_MAJOR ${ORTHANC_VERSION})
619 string(REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\2" ORTHANC_VERSION_MINOR ${ORTHANC_VERSION})
620 string(REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\3" ORTHANC_VERSION_REVISION ${ORTHANC_VERSION})
621
622 if (NOT ORTHANC_VERSION STREQUAL
623 "${ORTHANC_VERSION_MAJOR}.${ORTHANC_VERSION_MINOR}.${ORTHANC_VERSION_REVISION}")
624 message(FATAL_ERROR "Error in the (x.y.z) format of the Orthanc version: ${ORTHANC_VERSION}")
625 endif()
626 endif()
627
628 add_definitions(
629 -DORTHANC_VERSION_MAJOR=${ORTHANC_VERSION_MAJOR}
630 -DORTHANC_VERSION_MINOR=${ORTHANC_VERSION_MINOR}
631 -DORTHANC_VERSION_REVISION=${ORTHANC_VERSION_REVISION}
632 )
633
634
635
636 #####################################################################
637 ## Gathering of all the source code
638 #####################################################################
639
640 # The "xxx_INTERNAL" variables list the source code that belongs to
641 # the Orthanc project. It can be used to configure precompiled headers
642 # if using Microsoft Visual Studio.
643
644 # The "xxx_DEPENDENCIES" variables list the source code coming from
645 # third-party dependencies.
646
647
648 set(ORTHANC_CORE_SOURCES_DEPENDENCIES
649 ${BOOST_SOURCES}
650 ${CIVETWEB_SOURCES}
651 ${CURL_SOURCES}
652 ${JSONCPP_SOURCES}
653 ${LIBICONV_SOURCES}
654 ${LIBICU_SOURCES}
655 ${LIBJPEG_SOURCES}
656 ${LIBP11_SOURCES}
657 ${LIBPNG_SOURCES}
658 ${LUA_SOURCES}
659 ${MONGOOSE_SOURCES}
660 ${OPENSSL_SOURCES}
661 ${PUGIXML_SOURCES}
662 ${SQLITE_SOURCES}
663 ${UUID_SOURCES}
664 ${ZLIB_SOURCES}
665
666 ${ORTHANC_ROOT}/Resources/ThirdParty/md5/md5.c
667 ${ORTHANC_ROOT}/Resources/ThirdParty/base64/base64.cpp
668 )
669
670 if (ENABLE_ZLIB AND NOT ORTHANC_SANDBOXED)
671 list(APPEND ORTHANC_CORE_SOURCES_DEPENDENCIES
672 # This is the minizip distribution to create ZIP files using zlib
673 ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/ioapi.c
674 ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/zip.c
675 )
676 endif()
677
678
679 if (NOT "${LIBICU_RESOURCES}" STREQUAL "" OR
680 NOT "${DCMTK_DICTIONARIES}" STREQUAL "")
681 EmbedResources(
682 --namespace=Orthanc.FrameworkResources
683 --target=OrthancFrameworkResources
684 --framework-path=${ORTHANC_ROOT}/Core
685 ${LIBICU_RESOURCES}
686 ${DCMTK_DICTIONARIES}
687 )
688 endif()
689
690
691 set(ORTHANC_CORE_SOURCES
692 ${ORTHANC_CORE_SOURCES_INTERNAL}
693 ${ORTHANC_CORE_SOURCES_DEPENDENCIES}
694 )
695
696 if (ENABLE_DCMTK)
697 list(APPEND ORTHANC_DICOM_SOURCES_DEPENDENCIES
698 ${DCMTK_SOURCES}
699 )
700
701 set(ORTHANC_DICOM_SOURCES
702 ${ORTHANC_DICOM_SOURCES_INTERNAL}
703 ${ORTHANC_DICOM_SOURCES_DEPENDENCIES}
704 )
705 endif()