comparison CMakeLists.txt @ 1396:ac4efabeb80c

Migration of the orthanc-client as a separate project
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 01 Jun 2015 11:15:55 +0200
parents b92de82e8869
children 1c8df4424437
comparison
equal deleted inserted replaced
1395:785e01da36a1 1396:ac4efabeb80c
12 12
13 # Parameters of the build 13 # Parameters of the build
14 SET(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") 14 SET(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
15 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)") 15 SET(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)")
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")
18 SET(DCMTK_DICTIONARY_DIR "" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (only when using system version of DCMTK)") 17 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") 18 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") 19 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") 20 SET(ENABLE_JPEG ON CACHE BOOL "Enable JPEG decompression")
22 SET(ENABLE_JPEG_LOSSLESS ON CACHE BOOL "Enable JPEG-LS (Lossless) decompression") 21 SET(ENABLE_JPEG_LOSSLESS ON CACHE BOOL "Enable JPEG-LS (Lossless) decompression")
100 Core/RestApi/RestApiGetCall.cpp 99 Core/RestApi/RestApiGetCall.cpp
101 Core/RestApi/RestApiHierarchy.cpp 100 Core/RestApi/RestApiHierarchy.cpp
102 Core/RestApi/RestApiPath.cpp 101 Core/RestApi/RestApiPath.cpp
103 Core/RestApi/RestApiOutput.cpp 102 Core/RestApi/RestApiOutput.cpp
104 Core/RestApi/RestApi.cpp 103 Core/RestApi/RestApi.cpp
105 Core/MultiThreading/ArrayFilledByThreads.cpp
106 Core/MultiThreading/BagOfRunnablesBySteps.cpp 104 Core/MultiThreading/BagOfRunnablesBySteps.cpp
107 Core/MultiThreading/Mutex.cpp 105 Core/MultiThreading/Mutex.cpp
108 Core/MultiThreading/ReaderWriterLock.cpp 106 Core/MultiThreading/ReaderWriterLock.cpp
109 Core/MultiThreading/Semaphore.cpp 107 Core/MultiThreading/Semaphore.cpp
110 Core/MultiThreading/SharedMessageQueue.cpp 108 Core/MultiThreading/SharedMessageQueue.cpp
111 Core/MultiThreading/ThreadedCommandProcessor.cpp
112 Core/ImageFormats/ImageAccessor.cpp 109 Core/ImageFormats/ImageAccessor.cpp
113 Core/ImageFormats/ImageBuffer.cpp 110 Core/ImageFormats/ImageBuffer.cpp
114 Core/ImageFormats/ImageProcessing.cpp 111 Core/ImageFormats/ImageProcessing.cpp
115 Core/ImageFormats/PngReader.cpp 112 Core/ImageFormats/PngReader.cpp
116 Core/ImageFormats/PngWriter.cpp 113 Core/ImageFormats/PngWriter.cpp
122 Core/SQLite/Transaction.cpp 119 Core/SQLite/Transaction.cpp
123 Core/Toolbox.cpp 120 Core/Toolbox.cpp
124 Core/Uuid.cpp 121 Core/Uuid.cpp
125 Core/Lua/LuaContext.cpp 122 Core/Lua/LuaContext.cpp
126 Core/Lua/LuaFunctionCall.cpp 123 Core/Lua/LuaFunctionCall.cpp
127
128 OrthancCppClient/OrthancConnection.cpp
129 OrthancCppClient/Study.cpp
130 OrthancCppClient/Series.cpp
131 OrthancCppClient/Instance.cpp
132 OrthancCppClient/Patient.cpp
133 124
134 Plugins/Engine/SharedLibrary.cpp 125 Plugins/Engine/SharedLibrary.cpp
135 Plugins/Engine/PluginsManager.cpp 126 Plugins/Engine/PluginsManager.cpp
136 Plugins/Engine/OrthancPlugins.cpp 127 Plugins/Engine/OrthancPlugins.cpp
137 Plugins/Engine/OrthancPluginDatabase.cpp 128 Plugins/Engine/OrthancPluginDatabase.cpp
402 DIRECTORY ${binary_dir}/Install/share/orthanc/plugins 393 DIRECTORY ${binary_dir}/Install/share/orthanc/plugins
403 DESTINATION share/orthanc 394 DESTINATION share/orthanc
404 ) 395 )
405 396
406 397
407 #####################################################################
408 ## Create the standalone DLL containing the Orthanc Client API
409 #####################################################################
410
411 if (BUILD_CLIENT_LIBRARY)
412 include_directories(${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/Laaw)
413
414 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
415 if (CMAKE_CROSSCOMPILING)
416 # Remove the default "lib" prefix from "libOrthancClient.dll" if cross-compiling
417 set(CMAKE_SHARED_LIBRARY_PREFIX "")
418
419 if (${CMAKE_SIZEOF_VOID_P} EQUAL 4)
420 set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows32.def)
421 elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
422 set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows64.def)
423 else()
424 message(FATAL_ERROR "Support your platform here")
425 endif()
426 else()
427 # Nothing to do if using Visual Studio
428 endif()
429
430 if (${CMAKE_SIZEOF_VOID_P} EQUAL 4)
431 set(CMAKE_SHARED_LIBRARY_SUFFIX "_Windows32.dll")
432 list(APPEND ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows32.rc)
433 elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
434 set(CMAKE_SHARED_LIBRARY_SUFFIX "_Windows64.dll")
435 list(APPEND ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows64.rc)
436 else()
437 message(FATAL_ERROR "Support your platform here")
438 endif()
439
440 else()
441 set(ORTHANC_CPP_CLIENT_AUX ${OPENSSL_SOURCES})
442 endif()
443
444 add_library(OrthancClient SHARED
445 ${ORTHANC_ROOT}/OrthancCppClient/OrthancCppClient.cpp
446 ${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/SharedLibrary.cpp
447 ${ORTHANC_ROOT}/Resources/ThirdParty/md5/md5.c
448 ${ORTHANC_ROOT}/Resources/ThirdParty/base64/base64.cpp
449 ${ORTHANC_CPP_CLIENT_AUX}
450 ${THIRD_PARTY_SOURCES}
451 ${CURL_SOURCES}
452 ${GOOGLE_LOG_SOURCES}
453 )
454
455 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
456 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
457 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
458 set_target_properties(OrthancClient
459 PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed -Wl,--version-script=${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/Laaw/VersionScript.map"
460 )
461 target_link_libraries(OrthancClient pthread)
462
463 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
464 target_link_libraries(OrthancClient OpenSSL ws2_32)
465
466 if (CMAKE_CROSSCOMPILING)
467 set_target_properties(OrthancClient
468 PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++"
469 )
470 endif()
471
472 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
473 # TODO
474 target_link_libraries(OrthancClient pthread)
475
476 else()
477 message(FATAL_ERROR "Support your platform here")
478 endif()
479
480
481 # Set the version of the "Orthanc Client" shared library
482 file(STRINGS
483 ${CMAKE_SOURCE_DIR}/OrthancCppClient/SharedLibrary/Product.json
484 ORTHANC_CLIENT_VERSION_TMP
485 REGEX "^[ \t]*\"Version\"[ \t]*")
486
487 string(REGEX REPLACE "^.*\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\"" "\\1.\\2"
488 ORTHANC_CLIENT_VERSION ${ORTHANC_CLIENT_VERSION_TMP})
489
490 message("Setting the version of the library to ${ORTHANC_CLIENT_VERSION}")
491
492 set_target_properties(OrthancClient PROPERTIES
493 VERSION ${ORTHANC_CLIENT_VERSION}
494 SOVERSION ${ORTHANC_CLIENT_VERSION})
495
496
497 install(
498 TARGETS OrthancClient
499 RUNTIME DESTINATION lib # Destination for Windows
500 LIBRARY DESTINATION lib # Destination for Linux
501 )
502
503 install(
504 FILES
505 ${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h
506 ${ORTHANC_ROOT}/Plugins/Include/OrthancCPlugin.h
507 ${ORTHANC_ROOT}/Plugins/Include/OrthancCDatabasePlugin.h
508 ${ORTHANC_ROOT}/Plugins/Include/OrthancCppDatabasePlugin.h
509 DESTINATION include/orthanc
510 )
511 endif()
512
513
514
515 398
516 ##################################################################### 399 #####################################################################
517 ## Generate the documentation if Doxygen is present 400 ## Generate the documentation if Doxygen is present
518 ##################################################################### 401 #####################################################################
519 402
543 426
544 install( 427 install(
545 DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/OrthancPluginDocumentation/doc/ 428 DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/OrthancPluginDocumentation/doc/
546 DESTINATION share/doc/orthanc/OrthancPlugin 429 DESTINATION share/doc/orthanc/OrthancPlugin
547 ) 430 )
548
549 if (BUILD_CLIENT_LIBRARY)
550 configure_file(
551 ${CMAKE_SOURCE_DIR}/Resources/OrthancClient.doxygen
552 ${CMAKE_CURRENT_BINARY_DIR}/OrthancClient.doxygen
553 @ONLY)
554
555 add_custom_command(TARGET OrthancClient
556 POST_BUILD
557 COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/OrthancClient.doxygen
558 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
559 COMMENT "Generating client documentation with Doxygen" VERBATIM
560 )
561
562 install(
563 DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/OrthancClientDocumentation/doc/
564 DESTINATION share/doc/orthanc/OrthancClient
565 )
566 endif()
567
568 else() 431 else()
569 message("Doxygen not found. The documentation will not be built.") 432 message("Doxygen not found. The documentation will not be built.")
570 endif() 433 endif()
571 434
572 435