comparison CMakeLists.txt @ 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 7284093111b0
children 88402bd5dbf5
comparison
equal deleted inserted replaced
2387:a60a79929007 2388:50cde8246542
1 cmake_minimum_required(VERSION 2.8) 1 cmake_minimum_required(VERSION 2.8)
2 2
3 project(Orthanc) 3 project(Orthanc)
4 4
5 # Version of the build, should always be "mainline" except in release branches 5
6 set(ORTHANC_VERSION "mainline") 6 #####################################################################
7 7 ## Generic parameters of the Orthanc framework
8 # Version of the database schema. History: 8 #####################################################################
9 # * Orthanc 0.1.0 -> Orthanc 0.3.0 = no versioning 9
10 # * Orthanc 0.3.1 = version 2 10 include(${CMAKE_SOURCE_DIR}/Resources/CMake/OrthancFrameworkParameters.cmake)
11 # * Orthanc 0.4.0 -> Orthanc 0.7.2 = version 3 11
12 # * Orthanc 0.7.3 -> Orthanc 0.8.4 = version 4 12 # Enable all the optional components of the Orthanc framework
13 # * Orthanc 0.8.5 -> Orthanc 0.9.4 = version 5 13 set(ENABLE_CRYPTO_OPTIONS ON)
14 # * Orthanc 0.9.5 -> mainline = version 6 14 set(ENABLE_JPEG ON)
15 set(ORTHANC_DATABASE_VERSION 6) 15 set(ENABLE_LOCALE ON)
16 set(ENABLE_LUA ON)
17 set(ENABLE_PNG ON)
18 set(ENABLE_PUGIXML ON)
19 set(ENABLE_SQLITE ON)
20 set(ENABLE_WEB_CLIENT ON)
21 set(ENABLE_WEB_SERVER ON)
22 set(ENABLE_DCMTK ON)
23 set(ENABLE_DCMTK_NETWORKING ON)
24 set(HAS_EMBEDDED_RESOURCES ON)
16 25
17 26
18 ##################################################################### 27 #####################################################################
19 ## CMake parameters tunable at the command line 28 ## CMake parameters tunable at the command line
20 ##################################################################### 29 #####################################################################
21 30
22 # Parameters of the build 31 # Parameters of the build
23 SET(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
24 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)")
25 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL")
26 SET(DCMTK_DICTIONARY_DIR "" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (only when using system version of DCMTK)")
27 SET(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
28 SET(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests")
29 SET(ENABLE_DCMTK_JPEG ON CACHE BOOL "Enable JPEG decompression in DCMTK")
30 SET(ENABLE_DCMTK_JPEG_LOSSLESS ON CACHE BOOL "Enable JPEG-LS (Lossless) decompression in DCMTK")
31 SET(ENABLE_PLUGINS ON CACHE BOOL "Enable plugins")
32 SET(BUILD_SERVE_FOLDERS ON CACHE BOOL "Whether to build the ServeFolders plugin")
33 SET(BUILD_MODALITY_WORKLISTS ON CACHE BOOL "Whether to build the sample plugin to serve modality worklists") 32 SET(BUILD_MODALITY_WORKLISTS ON CACHE BOOL "Whether to build the sample plugin to serve modality worklists")
34 SET(BUILD_RECOVER_COMPRESSED_FILE ON CACHE BOOL "Whether to build the companion tool to recover files compressed using Orthanc") 33 SET(BUILD_RECOVER_COMPRESSED_FILE ON CACHE BOOL "Whether to build the companion tool to recover files compressed using Orthanc")
35 SET(ENABLE_PKCS11 OFF CACHE BOOL "Enable PKCS#11 for HTTPS client authentication using hardware security modules and smart cards") 34 SET(BUILD_SERVE_FOLDERS ON CACHE BOOL "Whether to build the ServeFolders plugin")
36 SET(ENABLE_PROFILING OFF CACHE BOOL "Whether to enable the generation of profiling information with gprof") 35 SET(ENABLE_PLUGINS ON CACHE BOOL "Enable plugins")
37 SET(ENABLE_CIVETWEB OFF CACHE BOOL "Use Civetweb instead of Mongoose (experimental)") 36 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)")
37 SET(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests")
38 38
39 # Advanced parameters to fine-tune linking against system libraries 39 # Advanced parameters to fine-tune linking against system libraries
40 SET(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost") 40 SET(USE_GTEST_DEBIAN_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
41 SET(USE_SYSTEM_CIVETWEB ON CACHE BOOL "Use the system version of Civetweb (experimental)")
42 SET(USE_SYSTEM_CURL ON CACHE BOOL "Use the system version of LibCurl")
43 SET(USE_SYSTEM_DCMTK ON CACHE BOOL "Use the system version of DCMTK")
44 SET(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test") 41 SET(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
45 SET(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
46 SET(USE_SYSTEM_LIBICONV ON CACHE BOOL "Use the system version of libiconv")
47 SET(USE_SYSTEM_LIBJPEG ON CACHE BOOL "Use the system version of libjpeg")
48 SET(USE_SYSTEM_LIBP11 OFF CACHE BOOL "Use the system version of libp11 (PKCS#11 wrapper library)")
49 SET(USE_SYSTEM_LIBPNG ON CACHE BOOL "Use the system version of libpng")
50 SET(USE_SYSTEM_LUA ON CACHE BOOL "Use the system version of Lua")
51 SET(USE_SYSTEM_MONGOOSE ON CACHE BOOL "Use the system version of Mongoose")
52 SET(USE_SYSTEM_OPENSSL ON CACHE BOOL "Use the system version of OpenSSL")
53 SET(USE_SYSTEM_PUGIXML ON CACHE BOOL "Use the system version of Pugixml")
54 SET(USE_SYSTEM_SQLITE ON CACHE BOOL "Use the system version of SQLite")
55 SET(USE_SYSTEM_ZLIB ON CACHE BOOL "Use the system version of ZLib")
56
57 # Advanced parameters
58 SET(USE_PUGIXML ON CACHE BOOL "Use the Pugixml parser (turn off only for debug)")
59 SET(USE_DCMTK_360 OFF CACHE BOOL "Use older DCMTK version 3.6.0 in static builds (instead of default 3.6.2)")
60 SET(USE_DCMTK_362_PRIVATE_DIC ON CACHE BOOL "Use the dictionary of private tags from DCMTK 3.6.2 if using DCMTK 3.6.0")
61
62 # Distribution-specific settings
63 SET(USE_GTEST_DEBIAN_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
64 SET(SYSTEM_MONGOOSE_USE_CALLBACKS ON CACHE BOOL "The system version of Mongoose uses callbacks (version >= 3.7)")
65 SET(USE_BOOST_ICONV ON CACHE BOOL "Use iconv instead of wconv (Windows only)")
66 42
67 mark_as_advanced(USE_GTEST_DEBIAN_SOURCE_PACKAGE) 43 mark_as_advanced(USE_GTEST_DEBIAN_SOURCE_PACKAGE)
68 mark_as_advanced(SYSTEM_MONGOOSE_USE_CALLBACKS) 44
69 mark_as_advanced(USE_BOOST_ICONV) 45
70 mark_as_advanced(USE_PUGIXML) 46 #####################################################################
71 47 ## Configuration of the Orthanc framework
72 # Path to the root folder of the Orthanc distribution 48 #####################################################################
73 set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}) 49
74
75 # These options must be set to "ON" if compiling Orthanc, but might be
76 # set to "OFF" in some plugins if their support is not required
77 set(ENABLE_DCMTK_NETWORKING ON) # Enable support for DICOM networking in DCMTK
78 set(ENABLE_LOCALE ON) # Enable support for locales (notably in Boost)
79
80 # Some basic inclusions
81 include(CheckIncludeFiles)
82 include(CheckIncludeFileCXX)
83 include(CheckFunctionExists)
84 include(CheckLibraryExists)
85 include(FindPythonInterp)
86 include(${CMAKE_SOURCE_DIR}/Resources/CMake/AutoGeneratedCode.cmake)
87 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DownloadPackage.cmake)
88 include(${CMAKE_SOURCE_DIR}/Resources/CMake/Compiler.cmake)
89 include(${CMAKE_SOURCE_DIR}/Resources/CMake/VisualStudioPrecompiledHeaders.cmake) 50 include(${CMAKE_SOURCE_DIR}/Resources/CMake/VisualStudioPrecompiledHeaders.cmake)
90 51 include(${CMAKE_SOURCE_DIR}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
52 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
53
54 include_directories(${ORTHANC_ROOT})
91 55
92 56
93 ##################################################################### 57 #####################################################################
94 ## List of source files 58 ## List of source files
95 ##################################################################### 59 #####################################################################
96 60
97 set(ORTHANC_CORE_SOURCES
98 Core/Cache/MemoryCache.cpp
99 Core/Cache/SharedArchive.cpp
100 Core/ChunkedBuffer.cpp
101 Core/Compression/DeflateBaseCompressor.cpp
102 Core/Compression/GzipCompressor.cpp
103 Core/Compression/HierarchicalZipWriter.cpp
104 Core/Compression/ZipWriter.cpp
105 Core/Compression/ZlibCompressor.cpp
106 Core/DicomFormat/DicomArray.cpp
107 Core/DicomFormat/DicomMap.cpp
108 Core/DicomFormat/DicomTag.cpp
109 Core/DicomFormat/DicomImageInformation.cpp
110 Core/DicomFormat/DicomIntegerPixelAccessor.cpp
111 Core/DicomFormat/DicomInstanceHasher.cpp
112 Core/DicomFormat/DicomValue.cpp
113 Core/Enumerations.cpp
114 Core/FileStorage/FilesystemStorage.cpp
115 Core/FileStorage/StorageAccessor.cpp
116 Core/HttpClient.cpp
117 Core/HttpServer/BufferHttpSender.cpp
118 Core/HttpServer/EmbeddedResourceHttpHandler.cpp
119 Core/HttpServer/FilesystemHttpHandler.cpp
120 Core/HttpServer/HttpToolbox.cpp
121 Core/HttpServer/HttpOutput.cpp
122 Core/HttpServer/StringHttpOutput.cpp
123 Core/HttpServer/MongooseServer.cpp
124 Core/HttpServer/HttpFileSender.cpp
125 Core/HttpServer/FilesystemHttpSender.cpp
126 Core/HttpServer/HttpContentNegociation.cpp
127 Core/HttpServer/HttpStreamTranscoder.cpp
128 Core/Logging.cpp
129 Core/RestApi/RestApiCall.cpp
130 Core/RestApi/RestApiGetCall.cpp
131 Core/RestApi/RestApiHierarchy.cpp
132 Core/RestApi/RestApiPath.cpp
133 Core/RestApi/RestApiOutput.cpp
134 Core/RestApi/RestApi.cpp
135 Core/MultiThreading/BagOfTasksProcessor.cpp
136 Core/MultiThreading/Mutex.cpp
137 Core/MultiThreading/ReaderWriterLock.cpp
138 Core/MultiThreading/RunnableWorkersPool.cpp
139 Core/MultiThreading/Semaphore.cpp
140 Core/MultiThreading/SharedMessageQueue.cpp
141 Core/Images/Font.cpp
142 Core/Images/FontRegistry.cpp
143 Core/Images/IImageWriter.cpp
144 Core/Images/Image.cpp
145 Core/Images/ImageAccessor.cpp
146 Core/Images/ImageBuffer.cpp
147 Core/Images/ImageProcessing.cpp
148 Core/Images/JpegErrorManager.cpp
149 Core/Images/JpegReader.cpp
150 Core/Images/JpegWriter.cpp
151 Core/Images/PngReader.cpp
152 Core/Images/PngWriter.cpp
153 Core/SQLite/Connection.cpp
154 Core/SQLite/FunctionContext.cpp
155 Core/SQLite/Statement.cpp
156 Core/SQLite/StatementId.cpp
157 Core/SQLite/StatementReference.cpp
158 Core/SQLite/Transaction.cpp
159 Core/SystemToolbox.cpp
160 Core/TemporaryFile.cpp
161 Core/Toolbox.cpp
162 Core/WebServiceParameters.cpp
163 Core/Lua/LuaContext.cpp
164 Core/Lua/LuaFunctionCall.cpp
165 )
166
167
168 set(ORTHANC_SERVER_SOURCES 61 set(ORTHANC_SERVER_SOURCES
169 Core/DicomParsing/DicomDirWriter.cpp 62 ${ORTHANC_DICOM_SOURCES}
170 Core/DicomParsing/DicomModification.cpp 63
171 Core/DicomParsing/FromDcmtkBridge.cpp
172 Core/DicomParsing/Internals/DicomFrameIndex.cpp
173 Core/DicomParsing/Internals/DicomImageDecoder.cpp
174 Core/DicomParsing/ParsedDicomFile.cpp
175 Core/DicomParsing/ToDcmtkBridge.cpp
176
177 Core/DicomNetworking/DicomFindAnswers.cpp
178 Core/DicomNetworking/DicomServer.cpp
179 Core/DicomNetworking/DicomUserConnection.cpp
180 Core/DicomNetworking/RemoteModalityParameters.cpp
181 Core/DicomNetworking/ReusableDicomUserConnection.cpp
182 Core/DicomNetworking/Internals/CommandDispatcher.cpp
183 Core/DicomNetworking/Internals/FindScp.cpp
184 Core/DicomNetworking/Internals/MoveScp.cpp
185 Core/DicomNetworking/Internals/StoreScp.cpp
186
187 OrthancServer/DatabaseWrapper.cpp 64 OrthancServer/DatabaseWrapper.cpp
188 OrthancServer/DatabaseWrapperBase.cpp 65 OrthancServer/DatabaseWrapperBase.cpp
66 OrthancServer/DicomInstanceToStore.cpp
189 OrthancServer/ExportedResource.cpp 67 OrthancServer/ExportedResource.cpp
190 OrthancServer/LuaScripting.cpp 68 OrthancServer/LuaScripting.cpp
191 OrthancServer/OrthancFindRequestHandler.cpp 69 OrthancServer/OrthancFindRequestHandler.cpp
192 OrthancServer/OrthancHttpHandler.cpp 70 OrthancServer/OrthancHttpHandler.cpp
193 OrthancServer/OrthancInitialization.cpp 71 OrthancServer/OrthancInitialization.cpp
198 OrthancServer/OrthancRestApi/OrthancRestChanges.cpp 76 OrthancServer/OrthancRestApi/OrthancRestChanges.cpp
199 OrthancServer/OrthancRestApi/OrthancRestModalities.cpp 77 OrthancServer/OrthancRestApi/OrthancRestModalities.cpp
200 OrthancServer/OrthancRestApi/OrthancRestResources.cpp 78 OrthancServer/OrthancRestApi/OrthancRestResources.cpp
201 OrthancServer/OrthancRestApi/OrthancRestSystem.cpp 79 OrthancServer/OrthancRestApi/OrthancRestSystem.cpp
202 OrthancServer/QueryRetrieveHandler.cpp 80 OrthancServer/QueryRetrieveHandler.cpp
81 OrthancServer/Scheduler/CallSystemCommand.cpp
82 OrthancServer/Scheduler/DeleteInstanceCommand.cpp
83 OrthancServer/Scheduler/ModifyInstanceCommand.cpp
84 OrthancServer/Scheduler/ServerCommandInstance.cpp
85 OrthancServer/Scheduler/ServerJob.cpp
86 OrthancServer/Scheduler/ServerScheduler.cpp
87 OrthancServer/Scheduler/StorePeerCommand.cpp
88 OrthancServer/Scheduler/StoreScuCommand.cpp
203 OrthancServer/Search/HierarchicalMatcher.cpp 89 OrthancServer/Search/HierarchicalMatcher.cpp
204 OrthancServer/Search/IFindConstraint.cpp 90 OrthancServer/Search/IFindConstraint.cpp
91 OrthancServer/Search/ListConstraint.cpp
205 OrthancServer/Search/LookupIdentifierQuery.cpp 92 OrthancServer/Search/LookupIdentifierQuery.cpp
206 OrthancServer/Search/LookupResource.cpp 93 OrthancServer/Search/LookupResource.cpp
94 OrthancServer/Search/RangeConstraint.cpp
207 OrthancServer/Search/SetOfResources.cpp 95 OrthancServer/Search/SetOfResources.cpp
208 OrthancServer/Search/ListConstraint.cpp
209 OrthancServer/Search/RangeConstraint.cpp
210 OrthancServer/Search/ValueConstraint.cpp 96 OrthancServer/Search/ValueConstraint.cpp
211 OrthancServer/Search/WildcardConstraint.cpp 97 OrthancServer/Search/WildcardConstraint.cpp
212 OrthancServer/ServerContext.cpp 98 OrthancServer/ServerContext.cpp
213 OrthancServer/ServerEnumerations.cpp 99 OrthancServer/ServerEnumerations.cpp
214 OrthancServer/ServerIndex.cpp 100 OrthancServer/ServerIndex.cpp
215 OrthancServer/ServerToolbox.cpp 101 OrthancServer/ServerToolbox.cpp
216 OrthancServer/SliceOrdering.cpp 102 OrthancServer/SliceOrdering.cpp
217
218 # From "lua-scripting" branch
219 OrthancServer/DicomInstanceToStore.cpp
220 OrthancServer/Scheduler/DeleteInstanceCommand.cpp
221 OrthancServer/Scheduler/ModifyInstanceCommand.cpp
222 OrthancServer/Scheduler/ServerCommandInstance.cpp
223 OrthancServer/Scheduler/ServerJob.cpp
224 OrthancServer/Scheduler/ServerScheduler.cpp
225 OrthancServer/Scheduler/StorePeerCommand.cpp
226 OrthancServer/Scheduler/StoreScuCommand.cpp
227 OrthancServer/Scheduler/CallSystemCommand.cpp
228 ) 103 )
229 104
230 105
231 set(ORTHANC_UNIT_TESTS_SOURCES 106 set(ORTHANC_UNIT_TESTS_SOURCES
232 UnitTestsSources/DicomMapTests.cpp 107 UnitTestsSources/DicomMapTests.cpp
263 UnitTestsSources/PluginsTests.cpp 138 UnitTestsSources/PluginsTests.cpp
264 ) 139 )
265 endif() 140 endif()
266 141
267 142
268 set(ORTHANC_ALL_SOURCES
269 ${ORTHANC_CORE_SOURCES}
270 ${ORTHANC_SERVER_SOURCES}
271 ${ORTHANC_UNIT_TESTS_SOURCES}
272 Plugins/Samples/ServeFolders/Plugin.cpp
273 Plugins/Samples/ModalityWorklists/Plugin.cpp
274 OrthancServer/main.cpp
275 )
276
277
278 if (CMAKE_COMPILER_IS_GNUCXX 143 if (CMAKE_COMPILER_IS_GNUCXX
279 AND NOT CMAKE_CROSSCOMPILING 144 AND NOT CMAKE_CROSSCOMPILING
280 AND USE_DCMTK_360) 145 AND USE_DCMTK_360)
281 # Add the "-pedantic" flag only on the Orthanc sources, and only if 146 # Add the "-pedantic" flag only on the Orthanc sources, and only if
282 # using DCMTK 3.6.0 147 # cross-compiling DCMTK 3.6.0
148 set(ORTHANC_ALL_SOURCES
149 ${ORTHANC_CORE_SOURCES_INTERNAL}
150 ${ORTHANC_SERVER_SOURCES}
151 ${ORTHANC_UNIT_TESTS_SOURCES}
152 Plugins/Samples/ServeFolders/Plugin.cpp
153 Plugins/Samples/ModalityWorklists/Plugin.cpp
154 OrthancServer/main.cpp
155 )
156
283 set_source_files_properties(${ORTHANC_ALL_SOURCES} 157 set_source_files_properties(${ORTHANC_ALL_SOURCES}
284 PROPERTIES COMPILE_FLAGS -pedantic 158 PROPERTIES COMPILE_FLAGS -pedantic
285 ) 159 )
286 endif() 160 endif()
287 161
162
163 #####################################################################
164 ## Autogeneration of files
165 #####################################################################
288 166
289 set(ORTHANC_EMBEDDED_FILES 167 set(ORTHANC_EMBEDDED_FILES
290 PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql 168 PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql
291 UPGRADE_DATABASE_3_TO_4 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade3To4.sql 169 UPGRADE_DATABASE_3_TO_4 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade3To4.sql
292 UPGRADE_DATABASE_4_TO_5 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade4To5.sql 170 UPGRADE_DATABASE_4_TO_5 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade4To5.sql
294 DICOM_CONFORMANCE_STATEMENT ${CMAKE_CURRENT_SOURCE_DIR}/Resources/DicomConformanceStatement.txt 172 DICOM_CONFORMANCE_STATEMENT ${CMAKE_CURRENT_SOURCE_DIR}/Resources/DicomConformanceStatement.txt
295 LUA_TOOLBOX ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Toolbox.lua 173 LUA_TOOLBOX ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Toolbox.lua
296 FONT_UBUNTU_MONO_BOLD_16 ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/UbuntuMonoBold-16.json 174 FONT_UBUNTU_MONO_BOLD_16 ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/UbuntuMonoBold-16.json
297 ) 175 )
298 176
299
300
301 #####################################################################
302 ## Inclusion of third-party dependencies
303 #####################################################################
304
305 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake)
306 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake)
307 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake)
308 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibJpegConfiguration.cmake)
309 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LuaConfiguration.cmake)
310 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake)
311 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake)
312 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
313 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibIconvConfiguration.cmake)
314 include(${CMAKE_SOURCE_DIR}/Resources/CMake/OpenSslConfiguration.cmake)
315
316 if (USE_PUGIXML)
317 include(${CMAKE_SOURCE_DIR}/Resources/CMake/PugixmlConfiguration.cmake)
318 add_definitions(-DORTHANC_ENABLE_PUGIXML=1)
319 else()
320 add_definitions(-DORTHANC_ENABLE_PUGIXML=0)
321 endif()
322
323 if (ENABLE_CIVETWEB)
324 include(${CMAKE_SOURCE_DIR}/Resources/CMake/CivetwebConfiguration.cmake)
325 add_definitions(
326 -DORTHANC_ENABLE_CIVETWEB=1
327 -DORTHANC_ENABLE_MONGOOSE=0
328 )
329 else()
330 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake)
331 add_definitions(
332 -DORTHANC_ENABLE_CIVETWEB=0
333 -DORTHANC_ENABLE_MONGOOSE=1
334 )
335 endif()
336
337 # These are the two most heavyweight dependencies. We put them as the
338 # last includes to quickly spot problems when configuring static
339 # builds.
340 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake)
341 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
342
343
344 if (ENABLE_SSL)
345 add_definitions(-DORTHANC_ENABLE_SSL=1)
346 else()
347 add_definitions(-DORTHANC_ENABLE_SSL=0)
348 endif()
349
350
351 if (ENABLE_DCMTK_JPEG)
352 add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG=1)
353 else()
354 add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG=0)
355 endif()
356
357
358 if (ENABLE_DCMTK_JPEG_LOSSLESS)
359 add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=1)
360 else()
361 add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=0)
362 endif()
363
364
365 if (ENABLE_PLUGINS)
366 add_definitions(-DORTHANC_ENABLE_PLUGINS=1)
367 else()
368 add_definitions(-DORTHANC_ENABLE_PLUGINS=0)
369 endif()
370
371
372 if (ENABLE_LOCALE)
373 add_definitions(-DORTHANC_ENABLE_LOCALE=1)
374 else()
375 add_definitions(-DORTHANC_ENABLE_LOCALE=0)
376 endif()
377
378
379 if (ENABLE_PKCS11)
380 if (ENABLE_SSL)
381 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibP11Configuration.cmake)
382
383 add_definitions(-DORTHANC_ENABLE_PKCS11=1)
384 list(APPEND ORTHANC_CORE_SOURCES Core/Pkcs11.cpp)
385 else()
386 message(FATAL_ERROR "OpenSSL is required to enable PKCS#11")
387 endif()
388 else()
389 add_definitions(-DORTHANC_ENABLE_PKCS11=0)
390 endif()
391
392
393
394 #####################################################################
395 ## Autogeneration of files
396 #####################################################################
397
398 if (STANDALONE_BUILD) 177 if (STANDALONE_BUILD)
399 # We embed all the resources in the binaries for standalone builds 178 # We embed all the resources in the binaries for standalone builds
400 add_definitions(-DORTHANC_STANDALONE=1) 179 add_definitions(-DORTHANC_STANDALONE=1)
401 EmbedResources( 180 EmbedResources(
402 ${ORTHANC_EMBEDDED_FILES} 181 ${ORTHANC_EMBEDDED_FILES}
433 212
434 ##################################################################### 213 #####################################################################
435 ## Configuration of the C/C++ macros 214 ## Configuration of the C/C++ macros
436 ##################################################################### 215 #####################################################################
437 216
217 if (ENABLE_PLUGINS)
218 add_definitions(-DORTHANC_ENABLE_PLUGINS=1)
219 else()
220 add_definitions(-DORTHANC_ENABLE_PLUGINS=0)
221 endif()
222
223
438 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS) 224 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS)
439 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1) 225 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1)
440 else() 226 else()
441 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0) 227 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0)
442 endif() 228 endif()
443 229
230
444 include_directories(${CMAKE_SOURCE_DIR}/Plugins/Include) 231 include_directories(${CMAKE_SOURCE_DIR}/Plugins/Include)
445 232
446 add_definitions( 233 add_definitions(
447 -DORTHANC_VERSION="${ORTHANC_VERSION}"
448 -DORTHANC_DATABASE_VERSION=${ORTHANC_DATABASE_VERSION}
449 -DORTHANC_BUILD_UNIT_TESTS=1 234 -DORTHANC_BUILD_UNIT_TESTS=1
450 -DORTHANC_ENABLE_BASE64=1
451 -DORTHANC_ENABLE_LOGGING=1
452 -DORTHANC_ENABLE_LOGGING_PLUGIN=0
453 -DORTHANC_ENABLE_DCMTK=1
454 -DORTHANC_ENABLE_DCMTK_NETWORKING=1
455 -DORTHANC_ENABLE_JPEG=1
456 -DORTHANC_ENABLE_LUA=1
457 -DORTHANC_ENABLE_MD5=1
458 -DORTHANC_ENABLE_PNG=1
459 -DORTHANC_ENABLE_SQLITE=1
460 -DORTHANC_HAS_EMBEDDED_RESOURCES=1
461 -DORTHANC_MAXIMUM_TAG_LENGTH=256
462 -DORTHANC_SANDBOXED=0
463 -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1
464 235
465 # Macros for the plugins 236 # Macros for the plugins
466 -DHAS_ORTHANC_EXCEPTION=0 237 -DHAS_ORTHANC_EXCEPTION=0
467 -DMODALITY_WORKLISTS_VERSION="${ORTHANC_VERSION}" 238 -DMODALITY_WORKLISTS_VERSION="${ORTHANC_VERSION}"
468 -DSERVE_FOLDERS_VERSION="${ORTHANC_VERSION}" 239 -DSERVE_FOLDERS_VERSION="${ORTHANC_VERSION}"
497 list(LENGTH OPENSSL_SOURCES OPENSSL_SOURCES_LENGTH) 268 list(LENGTH OPENSSL_SOURCES OPENSSL_SOURCES_LENGTH)
498 if (${OPENSSL_SOURCES_LENGTH} GREATER 0) 269 if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
499 add_library(OpenSSL STATIC ${OPENSSL_SOURCES}) 270 add_library(OpenSSL STATIC ${OPENSSL_SOURCES})
500 endif() 271 endif()
501 272
502 # "CodeLibrary" contains all the third-party dependencies and the 273
274 # "CoreLibrary" contains all the third-party dependencies and the
503 # content of the "Core" folder, but not OpenSSL, nor DCMTK. 275 # content of the "Core" folder, but not OpenSSL, nor DCMTK.
504 add_library(CoreLibrary 276 add_library(CoreLibrary
505 STATIC 277 STATIC
506 ${ORTHANC_CORE_SOURCES} 278 ${ORTHANC_CORE_SOURCES}
507 ${AUTOGENERATED_SOURCES} 279 ${AUTOGENERATED_SOURCES}
508
509 ${BOOST_SOURCES}
510 ${CURL_SOURCES}
511 ${JSONCPP_SOURCES}
512 ${LIBICONV_SOURCES}
513 ${LIBJPEG_SOURCES}
514 ${LIBP11_SOURCES}
515 ${LIBPNG_SOURCES}
516 ${LUA_SOURCES}
517 ${CIVETWEB_SOURCES}
518 ${MONGOOSE_SOURCES}
519 ${PUGIXML_SOURCES}
520 ${SQLITE_SOURCES}
521 ${ZLIB_SOURCES}
522
523 ${CMAKE_SOURCE_DIR}/Resources/ThirdParty/md5/md5.c
524 ${CMAKE_SOURCE_DIR}/Resources/ThirdParty/base64/base64.cpp
525
526 # This is the minizip distribution to create ZIP files using zlib
527 ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/ioapi.c
528 ${ORTHANC_ROOT}/Resources/ThirdParty/minizip/zip.c
529 ) 280 )
530 281
531 282
532 ##################################################################### 283 #####################################################################
533 ## Build the Orthanc server 284 ## Build the Orthanc server