comparison CMakeLists.txt @ 543:fe796b053863 laaw

conditional
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 13 Sep 2013 11:10:58 +0200
parents eaca3d38b2aa
children 0e510ea3de31
comparison
equal deleted inserted replaced
540:eaca3d38b2aa 543:fe796b053863
15 # Parameters of the build 15 # Parameters of the build
16 SET(STATIC_BUILD ON CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") 16 SET(STATIC_BUILD ON CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
17 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)") 17 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)")
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(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)")
21 22
22 # Advanced parameters (for Debian packaging) 23 # Advanced parameters (for Debian packaging)
23 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 (only for Debian sid)")
24 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")
271 272
272 ##################################################################### 273 #####################################################################
273 ## Create the standalone DLL containing the Orthanc Client API 274 ## Create the standalone DLL containing the Orthanc Client API
274 ##################################################################### 275 #####################################################################
275 276
276 include_directories(${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw) 277 if (BUILD_CLIENT_LIBRARY)
277 278 include_directories(${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw)
278 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 279
279 if (${CMAKE_SIZEOF_VOID_P} EQUAL 4) 280 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
280 set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/Package/Build/Windows32.def) 281 if (${CMAKE_SIZEOF_VOID_P} EQUAL 4)
281 elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8) 282 set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/Package/Build/Windows32.def)
282 set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/Package/Build/Windows64.def) 283 elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
284 set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/Package/Build/Windows64.def)
285 else()
286 message(FATAL_ERROR "Support your platform here")
287 endif()
288 else()
289 set(ORTHANC_CPP_CLIENT_AUX ${OPENSSL_SOURCES})
290 endif()
291
292 add_library(OrthancClient SHARED
293 ${ORTHANC_ROOT}/Core/OrthancException.cpp
294 ${ORTHANC_ROOT}/Core/Enumerations.cpp
295 ${ORTHANC_ROOT}/Core/Toolbox.cpp
296 ${ORTHANC_ROOT}/Core/HttpClient.cpp
297 ${ORTHANC_ROOT}/Core/MultiThreading/ArrayFilledByThreads.cpp
298 ${ORTHANC_ROOT}/Core/MultiThreading/ThreadedCommandProcessor.cpp
299 ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp
300 ${ORTHANC_ROOT}/Core/FileFormats/PngReader.cpp
301 ${ORTHANC_ROOT}/OrthancCppClient/OrthancConnection.cpp
302 ${ORTHANC_ROOT}/OrthancCppClient/Series.cpp
303 ${ORTHANC_ROOT}/OrthancCppClient/Study.cpp
304 ${ORTHANC_ROOT}/OrthancCppClient/Instance.cpp
305 ${ORTHANC_ROOT}/OrthancCppClient/Patient.cpp
306 ${ORTHANC_ROOT}/OrthancCppClient/Package/SharedLibrary.cpp
307 ${ORTHANC_ROOT}/Resources/sha1/sha1.cpp
308 ${ORTHANC_ROOT}/Resources/md5/md5.c
309 ${ORTHANC_ROOT}/Resources/base64/base64.cpp
310 ${ORTHANC_CPP_CLIENT_AUX}
311 ${THIRD_PARTY_SOURCES}
312 ${CURL_SOURCES}
313 )
314
315 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
316 set_target_properties(OrthancClient
317 PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed -Wl,--version-script=${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw/VersionScript.map"
318 )
319 target_link_libraries(OrthancClient pthread)
320 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
321 target_link_libraries(OrthancClient OpenSSL)
322
323 if (${CMAKE_COMPILER_IS_GNUCXX})
324 set_target_properties(OrthancClient
325 PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++"
326 )
327 target_link_libraries(OrthancClient ws2_32)
328 else()
329 message(FATAL_ERROR "Support Visual Studio here")
330 endif()
283 else() 331 else()
284 message(FATAL_ERROR "Support your platform here") 332 message(FATAL_ERROR "Support your platform here")
285 endif() 333 endif()
286 else() 334
287 set(ORTHANC_CPP_CLIENT_AUX ${OPENSSL_SOURCES}) 335 # Copy the header file of the client library to the build directory
288 endif() 336 add_custom_command(
289 337 TARGET OrthancClient PRE_BUILD
290 add_library(OrthancClient SHARED 338 COMMAND ${CMAKE_COMMAND} -E copy
291 ${ORTHANC_ROOT}/Core/OrthancException.cpp 339 ${ORTHANC_ROOT}/OrthancCppClient/Package/AUTOGENERATED/OrthancCppClient.h
292 ${ORTHANC_ROOT}/Core/Enumerations.cpp 340 ${CMAKE_BINARY_DIR})
293 ${ORTHANC_ROOT}/Core/Toolbox.cpp 341
294 ${ORTHANC_ROOT}/Core/HttpClient.cpp 342 install(
295 ${ORTHANC_ROOT}/Core/MultiThreading/ArrayFilledByThreads.cpp 343 TARGETS OrthancClient
296 ${ORTHANC_ROOT}/Core/MultiThreading/ThreadedCommandProcessor.cpp 344 LIBRARY DESTINATION lib
297 ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp 345 )
298 ${ORTHANC_ROOT}/Core/FileFormats/PngReader.cpp 346
299 ${ORTHANC_ROOT}/OrthancCppClient/OrthancConnection.cpp 347 install(
300 ${ORTHANC_ROOT}/OrthancCppClient/Series.cpp 348 FILES ${CMAKE_BINARY_DIR}/OrthancCppClient.h
301 ${ORTHANC_ROOT}/OrthancCppClient/Study.cpp 349 DESTINATION include/orthanc
302 ${ORTHANC_ROOT}/OrthancCppClient/Instance.cpp 350 )
303 ${ORTHANC_ROOT}/OrthancCppClient/Patient.cpp 351 endif()
304 ${ORTHANC_ROOT}/OrthancCppClient/Package/SharedLibrary.cpp
305 ${ORTHANC_ROOT}/Resources/sha1/sha1.cpp
306 ${ORTHANC_ROOT}/Resources/md5/md5.c
307 ${ORTHANC_ROOT}/Resources/base64/base64.cpp
308 ${ORTHANC_CPP_CLIENT_AUX}
309 ${THIRD_PARTY_SOURCES}
310 ${CURL_SOURCES}
311 )
312
313 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
314 set_target_properties(OrthancClient
315 PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed -Wl,--version-script=${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw/VersionScript.map"
316 )
317 target_link_libraries(OrthancClient pthread)
318 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
319 target_link_libraries(OrthancClient OpenSSL)
320
321 if (${CMAKE_COMPILER_IS_GNUCXX})
322 set_target_properties(OrthancClient
323 PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++"
324 )
325 target_link_libraries(OrthancClient ws2_32)
326 else()
327 message(FATAL_ERROR "Support Visual Studio here")
328 endif()
329 else()
330 message(FATAL_ERROR "Support your platform here")
331 endif()
332
333 # Copy the header file of the client library to the build directory
334 add_custom_command(
335 TARGET OrthancClient PRE_BUILD
336 COMMAND ${CMAKE_COMMAND} -E copy
337 ${ORTHANC_ROOT}/OrthancCppClient/Package/AUTOGENERATED/OrthancCppClient.h
338 ${CMAKE_BINARY_DIR})
339 352
340 353
341 ##################################################################### 354 #####################################################################
342 ## Generate the documentation if Doxygen is present 355 ## Generate the documentation if Doxygen is present
343 ##################################################################### 356 #####################################################################