comparison CMakeLists.txt @ 546:0e510ea3de31 laaw

merge mainline -> laaw
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 13 Sep 2013 11:25:08 +0200
parents fe796b053863 b2b56b4e33b0
children ffedcc8f0938
comparison
equal deleted inserted replaced
543:fe796b053863 546:0e510ea3de31
18 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL") 18 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL")
19 SET(BUILD_UNIT_TESTS ON CACHE BOOL "Build the unit tests") 19 SET(BUILD_UNIT_TESTS ON CACHE BOOL "Build the unit tests")
20 SET(BUILD_CLIENT_LIBRARY ON CACHE BOOL "Build the client library") 20 SET(BUILD_CLIENT_LIBRARY ON CACHE BOOL "Build the client library")
21 SET(DCMTK_DICTIONARY_DIR "/usr/share/dcmtk" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (ignored in standalone builds)") 21 SET(DCMTK_DICTIONARY_DIR "/usr/share/dcmtk" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (ignored in standalone builds)")
22 22
23 # Advanced parameters (for Debian packaging) 23 # Advanced parameters to fine-tune linking against system libraries
24 SET(USE_DYNAMIC_JSONCPP OFF CACHE BOOL "Use the dynamic version of JsonCpp (only for Debian sid)") 24 SET(USE_DYNAMIC_JSONCPP OFF CACHE BOOL "Use the dynamic version of JsonCpp")
25 SET(USE_DYNAMIC_GOOGLE_LOG ON CACHE BOOL "Use the dynamic version of Google Log") 25 SET(USE_DYNAMIC_GOOGLE_LOG ON CACHE BOOL "Use the dynamic version of Google Log")
26 SET(USE_DYNAMIC_GOOGLE_TEST ON CACHE BOOL "Use the dynamic version of Google Test (not for Debian sid)") 26 SET(USE_DYNAMIC_GOOGLE_TEST ON CACHE BOOL "Use the dynamic version of Google Test")
27 SET(USE_DYNAMIC_SQLITE ON CACHE BOOL "Use the dynamic version of SQLite") 27 SET(USE_DYNAMIC_SQLITE ON CACHE BOOL "Use the dynamic version of SQLite")
28 SET(USE_DYNAMIC_MONGOOSE OFF CACHE BOOL "Use the dynamic version of Mongoose") 28 SET(USE_DYNAMIC_MONGOOSE OFF CACHE BOOL "Use the dynamic version of Mongoose")
29 SET(USE_DYNAMIC_LUA OFF CACHE BOOL "Use the dynamic version of Lua") 29 SET(USE_DYNAMIC_LUA OFF CACHE BOOL "Use the dynamic version of Lua")
30 SET(DEBIAN_FORCE_HARDENING OFF CACHE BOOL "Force the injection of Debian hardening flags (unrecommended)") 30 SET(DEBIAN_USE_GTEST_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
31 SET(DEBIAN_USE_GTEST_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (only for Debian sid)")
32 SET(ONLY_CORE_LIBRARY OFF CACHE BOOL "Only build the core library")
33 31
34 mark_as_advanced(USE_DYNAMIC_JSONCPP) 32 mark_as_advanced(USE_DYNAMIC_JSONCPP)
35 mark_as_advanced(USE_DYNAMIC_GOOGLE_LOG) 33 mark_as_advanced(USE_DYNAMIC_GOOGLE_LOG)
36 mark_as_advanced(USE_DYNAMIC_GOOGLE_TEST) 34 mark_as_advanced(USE_DYNAMIC_GOOGLE_TEST)
37 mark_as_advanced(USE_DYNAMIC_SQLITE) 35 mark_as_advanced(USE_DYNAMIC_SQLITE)
38 mark_as_advanced(DEBIAN_FORCE_HARDENING) 36 mark_as_advanced(DEBIAN_USE_GTEST_SOURCE_PACKAGE)
39 mark_as_advanced(DEBIAN_USE_STATIC_GOOGLE_TEST)
40 mark_as_advanced(ONLY_CORE_LIBRARY)
41 37
42 # Some basic inclusions 38 # Some basic inclusions
43 include(CheckIncludeFiles) 39 include(CheckIncludeFiles)
44 include(CheckIncludeFileCXX) 40 include(CheckIncludeFileCXX)
45 include(CheckLibraryExists) 41 include(CheckLibraryExists)
77 else() 73 else()
78 add_definitions(-DORTHANC_SSL_ENABLED=0) 74 add_definitions(-DORTHANC_SSL_ENABLED=0)
79 endif() 75 endif()
80 76
81 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake) 77 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake)
82 78 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
83 if(NOT ONLY_CORE_LIBRARY)
84 include(${CMAKE_SOURCE_DIR}/Resources/CMake/DcmtkConfiguration.cmake)
85 endif()
86
87 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake) 79 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake)
88 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake) 80 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake)
89 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake) 81 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake)
90 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake) 82 include(${CMAKE_SOURCE_DIR}/Resources/CMake/JsonCppConfiguration.cmake)
91 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake) 83 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LibCurlConfiguration.cmake)
191 OrthancCppClient/Instance.cpp 183 OrthancCppClient/Instance.cpp
192 OrthancCppClient/Patient.cpp 184 OrthancCppClient/Patient.cpp
193 ) 185 )
194 186
195 187
196 188 #####################################################################
197 if(NOT ONLY_CORE_LIBRARY) 189 ## Build the Orthanc server
198 ##################################################################### 190 #####################################################################
199 ## Build the Orthanc server 191
200 ##################################################################### 192 add_library(ServerLibrary
201 193 STATIC
202 add_library(ServerLibrary 194 ${DCMTK_SOURCES}
203 STATIC 195 OrthancServer/DicomProtocol/DicomFindAnswers.cpp
204 ${DCMTK_SOURCES} 196 OrthancServer/DicomProtocol/DicomServer.cpp
205 OrthancServer/DicomProtocol/DicomFindAnswers.cpp 197 OrthancServer/DicomProtocol/DicomUserConnection.cpp
206 OrthancServer/DicomProtocol/DicomServer.cpp 198 OrthancServer/FromDcmtkBridge.cpp
207 OrthancServer/DicomProtocol/DicomUserConnection.cpp 199 OrthancServer/Internals/CommandDispatcher.cpp
208 OrthancServer/FromDcmtkBridge.cpp 200 OrthancServer/Internals/FindScp.cpp
209 OrthancServer/Internals/CommandDispatcher.cpp 201 OrthancServer/Internals/MoveScp.cpp
210 OrthancServer/Internals/FindScp.cpp 202 OrthancServer/Internals/StoreScp.cpp
211 OrthancServer/Internals/MoveScp.cpp 203 OrthancServer/OrthancInitialization.cpp
212 OrthancServer/Internals/StoreScp.cpp 204 OrthancServer/OrthancRestApi.cpp
213 OrthancServer/OrthancInitialization.cpp 205 OrthancServer/ServerIndex.cpp
214 OrthancServer/OrthancRestApi.cpp 206 OrthancServer/ToDcmtkBridge.cpp
215 OrthancServer/ServerIndex.cpp 207 OrthancServer/DatabaseWrapper.cpp
216 OrthancServer/ToDcmtkBridge.cpp 208 OrthancServer/ServerContext.cpp
217 OrthancServer/DatabaseWrapper.cpp 209 OrthancServer/ServerEnumerations.cpp
218 OrthancServer/ServerContext.cpp 210 OrthancServer/ServerToolbox.cpp
219 OrthancServer/ServerEnumerations.cpp 211 )
220 OrthancServer/ServerToolbox.cpp 212
221 ) 213 # Ensure autogenerated code is built before building ServerLibrary
222 214 add_dependencies(ServerLibrary CoreLibrary)
223 # Ensure autogenerated code is built before building ServerLibrary 215
224 add_dependencies(ServerLibrary CoreLibrary) 216 add_executable(Orthanc
225 217 OrthancServer/main.cpp
226 add_executable(Orthanc 218 )
227 OrthancServer/main.cpp 219
228 ) 220 target_link_libraries(Orthanc ServerLibrary CoreLibrary)
229 221
230 target_link_libraries(Orthanc ServerLibrary CoreLibrary) 222 if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
223 target_link_libraries(Orthanc OpenSSL)
224 endif()
225
226 install(
227 TARGETS Orthanc
228 RUNTIME DESTINATION bin
229 )
230
231
232
233 #####################################################################
234 ## Build the unit tests if required
235 #####################################################################
236
237 if (BUILD_UNIT_TESTS)
238 add_definitions(-DORTHANC_BUILD_UNIT_TESTS=1)
239 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
240 add_executable(UnitTests
241 ${GTEST_SOURCES}
242 UnitTests/FileStorage.cpp
243 UnitTests/MemoryCache.cpp
244 UnitTests/Png.cpp
245 UnitTests/RestApi.cpp
246 UnitTests/SQLite.cpp
247 UnitTests/SQLiteChromium.cpp
248 UnitTests/ServerIndex.cpp
249 UnitTests/Versions.cpp
250 UnitTests/Zip.cpp
251 UnitTests/Lua.cpp
252 UnitTests/main.cpp
253 )
254 target_link_libraries(UnitTests ServerLibrary CoreLibrary)
231 255
232 if (${OPENSSL_SOURCES_LENGTH} GREATER 0) 256 if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
233 target_link_libraries(Orthanc OpenSSL) 257 target_link_libraries(UnitTests OpenSSL)
234 endif() 258 endif()
235 259 endif()
236 install( 260
237 TARGETS Orthanc
238 RUNTIME DESTINATION bin
239 )
240
241
242 #####################################################################
243 ## Build the unit tests if required
244 #####################################################################
245
246 if (BUILD_UNIT_TESTS)
247 add_definitions(-DORTHANC_BUILD_UNIT_TESTS=1)
248 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
249 add_executable(UnitTests
250 ${GTEST_SOURCES}
251 UnitTests/FileStorage.cpp
252 UnitTests/MemoryCache.cpp
253 UnitTests/Png.cpp
254 UnitTests/RestApi.cpp
255 UnitTests/SQLite.cpp
256 UnitTests/SQLiteChromium.cpp
257 UnitTests/ServerIndex.cpp
258 UnitTests/Versions.cpp
259 UnitTests/Zip.cpp
260 UnitTests/Lua.cpp
261 UnitTests/main.cpp
262 )
263 target_link_libraries(UnitTests ServerLibrary CoreLibrary)
264
265 if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
266 target_link_libraries(UnitTests OpenSSL)
267 endif()
268
269 endif()
270 endif()
271 261
272 262
273 ##################################################################### 263 #####################################################################
274 ## Create the standalone DLL containing the Orthanc Client API 264 ## Create the standalone DLL containing the Orthanc Client API
275 ##################################################################### 265 #####################################################################
330 endif() 320 endif()
331 else() 321 else()
332 message(FATAL_ERROR "Support your platform here") 322 message(FATAL_ERROR "Support your platform here")
333 endif() 323 endif()
334 324
335 # Copy the header file of the client library to the build directory
336 add_custom_command(
337 TARGET OrthancClient PRE_BUILD
338 COMMAND ${CMAKE_COMMAND} -E copy
339 ${ORTHANC_ROOT}/OrthancCppClient/Package/AUTOGENERATED/OrthancCppClient.h
340 ${CMAKE_BINARY_DIR})
341
342 install( 325 install(
343 TARGETS OrthancClient 326 TARGETS OrthancClient
344 LIBRARY DESTINATION lib 327 LIBRARY DESTINATION lib
345 ) 328 )
346 329
347 install( 330 install(
348 FILES ${CMAKE_BINARY_DIR}/OrthancCppClient.h 331 FILES ${ORTHANC_ROOT}/OrthancCppClient/Package/AUTOGENERATED/OrthancCppClient.h
349 DESTINATION include/orthanc 332 DESTINATION include/orthanc
350 ) 333 )
351 endif() 334 endif()
352 335
353 336