Mercurial > hg > orthanc
comparison CMakeLists.txt @ 946:394a19d44f9d lua-scripting
integration mainline -> lua-scripting
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 25 Jun 2014 12:01:12 +0200 |
parents | f0ac3a53ccf2 27d256e0b458 |
children | a91e7b4080d1 |
comparison
equal
deleted
inserted
replaced
783:c9cdd53a6b31 | 946:394a19d44f9d |
---|---|
16 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL") | 16 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL") |
17 SET(BUILD_CLIENT_LIBRARY ON CACHE BOOL "Build the client library") | 17 SET(BUILD_CLIENT_LIBRARY ON CACHE BOOL "Build the client library") |
18 SET(DCMTK_DICTIONARY_DIR "" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (only when using system version of DCMTK)") | 18 SET(DCMTK_DICTIONARY_DIR "" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (only when using system version of DCMTK)") |
19 SET(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages") | 19 SET(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages") |
20 SET(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests") | 20 SET(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests") |
21 SET(ENABLE_JPEG ON CACHE BOOL "Enable JPEG decompression") | |
22 SET(ENABLE_JPEG_LOSSLESS ON CACHE BOOL "Enable JPEG-LS (Lossless) decompression") | |
21 | 23 |
22 # Advanced parameters to fine-tune linking against system libraries | 24 # Advanced parameters to fine-tune linking against system libraries |
23 SET(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp") | 25 SET(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp") |
24 SET(USE_SYSTEM_GOOGLE_LOG ON CACHE BOOL "Use the system version of Google Log") | 26 SET(USE_SYSTEM_GOOGLE_LOG ON CACHE BOOL "Use the system version of Google Log") |
25 SET(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test") | 27 SET(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test") |
42 include(CheckIncludeFileCXX) | 44 include(CheckIncludeFileCXX) |
43 include(CheckLibraryExists) | 45 include(CheckLibraryExists) |
44 include(${CMAKE_SOURCE_DIR}/Resources/CMake/AutoGeneratedCode.cmake) | 46 include(${CMAKE_SOURCE_DIR}/Resources/CMake/AutoGeneratedCode.cmake) |
45 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DownloadPackage.cmake) | 47 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DownloadPackage.cmake) |
46 include(${CMAKE_SOURCE_DIR}/Resources/CMake/Compiler.cmake) | 48 include(${CMAKE_SOURCE_DIR}/Resources/CMake/Compiler.cmake) |
49 include(${CMAKE_SOURCE_DIR}/Resources/CMake/VisualStudioPrecompiledHeaders.cmake) | |
47 | 50 |
48 set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}) | 51 set(ORTHANC_ROOT ${CMAKE_SOURCE_DIR}) |
49 | 52 |
50 | 53 |
51 | 54 |
52 | 55 |
53 ##################################################################### | 56 ##################################################################### |
54 ## Inclusion of third-party dependencies | 57 ## List of source files |
55 ##################################################################### | 58 ##################################################################### |
56 | 59 |
57 # Configuration of the standalone builds | 60 set(ORTHANC_CORE_SOURCES |
58 if (CMAKE_CROSSCOMPILING) | |
59 # Cross-compilation implies the standalone build | |
60 SET(STANDALONE_BUILD ON) | |
61 endif() | |
62 | |
63 # Prepare the third-party dependencies | |
64 SET(THIRD_PARTY_SOURCES | |
65 ${CMAKE_SOURCE_DIR}/Resources/md5/md5.c | |
66 ${CMAKE_SOURCE_DIR}/Resources/base64/base64.cpp | |
67 ) | |
68 | |
69 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleLogConfiguration.cmake) | |
70 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake) | |
71 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake) | |
72 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake) | |
73 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake) | |
74 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake) | |
75 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake) | |
76 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake) | |
77 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LuaConfiguration.cmake) | |
78 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake) | |
79 | |
80 | |
81 if (${ENABLE_SSL}) | |
82 add_definitions(-DORTHANC_SSL_ENABLED=1) | |
83 include(${CMAKE_SOURCE_DIR}/Resources/CMake/OpenSslConfiguration.cmake) | |
84 else() | |
85 add_definitions(-DORTHANC_SSL_ENABLED=0) | |
86 endif() | |
87 | |
88 | |
89 | |
90 ##################################################################### | |
91 ## Autogeneration of files | |
92 ##################################################################### | |
93 | |
94 # Prepare the embedded files | |
95 set(EMBEDDED_FILES | |
96 PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql | |
97 UPGRADE_DATABASE_3_TO_4 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade3To4.sql | |
98 CONFIGURATION_SAMPLE ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Configuration.json | |
99 LUA_TOOLBOX ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Toolbox.lua | |
100 ) | |
101 | |
102 if (${STANDALONE_BUILD}) | |
103 # We embed all the resources in the binaries for standalone builds | |
104 add_definitions(-DORTHANC_STANDALONE=1) | |
105 EmbedResources( | |
106 ${EMBEDDED_FILES} | |
107 ORTHANC_EXPLORER ${CMAKE_CURRENT_SOURCE_DIR}/OrthancExplorer | |
108 ${DCMTK_DICTIONARIES} | |
109 ) | |
110 else() | |
111 add_definitions( | |
112 -DORTHANC_STANDALONE=0 | |
113 -DORTHANC_PATH=\"${CMAKE_SOURCE_DIR}\" | |
114 ) | |
115 EmbedResources( | |
116 ${EMBEDDED_FILES} | |
117 ) | |
118 endif() | |
119 | |
120 | |
121 | |
122 ##################################################################### | |
123 ## Build the core of Orthanc | |
124 ##################################################################### | |
125 | |
126 add_definitions( | |
127 -DORTHANC_VERSION="${ORTHANC_VERSION}" | |
128 ) | |
129 | |
130 list(LENGTH OPENSSL_SOURCES OPENSSL_SOURCES_LENGTH) | |
131 if (${OPENSSL_SOURCES_LENGTH} GREATER 0) | |
132 add_library(OpenSSL STATIC ${OPENSSL_SOURCES}) | |
133 endif() | |
134 | |
135 add_library(CoreLibrary | |
136 STATIC | |
137 ${AUTOGENERATED_SOURCES} | |
138 ${THIRD_PARTY_SOURCES} | |
139 ${CURL_SOURCES} | |
140 | |
141 Core/Cache/MemoryCache.cpp | 61 Core/Cache/MemoryCache.cpp |
142 Core/ChunkedBuffer.cpp | 62 Core/ChunkedBuffer.cpp |
143 Core/Compression/BufferCompressor.cpp | 63 Core/Compression/BufferCompressor.cpp |
144 Core/Compression/ZlibCompressor.cpp | 64 Core/Compression/ZlibCompressor.cpp |
145 Core/Compression/ZipWriter.cpp | 65 Core/Compression/ZipWriter.cpp |
146 Core/Compression/HierarchicalZipWriter.cpp | 66 Core/Compression/HierarchicalZipWriter.cpp |
147 Core/OrthancException.cpp | 67 Core/OrthancException.cpp |
148 Core/DicomFormat/DicomArray.cpp | 68 Core/DicomFormat/DicomArray.cpp |
149 Core/DicomFormat/DicomMap.cpp | 69 Core/DicomFormat/DicomMap.cpp |
150 Core/DicomFormat/DicomTag.cpp | 70 Core/DicomFormat/DicomTag.cpp |
71 Core/DicomFormat/DicomImageInformation.cpp | |
151 Core/DicomFormat/DicomIntegerPixelAccessor.cpp | 72 Core/DicomFormat/DicomIntegerPixelAccessor.cpp |
152 Core/DicomFormat/DicomInstanceHasher.cpp | 73 Core/DicomFormat/DicomInstanceHasher.cpp |
153 Core/Enumerations.cpp | 74 Core/Enumerations.cpp |
154 Core/FileStorage/FileStorage.cpp | 75 Core/FileStorage/FileStorage.cpp |
155 Core/FileStorage/StorageAccessor.cpp | 76 Core/FileStorage/StorageAccessor.cpp |
170 Core/MultiThreading/BagOfRunnablesBySteps.cpp | 91 Core/MultiThreading/BagOfRunnablesBySteps.cpp |
171 Core/MultiThreading/Mutex.cpp | 92 Core/MultiThreading/Mutex.cpp |
172 Core/MultiThreading/ReaderWriterLock.cpp | 93 Core/MultiThreading/ReaderWriterLock.cpp |
173 Core/MultiThreading/SharedMessageQueue.cpp | 94 Core/MultiThreading/SharedMessageQueue.cpp |
174 Core/MultiThreading/ThreadedCommandProcessor.cpp | 95 Core/MultiThreading/ThreadedCommandProcessor.cpp |
175 Core/FileFormats/PngReader.cpp | 96 Core/ImageFormats/ImageAccessor.cpp |
176 Core/FileFormats/PngWriter.cpp | 97 Core/ImageFormats/ImageBuffer.cpp |
98 Core/ImageFormats/ImageProcessing.cpp | |
99 Core/ImageFormats/PngReader.cpp | |
100 Core/ImageFormats/PngWriter.cpp | |
177 Core/SQLite/Connection.cpp | 101 Core/SQLite/Connection.cpp |
178 Core/SQLite/FunctionContext.cpp | 102 Core/SQLite/FunctionContext.cpp |
179 Core/SQLite/Statement.cpp | 103 Core/SQLite/Statement.cpp |
180 Core/SQLite/StatementId.cpp | 104 Core/SQLite/StatementId.cpp |
181 Core/SQLite/StatementReference.cpp | 105 Core/SQLite/StatementReference.cpp |
188 OrthancCppClient/OrthancConnection.cpp | 112 OrthancCppClient/OrthancConnection.cpp |
189 OrthancCppClient/Study.cpp | 113 OrthancCppClient/Study.cpp |
190 OrthancCppClient/Series.cpp | 114 OrthancCppClient/Series.cpp |
191 OrthancCppClient/Instance.cpp | 115 OrthancCppClient/Instance.cpp |
192 OrthancCppClient/Patient.cpp | 116 OrthancCppClient/Patient.cpp |
193 ) | 117 ) |
194 | 118 |
195 | 119 |
196 ##################################################################### | 120 set(ORTHANC_SERVER_SOURCES |
197 ## Build the Orthanc server | |
198 ##################################################################### | |
199 | |
200 add_library(ServerLibrary | |
201 STATIC | |
202 ${DCMTK_SOURCES} | |
203 OrthancServer/DicomProtocol/DicomFindAnswers.cpp | 121 OrthancServer/DicomProtocol/DicomFindAnswers.cpp |
204 OrthancServer/DicomProtocol/DicomServer.cpp | 122 OrthancServer/DicomProtocol/DicomServer.cpp |
205 OrthancServer/DicomProtocol/DicomUserConnection.cpp | 123 OrthancServer/DicomProtocol/DicomUserConnection.cpp |
124 OrthancServer/DicomProtocol/RemoteModalityParameters.cpp | |
206 OrthancServer/DicomProtocol/ReusableDicomUserConnection.cpp | 125 OrthancServer/DicomProtocol/ReusableDicomUserConnection.cpp |
126 OrthancServer/DicomModification.cpp | |
207 OrthancServer/FromDcmtkBridge.cpp | 127 OrthancServer/FromDcmtkBridge.cpp |
128 OrthancServer/ParsedDicomFile.cpp | |
208 OrthancServer/Internals/CommandDispatcher.cpp | 129 OrthancServer/Internals/CommandDispatcher.cpp |
209 OrthancServer/Internals/FindScp.cpp | 130 OrthancServer/Internals/FindScp.cpp |
210 OrthancServer/Internals/MoveScp.cpp | 131 OrthancServer/Internals/MoveScp.cpp |
211 OrthancServer/Internals/StoreScp.cpp | 132 OrthancServer/Internals/StoreScp.cpp |
133 OrthancServer/Internals/DicomImageDecoder.cpp | |
212 OrthancServer/OrthancInitialization.cpp | 134 OrthancServer/OrthancInitialization.cpp |
135 OrthancServer/OrthancPeerParameters.cpp | |
213 OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp | 136 OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp |
214 OrthancServer/OrthancRestApi/OrthancRestApi.cpp | 137 OrthancServer/OrthancRestApi/OrthancRestApi.cpp |
215 OrthancServer/OrthancRestApi/OrthancRestArchive.cpp | 138 OrthancServer/OrthancRestApi/OrthancRestArchive.cpp |
216 OrthancServer/OrthancRestApi/OrthancRestChanges.cpp | 139 OrthancServer/OrthancRestApi/OrthancRestChanges.cpp |
217 OrthancServer/OrthancRestApi/OrthancRestModalities.cpp | 140 OrthancServer/OrthancRestApi/OrthancRestModalities.cpp |
218 OrthancServer/OrthancRestApi/OrthancRestResources.cpp | 141 OrthancServer/OrthancRestApi/OrthancRestResources.cpp |
219 OrthancServer/OrthancRestApi/OrthancRestSystem.cpp | 142 OrthancServer/OrthancRestApi/OrthancRestSystem.cpp |
220 OrthancServer/ServerIndex.cpp | 143 OrthancServer/ServerIndex.cpp |
221 OrthancServer/ToDcmtkBridge.cpp | 144 OrthancServer/ToDcmtkBridge.cpp |
222 OrthancServer/DatabaseWrapper.cpp | 145 OrthancServer/DatabaseWrapper.cpp |
223 OrthancServer/Scheduler/ServerFilterInstance.cpp | |
224 OrthancServer/Scheduler/ServerJob.cpp | |
225 OrthancServer/Scheduler/ServerScheduler.cpp | |
226 OrthancServer/ServerContext.cpp | 146 OrthancServer/ServerContext.cpp |
227 OrthancServer/ServerEnumerations.cpp | 147 OrthancServer/ServerEnumerations.cpp |
228 OrthancServer/ServerToolbox.cpp | 148 OrthancServer/ServerToolbox.cpp |
229 OrthancServer/OrthancFindRequestHandler.cpp | 149 OrthancServer/OrthancFindRequestHandler.cpp |
230 OrthancServer/OrthancMoveRequestHandler.cpp | 150 OrthancServer/OrthancMoveRequestHandler.cpp |
231 ) | 151 |
232 | 152 # From "lua-scripting" branch |
233 # Ensure autogenerated code is built before building ServerLibrary | 153 OrthancServer/Scheduler/ServerFilterInstance.cpp |
234 add_dependencies(ServerLibrary CoreLibrary) | 154 OrthancServer/Scheduler/ServerJob.cpp |
235 | 155 OrthancServer/Scheduler/ServerScheduler.cpp |
236 add_executable(Orthanc | 156 ) |
237 OrthancServer/main.cpp | 157 |
238 ) | 158 |
239 | 159 set(ORTHANC_UNIT_TESTS_SOURCES |
240 target_link_libraries(Orthanc ServerLibrary CoreLibrary) | |
241 | |
242 if (${OPENSSL_SOURCES_LENGTH} GREATER 0) | |
243 target_link_libraries(Orthanc OpenSSL) | |
244 endif() | |
245 | |
246 install( | |
247 TARGETS Orthanc | |
248 RUNTIME DESTINATION sbin | |
249 ) | |
250 | |
251 | |
252 | |
253 ##################################################################### | |
254 ## Build the unit tests | |
255 ##################################################################### | |
256 | |
257 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS) | |
258 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1) | |
259 else() | |
260 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0) | |
261 endif() | |
262 | |
263 add_definitions(-DORTHANC_BUILD_UNIT_TESTS=1) | |
264 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake) | |
265 add_executable(UnitTests | |
266 ${GTEST_SOURCES} | |
267 UnitTestsSources/DicomMap.cpp | 160 UnitTestsSources/DicomMap.cpp |
268 UnitTestsSources/FileStorage.cpp | 161 UnitTestsSources/FileStorage.cpp |
162 UnitTestsSources/FromDcmtk.cpp | |
269 UnitTestsSources/MemoryCache.cpp | 163 UnitTestsSources/MemoryCache.cpp |
270 UnitTestsSources/Png.cpp | 164 UnitTestsSources/Png.cpp |
271 UnitTestsSources/RestApi.cpp | 165 UnitTestsSources/RestApi.cpp |
272 UnitTestsSources/SQLite.cpp | 166 UnitTestsSources/SQLite.cpp |
273 UnitTestsSources/SQLiteChromium.cpp | 167 UnitTestsSources/SQLiteChromium.cpp |
275 UnitTestsSources/Versions.cpp | 169 UnitTestsSources/Versions.cpp |
276 UnitTestsSources/Zip.cpp | 170 UnitTestsSources/Zip.cpp |
277 UnitTestsSources/Lua.cpp | 171 UnitTestsSources/Lua.cpp |
278 UnitTestsSources/MultiThreading.cpp | 172 UnitTestsSources/MultiThreading.cpp |
279 UnitTestsSources/UnitTestsMain.cpp | 173 UnitTestsSources/UnitTestsMain.cpp |
280 ) | 174 UnitTestsSources/ImageProcessingTests.cpp |
281 target_link_libraries(UnitTests ServerLibrary CoreLibrary) | 175 UnitTestsSources/JpegLossless.cpp |
176 ) | |
177 | |
178 | |
179 | |
180 ##################################################################### | |
181 ## Inclusion of third-party dependencies | |
182 ##################################################################### | |
183 | |
184 # Configuration of the standalone builds | |
185 if (CMAKE_CROSSCOMPILING) | |
186 # Cross-compilation implies the standalone build | |
187 SET(STANDALONE_BUILD ON) | |
188 endif() | |
189 | |
190 # Prepare the third-party dependencies | |
191 SET(THIRD_PARTY_SOURCES | |
192 ${CMAKE_SOURCE_DIR}/Resources/md5/md5.c | |
193 ${CMAKE_SOURCE_DIR}/Resources/base64/base64.cpp | |
194 ) | |
195 | |
196 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleLogConfiguration.cmake) | |
197 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake) | |
198 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake) | |
199 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake) | |
200 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake) | |
201 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake) | |
202 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake) | |
203 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibPngConfiguration.cmake) | |
204 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LuaConfiguration.cmake) | |
205 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake) | |
206 | |
207 | |
208 if (${ENABLE_SSL}) | |
209 add_definitions(-DORTHANC_SSL_ENABLED=1) | |
210 include(${CMAKE_SOURCE_DIR}/Resources/CMake/OpenSslConfiguration.cmake) | |
211 else() | |
212 add_definitions(-DORTHANC_SSL_ENABLED=0) | |
213 endif() | |
214 | |
215 | |
216 if (ENABLE_JPEG) | |
217 add_definitions(-DORTHANC_JPEG_ENABLED=1) | |
218 else() | |
219 add_definitions(-DORTHANC_JPEG_ENABLED=0) | |
220 endif() | |
221 | |
222 | |
223 if (ENABLE_JPEG_LOSSLESS) | |
224 add_definitions(-DORTHANC_JPEG_LOSSLESS_ENABLED=1) | |
225 else() | |
226 add_definitions(-DORTHANC_JPEG_LOSSLESS_ENABLED=0) | |
227 endif() | |
228 | |
229 | |
230 | |
231 ##################################################################### | |
232 ## Autogeneration of files | |
233 ##################################################################### | |
234 | |
235 # Prepare the embedded files | |
236 set(EMBEDDED_FILES | |
237 PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql | |
238 UPGRADE_DATABASE_3_TO_4 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Upgrade3To4.sql | |
239 CONFIGURATION_SAMPLE ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Configuration.json | |
240 LUA_TOOLBOX ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Toolbox.lua | |
241 ) | |
242 | |
243 if (${STANDALONE_BUILD}) | |
244 # We embed all the resources in the binaries for standalone builds | |
245 add_definitions(-DORTHANC_STANDALONE=1) | |
246 EmbedResources( | |
247 ${EMBEDDED_FILES} | |
248 ORTHANC_EXPLORER ${CMAKE_CURRENT_SOURCE_DIR}/OrthancExplorer | |
249 ${DCMTK_DICTIONARIES} | |
250 ) | |
251 else() | |
252 add_definitions( | |
253 -DORTHANC_STANDALONE=0 | |
254 -DORTHANC_PATH=\"${CMAKE_SOURCE_DIR}\" | |
255 ) | |
256 EmbedResources( | |
257 ${EMBEDDED_FILES} | |
258 ) | |
259 endif() | |
260 | |
261 | |
262 | |
263 ##################################################################### | |
264 ## Build the core of Orthanc | |
265 ##################################################################### | |
266 | |
267 # Setup precompiled headers for Microsoft Visual Studio | |
268 if (${MSVC}) | |
269 add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1) | |
270 | |
271 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( | |
272 "PrecompiledHeaders.h" "Core/PrecompiledHeaders.cpp" ORTHANC_CORE_SOURCES) | |
273 | |
274 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( | |
275 "PrecompiledHeadersServer.h" "OrthancServer/PrecompiledHeadersServer.cpp" ORTHANC_SERVER_SOURCES) | |
276 | |
277 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( | |
278 "PrecompiledHeadersUnitTests.h" "UnitTestsSources/PrecompiledHeadersUnitTests.cpp" ORTHANC_UNIT_TESTS_SOURCES) | |
279 endif() | |
280 | |
281 | |
282 add_definitions( | |
283 -DORTHANC_VERSION="${ORTHANC_VERSION}" | |
284 ) | |
285 | |
286 list(LENGTH OPENSSL_SOURCES OPENSSL_SOURCES_LENGTH) | |
287 if (${OPENSSL_SOURCES_LENGTH} GREATER 0) | |
288 add_library(OpenSSL STATIC ${OPENSSL_SOURCES}) | |
289 endif() | |
290 | |
291 add_library(CoreLibrary | |
292 STATIC | |
293 ${AUTOGENERATED_SOURCES} | |
294 ${THIRD_PARTY_SOURCES} | |
295 ${CURL_SOURCES} | |
296 ${ORTHANC_CORE_SOURCES} | |
297 ) | |
298 | |
299 | |
300 ##################################################################### | |
301 ## Build the Orthanc server | |
302 ##################################################################### | |
303 | |
304 add_library(ServerLibrary | |
305 STATIC | |
306 ${DCMTK_SOURCES} | |
307 ${ORTHANC_SERVER_SOURCES} | |
308 ) | |
309 | |
310 # Ensure autogenerated code is built before building ServerLibrary | |
311 add_dependencies(ServerLibrary CoreLibrary) | |
312 | |
313 add_executable(Orthanc | |
314 OrthancServer/main.cpp | |
315 ) | |
316 | |
317 target_link_libraries(Orthanc ServerLibrary CoreLibrary ${STATIC_LUA} ${STATIC_GOOGLE_LOG}) | |
318 | |
319 if (${OPENSSL_SOURCES_LENGTH} GREATER 0) | |
320 target_link_libraries(Orthanc OpenSSL) | |
321 endif() | |
322 | |
323 install( | |
324 TARGETS Orthanc | |
325 RUNTIME DESTINATION sbin | |
326 ) | |
327 | |
328 | |
329 | |
330 ##################################################################### | |
331 ## Build the unit tests | |
332 ##################################################################### | |
333 | |
334 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS) | |
335 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1) | |
336 else() | |
337 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0) | |
338 endif() | |
339 | |
340 add_definitions(-DORTHANC_BUILD_UNIT_TESTS=1) | |
341 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake) | |
342 add_executable(UnitTests | |
343 ${GTEST_SOURCES} | |
344 ${ORTHANC_UNIT_TESTS_SOURCES} | |
345 ) | |
346 target_link_libraries(UnitTests ServerLibrary CoreLibrary ${STATIC_LUA} ${STATIC_GOOGLE_LOG}) | |
282 | 347 |
283 if (${OPENSSL_SOURCES_LENGTH} GREATER 0) | 348 if (${OPENSSL_SOURCES_LENGTH} GREATER 0) |
284 target_link_libraries(UnitTests OpenSSL) | 349 target_link_libraries(UnitTests OpenSSL) |
285 endif() | 350 endif() |
286 | 351 |
322 else() | 387 else() |
323 set(ORTHANC_CPP_CLIENT_AUX ${OPENSSL_SOURCES}) | 388 set(ORTHANC_CPP_CLIENT_AUX ${OPENSSL_SOURCES}) |
324 endif() | 389 endif() |
325 | 390 |
326 add_library(OrthancClient SHARED | 391 add_library(OrthancClient SHARED |
327 ${ORTHANC_ROOT}/Core/OrthancException.cpp | 392 ${ORTHANC_ROOT}/OrthancCppClient/OrthancCppClient.cpp |
328 ${ORTHANC_ROOT}/Core/Enumerations.cpp | |
329 ${ORTHANC_ROOT}/Core/Toolbox.cpp | |
330 ${ORTHANC_ROOT}/Core/HttpClient.cpp | |
331 ${ORTHANC_ROOT}/Core/MultiThreading/ArrayFilledByThreads.cpp | |
332 ${ORTHANC_ROOT}/Core/MultiThreading/ThreadedCommandProcessor.cpp | |
333 ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp | |
334 ${ORTHANC_ROOT}/Core/FileFormats/PngReader.cpp | |
335 ${ORTHANC_ROOT}/OrthancCppClient/OrthancConnection.cpp | |
336 ${ORTHANC_ROOT}/OrthancCppClient/Series.cpp | |
337 ${ORTHANC_ROOT}/OrthancCppClient/Study.cpp | |
338 ${ORTHANC_ROOT}/OrthancCppClient/Instance.cpp | |
339 ${ORTHANC_ROOT}/OrthancCppClient/Patient.cpp | |
340 ${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/SharedLibrary.cpp | 393 ${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/SharedLibrary.cpp |
341 ${ORTHANC_ROOT}/Resources/md5/md5.c | 394 ${ORTHANC_ROOT}/Resources/md5/md5.c |
342 ${ORTHANC_ROOT}/Resources/base64/base64.cpp | 395 ${ORTHANC_ROOT}/Resources/base64/base64.cpp |
343 ${ORTHANC_CPP_CLIENT_AUX} | 396 ${ORTHANC_CPP_CLIENT_AUX} |
344 ${THIRD_PARTY_SOURCES} | 397 ${THIRD_PARTY_SOURCES} |
345 ${CURL_SOURCES} | 398 ${CURL_SOURCES} |
346 ) | 399 ${GOOGLE_LOG_SOURCES} |
347 | 400 ) |
348 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | 401 |
402 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR | |
403 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") | |
349 set_target_properties(OrthancClient | 404 set_target_properties(OrthancClient |
350 PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed -Wl,--version-script=${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/Laaw/VersionScript.map" | 405 PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed -Wl,--version-script=${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/Laaw/VersionScript.map" |
351 ) | 406 ) |
352 target_link_libraries(OrthancClient pthread) | 407 target_link_libraries(OrthancClient pthread) |
353 | 408 |
357 if (CMAKE_CROSSCOMPILING) | 412 if (CMAKE_CROSSCOMPILING) |
358 set_target_properties(OrthancClient | 413 set_target_properties(OrthancClient |
359 PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++" | 414 PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++" |
360 ) | 415 ) |
361 endif() | 416 endif() |
417 | |
418 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") | |
419 # TODO | |
420 target_link_libraries(OrthancClient pthread) | |
362 | 421 |
363 else() | 422 else() |
364 message(FATAL_ERROR "Support your platform here") | 423 message(FATAL_ERROR "Support your platform here") |
365 endif() | 424 endif() |
366 | 425 |